Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/DefaultWebRequestCurl.cpp

Issue 29377775: Issue 4916 - Request compression in CURL WebRequest. (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Updated patch to fix test. Created March 2, 2017, 3:36 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/WebRequest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 CURL *curl = curl_easy_init(); 132 CURL *curl = curl_easy_init();
133 if (curl) 133 if (curl)
134 { 134 {
135 std::stringstream responseText; 135 std::stringstream responseText;
136 HeaderData headerData; 136 HeaderData headerData;
137 curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); 137 curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
138 curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); 138 curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
139 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, ReceiveData); 139 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, ReceiveData);
140 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &responseText); 140 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &responseText);
141 // Request compressed data. Using any supported aglorithm
142 curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "");
141 curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, ReceiveHeader); 143 curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, ReceiveHeader);
142 curl_easy_setopt(curl, CURLOPT_HEADERDATA, &headerData); 144 curl_easy_setopt(curl, CURLOPT_HEADERDATA, &headerData);
143 145
144 struct curl_slist* headerList = 0; 146 struct curl_slist* headerList = 0;
145 for (HeaderList::const_iterator it = requestHeaders.begin(); 147 for (HeaderList::const_iterator it = requestHeaders.begin();
146 it != requestHeaders.end(); ++it) 148 it != requestHeaders.end(); ++it)
147 { 149 {
148 headerList = curl_slist_append(headerList, (it->first + ": " + it->second) .c_str()); 150 headerList = curl_slist_append(headerList, (it->first + ": " + it->second) .c_str());
149 } 151 }
150 if (headerList) 152 if (headerList)
(...skipping 30 matching lines...) Expand all
181 } 183 }
182 } 184 }
183 } 185 }
184 186
185 if (headerList) 187 if (headerList)
186 curl_slist_free_all(headerList); 188 curl_slist_free_all(headerList);
187 curl_easy_cleanup(curl); 189 curl_easy_cleanup(curl);
188 } 190 }
189 return result; 191 return result;
190 } 192 }
OLDNEW
« no previous file with comments | « no previous file | test/WebRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld