Skip to content

Commit

Permalink
CPP Client: Added client version to User Agent in HTTP Lookup (apache…
Browse files Browse the repository at this point in the history
  • Loading branch information
jai1 authored Sep 18, 2017
1 parent 824922a commit 272f290
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pulsar-client-cpp/lib/HTTPLookupService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace pulsar {
CURL *handle;
CURLcode res;
std::string responseData;

std::string version = std::string("Pulsar-CPP-v") + _PULSAR_VERSION_;
handle = curl_easy_init();

if(!handle) {
Expand All @@ -105,6 +105,9 @@ namespace pulsar {
// Timer
curl_easy_setopt(handle, CURLOPT_TIMEOUT, lookupTimeoutInSeconds_);

// Set User Agent
curl_easy_setopt(handle, CURLOPT_USERAGENT, version.c_str());

// Redirects
curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(handle, CURLOPT_MAXREDIRS, MAX_HTTP_REDIRECTS);
Expand Down
1 change: 1 addition & 0 deletions pulsar-client-cpp/lib/HTTPLookupService.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <json/reader.h>
#include <boost/bind.hpp>
#include <curl/curl.h>
#include <lib/Version.h>

namespace pulsar {
class HTTPLookupService : public LookupService, public boost::enable_shared_from_this<HTTPLookupService> {
Expand Down

0 comments on commit 272f290

Please sign in to comment.