Index: src/DefaultWebRequestWinInet.cpp |
=================================================================== |
--- a/src/DefaultWebRequestWinInet.cpp |
+++ b/src/DefaultWebRequestWinInet.cpp |
@@ -172,10 +172,13 @@ |
// Get the response status code |
std::wstring statusStr; |
DWORD statusLen = 0; |
- res = WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_STATUS_CODE, WINHTTP_HEADER_NAME_BY_INDEX, &statusStr[0], &statusLen, WINHTTP_NO_HEADER_INDEX); |
+ res = WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_STATUS_CODE, WINHTTP_HEADER_NAME_BY_INDEX, WINHTTP_NO_OUTPUT_BUFFER , &statusLen, WINHTTP_NO_HEADER_INDEX); |
Wladimir Palant
2014/11/01 22:30:25
Nit: no whitespace before comma please.
Either wa
Felix Dahlke
2014/11/02 03:55:20
Missed the white space, agreed. As for this change
sergei
2014/11/03 12:58:19
reverted
|
if (statusLen == 0) |
{ |
- throw std::exception("Can't parse the status code"); |
+ if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) |
+ { |
+ throw std::exception("Can't parse the status code"); |
+ } |
} |
statusStr.resize(statusLen / sizeof(std::wstring::value_type) + 1); |
res = WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_STATUS_CODE, WINHTTP_HEADER_NAME_BY_INDEX, &statusStr[0], &statusLen, WINHTTP_NO_HEADER_INDEX); |