aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/http/client_connection.cc
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-05-24 16:55:21 +0200
committerMauro Sardara <msardara@cisco.com>2019-05-24 16:59:23 +0200
commit2f57713f83d686cca0419f294e0bc421dda693e1 (patch)
treed6974c6c83305ae2e46ce0cd1809643becf44ebd /libtransport/src/hicn/transport/http/client_connection.cc
parentc219dcd814551f531b0ee98b5c5d835491f51c85 (diff)
[HICN-206] Customize first part of the name for HTTP.
Change-Id: Ic2dd9cfce5b7d4eb82bef15cc40da16ea99230d8 Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport/src/hicn/transport/http/client_connection.cc')
-rw-r--r--libtransport/src/hicn/transport/http/client_connection.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/libtransport/src/hicn/transport/http/client_connection.cc b/libtransport/src/hicn/transport/http/client_connection.cc
index fadf0ae44..32269d49d 100644
--- a/libtransport/src/hicn/transport/http/client_connection.cc
+++ b/libtransport/src/hicn/transport/http/client_connection.cc
@@ -47,15 +47,16 @@ HTTPClientConnection::HTTPClientConnection()
HTTPClientConnection::RC HTTPClientConnection::get(
const std::string &url, HTTPHeaders headers, HTTPPayload payload,
- std::shared_ptr<HTTPResponse> response, ReadBytesCallback *callback) {
- return sendRequest(url, HTTPMethod::GET, headers, payload, response,
- callback);
+ std::shared_ptr<HTTPResponse> response, ReadBytesCallback *callback,
+ std::string ipv6_first_word) {
+ return sendRequest(url, HTTPMethod::GET, headers, payload, response, callback,
+ ipv6_first_word);
}
HTTPClientConnection::RC HTTPClientConnection::sendRequest(
const std::string &url, HTTPMethod method, HTTPHeaders headers,
HTTPPayload payload, std::shared_ptr<HTTPResponse> response,
- ReadBytesCallback *callback) {
+ ReadBytesCallback *callback, std::string ipv6_first_word) {
current_url_ = url;
read_bytes_callback_ = callback;
if (!response) {
@@ -82,12 +83,13 @@ HTTPClientConnection::RC HTTPClientConnection::sendRequest(
return response;
};
- sendRequestGetReply(request, response);
+ sendRequestGetReply(request, response, ipv6_first_word);
return return_code_;
}
void HTTPClientConnection::sendRequestGetReply(
- const HTTPRequest &request, std::shared_ptr<HTTPResponse> &response) {
+ const HTTPRequest &request, std::shared_ptr<HTTPResponse> &response,
+ std::string &ipv6_first_word) {
const std::string &request_string = request.getRequestString();
const std::string &locator = request.getLocator();
@@ -107,7 +109,7 @@ void HTTPClientConnection::sendRequestGetReply(
// Factor hicn name using hash
name_.str("");
- name_ << std::hex << http::default_values::ipv6_first_word << ":";
+ name_ << ipv6_first_word << ":";
for (uint16_t *word = (uint16_t *)&locator_hash;
std::size_t(word) < (std::size_t(&locator_hash) + sizeof(locator_hash));