Fix for issue 304: symupload needs to support timeout specifications(wininet can timeout when sending large symbol files).

R=doshimun
W=nealsid



git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@319 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
nealsid
2009-03-20 19:02:12 +00:00
parent 2ad976ef0b
commit 3366749ee7
4 changed files with 49 additions and 8 deletions

View File

@@ -66,12 +66,13 @@ bool HTTPUpload::SendRequest(const wstring &url,
const map<wstring, wstring> &parameters,
const wstring &upload_file,
const wstring &file_part_name,
int *timeout,
wstring *response_body,
int *response_code) {
if (response_code) {
*response_code = 0;
}
// TODO(bryner): support non-ASCII parameter names
if (!CheckParameters(parameters)) {
return false;
@@ -146,6 +147,22 @@ bool HTTPUpload::SendRequest(const wstring &url,
return false;
}
if (timeout) {
if (!InternetSetOption(request.get(),
INTERNET_OPTION_SEND_TIMEOUT,
timeout,
sizeof(timeout))) {
fwprintf(stderr, L"Could not unset send timeout, continuing...\n");
}
if (!InternetSetOption(request.get(),
INTERNET_OPTION_RECEIVE_TIMEOUT,
timeout,
sizeof(timeout))) {
fwprintf(stderr, L"Could not unset receive timeout, continuing...\n");
}
}
if (!HttpSendRequest(request.get(), NULL, 0,
const_cast<char *>(request_body.data()),
static_cast<DWORD>(request_body.size()))) {

View File

@@ -69,6 +69,7 @@ class HTTPUpload {
const map<wstring, wstring> &parameters,
const wstring &upload_file,
const wstring &file_part_name,
int *timeout,
wstring *response_body,
int *response_code);