Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making the user agent configurable #410

Merged
merged 2 commits into from
May 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jodd-http/src/main/java/jodd/http/HttpRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ protected Buffer buffer(boolean fullRequest) {
// user-agent

if (header("User-Agent") == null) {
header("User-Agent", "Jodd HTTP");
header("User-Agent", JoddHttp.defaultUserAgent);
}

// POST method requires Content-Type to be set
Expand Down Expand Up @@ -945,4 +945,4 @@ public static HttpRequest readFrom(InputStream in, String encoding) {
return httpRequest;
}

}
}
7 changes: 6 additions & 1 deletion jodd-http/src/main/java/jodd/http/JoddHttp.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public class JoddHttp {
* read from system property <code>https.protocols</code>.
*/
public static String defaultSecureEnabledProtocols = System.getProperty("https.protocols");

/**
* Default user agent (Jodd HTTP)
*/
public static String defaultUserAgent = "Jodd HTTP";

// ---------------------------------------------------------------- module

Expand All @@ -76,4 +81,4 @@ public static void init() {
Jodd.init(JoddHttp.class);
}

}
}