mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-12-23 16:25:37 +00:00
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:
parent
2ad976ef0b
commit
3366749ee7
|
@ -69,7 +69,7 @@ ReportResult CrashReportSender::SendCrashReport(
|
|||
|
||||
int http_response = 0;
|
||||
bool result = HTTPUpload::SendRequest(
|
||||
url, parameters, dump_file_name, L"upload_file_minidump", report_code,
|
||||
url, parameters, dump_file_name, L"upload_file_minidump", NULL, report_code,
|
||||
&http_response);
|
||||
|
||||
if (result) {
|
||||
|
|
|
@ -66,6 +66,7 @@ bool HTTPUpload::SendRequest(const wstring &url,
|
|||
const map<wstring, wstring> ¶meters,
|
||||
const wstring &upload_file,
|
||||
const wstring &file_part_name,
|
||||
int *timeout,
|
||||
wstring *response_body,
|
||||
int *response_code) {
|
||||
if (response_code) {
|
||||
|
@ -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()))) {
|
||||
|
|
|
@ -69,6 +69,7 @@ class HTTPUpload {
|
|||
const map<wstring, wstring> ¶meters,
|
||||
const wstring &upload_file,
|
||||
const wstring &file_part_name,
|
||||
int *timeout,
|
||||
wstring *response_body,
|
||||
int *response_code);
|
||||
|
||||
|
|
|
@ -131,12 +131,13 @@ static bool DumpSymbolsToTempFile(const wchar_t *file,
|
|||
|
||||
FILE *temp_file = NULL;
|
||||
#if _MSC_VER >= 1400 // MSVC 2005/8
|
||||
if (_wfopen_s(&temp_file, temp_filename, L"w") != 0) {
|
||||
if (_wfopen_s(&temp_file, temp_filename, L"w") != 0)
|
||||
#else // _MSC_VER >= 1400
|
||||
// _wfopen_s was introduced in MSVC8. Use _wfopen for earlier environments.
|
||||
// Don't use it with MSVC8 and later, because it's deprecated.
|
||||
if (!(temp_file = _wfopen(temp_filename, L"w"))) {
|
||||
if (!(temp_file = _wfopen(temp_filename, L"w")))
|
||||
#endif // _MSC_VER >= 1400
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -152,12 +153,33 @@ static bool DumpSymbolsToTempFile(const wchar_t *file,
|
|||
return writer.GetModuleInfo(pdb_info);
|
||||
}
|
||||
|
||||
void printUsageAndExit() {
|
||||
wprintf(L"Usage: symupload [--timeout NN] <file.exe|file.dll> <symbol upload URL>\n\n");
|
||||
wprintf(L"Timeout is in milliseconds, or can be 0 to be unlimited\n\n");
|
||||
wprintf(L"Example:\n\n\tsymupload.exe --timeout 0 chrome.dll http://no.free.symbol.server.for.you\n");
|
||||
exit(0);
|
||||
}
|
||||
int wmain(int argc, wchar_t *argv[]) {
|
||||
if (argc < 3) {
|
||||
wprintf(L"Usage: %s <file.exe|file.dll> <symbol upload URL>\n", argv[0]);
|
||||
return 0;
|
||||
if ((argc != 3) &&
|
||||
(argc != 5)) {
|
||||
printUsageAndExit();
|
||||
}
|
||||
|
||||
const wchar_t *module, *url;
|
||||
int timeout = -1;
|
||||
if (argc == 3) {
|
||||
module = argv[1];
|
||||
url = argv[2];
|
||||
} else {
|
||||
// check for timeout flag
|
||||
if (!wcscmp(L"--timeout", argv[1])) {
|
||||
timeout = _wtoi(argv[2]);
|
||||
module = argv[3];
|
||||
url = argv[4];
|
||||
} else {
|
||||
printUsageAndExit();
|
||||
}
|
||||
}
|
||||
const wchar_t *module = argv[1], *url = argv[2];
|
||||
|
||||
wstring symbol_file;
|
||||
PDBModuleInfo pdb_info;
|
||||
|
@ -186,6 +208,7 @@ int wmain(int argc, wchar_t *argv[]) {
|
|||
|
||||
bool success = HTTPUpload::SendRequest(url, parameters,
|
||||
symbol_file, L"symbol_file",
|
||||
timeout == -1 ? NULL : &timeout,
|
||||
NULL, NULL);
|
||||
_wunlink(symbol_file.c_str());
|
||||
|
||||
|
|
Loading…
Reference in a new issue