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

Side by Side Diff: src/DefaultWebRequestWinInet.cpp

Issue 11588009: Support of gzip, deflate added to WinInet web request implementation (Closed)
Patch Set: Created Sept. 3, 2013, 11:44 a.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 | no next file » | 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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 flags = WINHTTP_FLAG_SECURE; 276 flags = WINHTTP_FLAG_SECURE;
277 } 277 }
278 hRequest.handle = WinHttpOpenRequest(hConnect, L"GET", urlComponents.lpszUrlPa th, 0, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, flags); 278 hRequest.handle = WinHttpOpenRequest(hConnect, L"GET", urlComponents.lpszUrlPa th, 0, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, flags);
279 279
280 // Send a request. 280 // Send a request.
281 if (!hRequest) 281 if (!hRequest)
282 { 282 {
283 result.status = WindowsErrorToGeckoError(GetLastError()); 283 result.status = WindowsErrorToGeckoError(GetLastError());
284 return result; 284 return result;
285 } 285 }
286 // TODO: Make sure for HTTP 1.1 "Accept-Encoding: gzip, deflate" doesn't HAVE to be set here 286 HTTP_VERSION_INFO ver;
287 DWORD l = sizeof(ver);
288 WinHttpQueryOption(NULL, WINHTTP_OPTION_HTTP_VERSION, (void*)&ver, &l);
Wladimir Palant 2013/09/04 07:21:25 Nit: explicit conversion to void* is unnecessary I
289 if (ver.dwMinorVersion == 1)
Oleksandr 2013/09/03 11:49:41 No compression for IE6 (HTTP 1.0)
Wladimir Palant 2013/09/04 07:21:25 I don't like hardcoding the expectation here that
290 {
291 headers += L"Accept-Encoding: gzip, deflate\r\n";
292 }
287 if (headers.length() > 0) 293 if (headers.length() > 0)
288 { 294 {
289 res = ::WinHttpSendRequest(hRequest, headers.c_str(), headers.length(), WINH TTP_NO_REQUEST_DATA, 0, 0, 0); 295 res = ::WinHttpSendRequest(hRequest, headers.c_str(), headers.length(), WINH TTP_NO_REQUEST_DATA, 0, 0, 0);
290 } 296 }
291 else 297 else
292 { 298 {
293 res = ::WinHttpSendRequest(hRequest, 0, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0) ; 299 res = ::WinHttpSendRequest(hRequest, 0, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0) ;
294 } 300 }
295 301
296 // End the request. 302 // End the request.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 ZeroMemory(outBuffer.get(), downloadSize+1); 343 ZeroMemory(outBuffer.get(), downloadSize+1);
338 344
339 if (WinHttpReadData(hRequest, outBuffer.get(), downloadSize, &downloaded)) 345 if (WinHttpReadData(hRequest, outBuffer.get(), downloadSize, &downloaded))
340 { 346 {
341 result.responseText.append(outBuffer.get(), downloaded); 347 result.responseText.append(outBuffer.get(), downloaded);
342 } 348 }
343 } 349 }
344 } while (downloadSize > 0); 350 } while (downloadSize > 0);
345 return result; 351 return result;
346 } 352 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld