You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am implementing the follow_redirects using the async_client and when I reuse the same response object, the body is updated but not the headers.
Sample:
intmain() {
std::string url = "http://google.com";
async_client::options options;
options
.follow_redirects(true)
.cache_resolved(true)
.always_verify_peer(false)
;
async_client client(options);
async_client::request req(url);
auto response = client.get(req));
while (!ready(response));
// we get the expected headers and bodyauto hdrs = headers(response);
for (auto &h : hdrs) {
LOG(INFO) << h.first << ": " << h.second;
}
LOG(INFO) << body(response);
LOG(INFO) << "-----------------";
req.uri("http://example.com"); // changing the url
response = client.get(req));
while (!ready(response));
// here the headers are the same as the previous response, they should be those from example.comauto hdrs2 = headers(response);
for (auto &h : hdrs2) {
LOG(INFO) << h.first << ": " << h.second;
}
// the body is the body of example.comLOG(INFO) << body(response);
}
I tried the swap method without success.
Weirdly I manage to make it working using smart_ptr like this :
I am using the branch 0.13-release (I don't see any 0.13-devel). I install the library this way:
git clone https://github.com/cpp-netlib/cpp-netlib.git
cd cpp-netlib
git checkout 0.13-release
git submodule update --init
cmake -D BUILD_SHARED_LIBS=ON .
make install -j 6
Also it seems that it generates the libraries sufixed by .so.0.12.0. Is it a problem with my installation or you just didn't change the version number yet ?
Thanks @tex -- apologies for the delay here. I've merged the PR to fix it too, sorry I've been traveling around that time and missed the notification on the pull request. This should make it into an rc1 for 0.13.0 which I'll try to get to sometime this week.
Activity
deanberris commentedon Aug 1, 2017
What version of the library are you using?
If this is the latest in GitHub or in 0.13-devel this should be fixed (and it's a bug).
maingoh commentedon Aug 2, 2017
I am using the branch 0.13-release (I don't see any 0.13-devel). I install the library this way:
Also it seems that it generates the libraries sufixed by .so.0.12.0. Is it a problem with my installation or you just didn't change the version number yet ?
deanberris commentedon Aug 2, 2017
Yeah, we haven't changed the version number in the branch yet. Can you send a pull request to fix that?
maingoh commentedon Aug 2, 2017
I'll try. Not sure what is the bug, but I will try to investigate If I find the time.
tex commentedon Nov 20, 2017
I confirm the bug is here on 0.13-release branch.
deanberris commentedon Nov 21, 2017
Thanks @tex -- apologies for the delay here. I've merged the PR to fix it too, sorry I've been traveling around that time and missed the notification on the pull request. This should make it into an rc1 for 0.13.0 which I'll try to get to sometime this week.