Browse Source

[http] keep query even if it was empty (closes #1844)

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/1861/head
R4SAS 2 years ago
parent
commit
b31f52e332
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 5
      libi2pd/HTTP.cpp
  2. 1
      libi2pd/HTTP.h

5
libi2pd/HTTP.cpp

@ -160,6 +160,7 @@ namespace http @@ -160,6 +160,7 @@ namespace http
return true;
} else if (url.at(pos_c) == '?') {
/* found query part */
hasquery = true;
path = url.substr(pos_p, pos_c - pos_p);
pos_p = pos_c + 1;
pos_c = url.find('#', pos_p);
@ -218,8 +219,10 @@ namespace http @@ -218,8 +219,10 @@ namespace http
}
}
out += path;
if (hasquery) // add query even if it was empty
out += "?";
if (query != "")
out += "?" + query;
out += query;
if (frag != "")
out += "#" + frag;
return out;

1
libi2pd/HTTP.h

@ -33,6 +33,7 @@ namespace http @@ -33,6 +33,7 @@ namespace http
std::string host;
unsigned short int port;
std::string path;
bool hasquery;
std::string query;
std::string frag;

Loading…
Cancel
Save