Skip to content

Commit

Permalink
Set user agent for HTTP discovery.
Browse files Browse the repository at this point in the history
  • Loading branch information
schildbach committed Aug 25, 2015
1 parent 5bd0623 commit 74af6a2
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ public InetSocketAddress[] getPeers(long services, long timeoutValue, TimeUnit t
HttpUrl.Builder url = HttpUrl.get(details.uri).newBuilder();
if (services != 0)
url.addQueryParameter("srvmask", Long.toString(services));
Request.Builder request = new Request.Builder();
request.url(url.build());
request.addHeader("User-Agent", VersionMessage.LIBRARY_SUBVER); // TODO Add main version.
log.info("Requesting seeds from {}", url);
Response response = client.newCall(new Request.Builder().url(url.build()).build()).execute();
Response response = client.newCall(request.build()).execute();
if (!response.isSuccessful())
throw new PeerDiscoveryException("HTTP request failed: " + response.code() + " " + response.message());
InputStream stream = response.body().byteStream();
Expand Down

0 comments on commit 74af6a2

Please sign in to comment.