Left: | ||
Right: |
OLD | NEW |
---|---|
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 Loading... | |
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, ""); | |
Felix Dahlke
2017/03/02 14:33:38
Won't it be possible to overwrite this by supplyin
hub
2017/03/02 15:36:00
It is my understanding that passing "" will set th
Felix Dahlke
2017/03/02 15:39:47
Fair enough.
| |
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 Loading... | |
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 } |
OLD | NEW |