Skip to content

Commit

Permalink
Issue 4916 - Request compression in CURL WebRequest.
Browse files Browse the repository at this point in the history
  • Loading branch information
hfiguiere committed Mar 2, 2017
1 parent 70ac246 commit 8ba0148
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/DefaultWebRequestCurl.cpp
Expand Up @@ -138,6 +138,8 @@ AdblockPlus::ServerResponse AdblockPlus::DefaultWebRequest::GET(
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, ReceiveData);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &responseText);
// Request compressed data. Using any supported aglorithm
curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "");
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, ReceiveHeader);
curl_easy_setopt(curl, CURLOPT_HEADERDATA, &headerData);

Expand Down
3 changes: 3 additions & 0 deletions test/WebRequest.cpp
Expand Up @@ -89,6 +89,9 @@ TEST_F(DefaultWebRequestTest, RealWebRequest)
ASSERT_EQ(200, jsEngine->Evaluate("foo.responseStatus")->AsInt());
ASSERT_EQ("[Adblock Plus ", jsEngine->Evaluate("foo.responseText.substr(0, 14)")->AsString());
ASSERT_EQ("text/plain", jsEngine->Evaluate("foo.responseHeaders['content-type'].substr(0, 10)")->AsString());
#if defined(HAVE_CURL)
ASSERT_EQ("gzip", jsEngine->Evaluate("foo.responseHeaders['content-encoding'].substr(0, 4)")->AsString());
#endif
ASSERT_TRUE(jsEngine->Evaluate("foo.responseHeaders['location']")->IsUndefined());
}

Expand Down

0 comments on commit 8ba0148

Please sign in to comment.