Left: | ||
Right: |
OLD | NEW |
---|---|
1 #include "AdblockPlus/DefaultWebRequest.h" | 1 #include "AdblockPlus/DefaultWebRequest.h" |
2 #include "WinInetErrorCodes.h" | 2 #include "WinInetErrorCodes.h" |
3 #include <algorithm> | 3 #include <algorithm> |
4 #include <Windows.h> | 4 #include <Windows.h> |
5 #include <winhttp.h> | 5 #include <winhttp.h> |
6 #include <Shlwapi.h> | 6 #include <Shlwapi.h> |
7 | 7 |
8 #include "Utils.h" | 8 #include "Utils.h" |
9 | 9 |
10 class WinHttpHandle | 10 class WinHttpHandle |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 { | 174 { |
175 AdblockPlus::ServerResponse result; | 175 AdblockPlus::ServerResponse result; |
176 result.status = NS_ERROR_FAILURE; | 176 result.status = NS_ERROR_FAILURE; |
177 result.responseStatus = 0; | 177 result.responseStatus = 0; |
178 | 178 |
179 HRESULT hr; | 179 HRESULT hr; |
180 BOOL res; | 180 BOOL res; |
181 | 181 |
182 std::wstring canonizedUrl = Utils::CanonizeUrl(Utils::ToUTF16String(url, url.l ength())); | 182 std::wstring canonizedUrl = Utils::CanonizeUrl(Utils::ToUTF16String(url, url.l ength())); |
183 | 183 |
184 std::string headersString; | 184 std::string headersString = ""; |
Oleksandr
2013/04/30 08:13:07
This fixes an issue on XP. std::string's length is
Felix Dahlke
2013/04/30 09:14:52
Worth a comment I think. Or is this not the only p
| |
185 for (int i = 0; i < requestHeaders.size(); i++) | 185 for (int i = 0; i < requestHeaders.size(); i++) |
186 { | 186 { |
187 headersString += requestHeaders[i].first + ": "; | 187 headersString += requestHeaders[i].first + ": "; |
188 headersString += requestHeaders[i].second + ";"; | 188 headersString += requestHeaders[i].second + ";"; |
189 } | 189 } |
190 std::wstring headers = Utils::ToUTF16String(headersString, headersString.lengt h()); | 190 std::wstring headers = Utils::ToUTF16String(headersString, headersString.lengt h()); |
191 | 191 |
192 LPSTR outBuffer; | 192 LPSTR outBuffer; |
193 DWORD downloadSize, downloaded; | 193 DWORD downloadSize, downloaded; |
194 WinHttpHandle hSession(0), hConnect(0), hRequest(0); | 194 WinHttpHandle hSession(0), hConnect(0), hRequest(0); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 if( WinHttpReadData(hRequest, (LPVOID)outBuffer, downloadSize, &downloaded )) | 312 if( WinHttpReadData(hRequest, (LPVOID)outBuffer, downloadSize, &downloaded )) |
313 { | 313 { |
314 result.responseText.append(outBuffer, downloaded); | 314 result.responseText.append(outBuffer, downloaded); |
315 } | 315 } |
316 // Free the memory allocated to the buffer. | 316 // Free the memory allocated to the buffer. |
317 delete[] outBuffer; | 317 delete[] outBuffer; |
318 } | 318 } |
319 } while (downloadSize > 0); | 319 } while (downloadSize > 0); |
320 return result; | 320 return result; |
321 } | 321 } |
OLD | NEW |