sym_upload: Show failure if symbol server gives redirect response

Add a "response_code" parameter to Linux's HTTPUpload::SendRequest() that,
if non-NULL, will be set to the response code of the HTTP request.  Using
that, sym_upload will print a failure message on Linux if the response code
is not 200.  This is in line with the change made by
http://breakpad.appspot.com/77001/ for the Mac version.

BUG=google-breakpad:480, chromium-os:30032
TEST=Ran "sym_upload powertop.sym http://test.webdav.org/redir-tmp/"
     Ran "sym_upload powertop.sym http://clients2.google.com/cr/staging_symbol"
Review URL: https://breakpad.appspot.com/388002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@968 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mkrebs@chromium.org 2012-05-24 20:22:48 +00:00
parent 4191cae361
commit d6b6959e0e
4 changed files with 24 additions and 3 deletions

View file

@ -62,7 +62,11 @@ bool HTTPUpload::SendRequest(const string &url,
const string &proxy_user_pwd,
const string &ca_certificate_file,
string *response_body,
long *response_code,
string *error_description) {
if (response_code != NULL)
*response_code = 0;
if (!CheckParameters(parameters))
return false;
@ -149,6 +153,11 @@ bool HTTPUpload::SendRequest(const string &url,
CURLcode (*curl_easy_perform)(CURL *);
*(void**) (&curl_easy_perform) = dlsym(curl_lib, "curl_easy_perform");
err_code = (*curl_easy_perform)(curl);
if (response_code != NULL) {
CURLcode (*curl_easy_getinfo)(CURL *, CURLINFO, ...);
*(void**) (&curl_easy_getinfo) = dlsym(curl_lib, "curl_easy_getinfo");
(*curl_easy_getinfo)(curl, CURLINFO_RESPONSE_CODE, response_code);
}
const char* (*curl_easy_strerror)(CURLcode);
*(void**) (&curl_easy_strerror) = dlsym(curl_lib, "curl_easy_strerror");
#ifndef NDEBUG