Skip to content

Commit

Permalink
Merge pull request #410 from neroux/master
Browse files Browse the repository at this point in the history
Making the user agent configurable
  • Loading branch information
igr authored May 8, 2017
2 parents 50451f5 + d4d5762 commit dd2ad87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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);
}

}
}

0 comments on commit dd2ad87

Please sign in to comment.