aboutsummaryrefslogtreecommitdiff
path: root/src/common/windows/http_upload.h
diff options
context:
space:
mode:
authorincrementalist <incrementalist@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-12-08 20:45:20 +0000
committerincrementalist <incrementalist@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-12-08 20:45:20 +0000
commitdd7c38baae8c9a08d3568217d3cad6309add576d (patch)
treee089a477c4cefbbc5a670da3e4ca97b4afca6353 /src/common/windows/http_upload.h
parentProvide a mechanism for SymbolSuppliers to interrupt processing (#93) (diff)
downloadbreakpad-dd7c38baae8c9a08d3568217d3cad6309add576d.tar.xz
This patch fixes Airbag issue #44.
Summary of this patch: * It adds a new wstring* parameter to the end of both SendCrashReport() and HTTPUpload::SendRequest(), which can be NULL. * If the request isn't successful, the result parameter isn't touched. * It adds HTTPUpload::UTF8ToWide() to allow the response to be returned as a wstring, * It changes the return value of SendRequest (and by extension, SendCrashReport) so that if the size of the response body isn't exactly the same as the value given in the Content-Length header, the return value is false (in addition to the previous semantics). * It also updates symupload.cc to account for the new parameter in SendRequest(). git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@81 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/windows/http_upload.h')
-rw-r--r--src/common/windows/http_upload.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/common/windows/http_upload.h b/src/common/windows/http_upload.h
index 4d86eded..a23a0f2b 100644
--- a/src/common/windows/http_upload.h
+++ b/src/common/windows/http_upload.h
@@ -38,6 +38,9 @@
// Disable exception handler warnings.
#pragma warning( disable : 4530 )
+#include <Windows.h>
+#include <WinInet.h>
+
#include <map>
#include <string>
#include <vector>
@@ -58,15 +61,23 @@ class HTTPUpload {
// Parameter names must contain only printable ASCII characters,
// and may not contain a quote (") character.
// Only HTTP(S) URLs are currently supported. Returns true on success.
- // TODO(bryner): we should expose the response to the caller.
+ // If the request is successful and response_body is non-NULL,
+ // the response body will be returned in response_body.
static bool SendRequest(const wstring &url,
const map<wstring, wstring> &parameters,
const wstring &upload_file,
- const wstring &file_part_name);
+ const wstring &file_part_name,
+ wstring *response_body);
private:
class AutoInternetHandle;
+ // Retrieves the HTTP response. If NULL is passed in for response,
+ // this merely checks (via the return value) that we were successfully
+ // able to retrieve exactly as many bytes of content in the response as
+ // were specified in the Content-Length header.
+ static bool HTTPUpload::ReadResponse(HINTERNET request, wstring* response);
+
// Generates a new multipart boundary for a POST request
static wstring GenerateMultipartBoundary();
@@ -85,6 +96,9 @@ class HTTPUpload {
// Fills the supplied vector with the contents of filename.
static void GetFileContents(const wstring &filename, vector<char> *contents);
+ // Converts a UTF8 string to UTF16.
+ static wstring UTF8ToWide(const string &utf8);
+
// Converts a UTF16 string to UTF8.
static string WideToUTF8(const wstring &wide);