Skip to content

properly implemented Accept-Encoding:gzip. gzip availability is checked runtime. #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
# make sure to change the version in docs/Makefile
set (MUJINCLIENT_VERSION_MAJOR 0)
set (MUJINCLIENT_VERSION_MINOR 48)
set (MUJINCLIENT_VERSION_PATCH 0)
set (MUJINCLIENT_VERSION_PATCH 1)
set (MUJINCLIENT_VERSION ${MUJINCLIENT_VERSION_MAJOR}.${MUJINCLIENT_VERSION_MINOR}.${MUJINCLIENT_VERSION_PATCH})
set (MUJINCLIENT_SOVERSION ${MUJINCLIENT_VERSION_MAJOR}.${MUJINCLIENT_VERSION_MINOR})
set (CLIENT_SOVERSION ${MUJINCLIENT_VERSION_MAJOR}.${MUJINCLIENT_VERSION_MINOR})
Expand Down
9 changes: 7 additions & 2 deletions src/controllerclientimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ ControllerClientImpl::ControllerClientImpl(const std::string& usernamepassword,
CURL_OPTION_SETTER(_curl, CURLOPT_POSTFIELDSIZE, 0L);
CURL_OPTION_SETTER(_curl, CURLOPT_POSTFIELDS, NULL);

{
curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
if(ver->features & CURL_VERSION_LIBZ) {
CURL_OPTION_SETTER(_curl, CURLOPT_ACCEPT_ENCODING, "gzip, deflate");
}
}

// csrftoken can be any non-empty string
_csrfmiddlewaretoken = "csrftoken";
std::string cookie = "Set-Cookie: csrftoken=" + _csrfmiddlewaretoken;
Expand Down Expand Up @@ -974,8 +981,6 @@ void ControllerClientImpl::_SetupHTTPHeadersJSON()
_httpheadersjson = curl_slist_append(_httpheadersjson, s.c_str());
_httpheadersjson = curl_slist_append(_httpheadersjson, "Connection: Keep-Alive");
_httpheadersjson = curl_slist_append(_httpheadersjson, "Keep-Alive: 20"); // keep alive for 20s?
// test on windows first
//_httpheadersjson = curl_slist_append(_httpheadersjson, "Accept-Encoding: gzip, deflate");
}

void ControllerClientImpl::_SetupHTTPHeadersSTL()
Expand Down