[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r3871: Set the QHttp connection mode based on the scheme, and suppl (vidalia/branches/breakpad/src/crashreporter)



Author: edmanm
Date: 2009-06-18 02:31:24 -0400 (Thu, 18 Jun 2009)
New Revision: 3871

Modified:
   vidalia/branches/breakpad/src/crashreporter/CrashReportUploader.cpp
Log:

Set the QHttp connection mode based on the scheme, and supply reasonable
default port values. Also, looks like I missed a \r\n when formatting the
minidump portion of the POST request.


Modified: vidalia/branches/breakpad/src/crashreporter/CrashReportUploader.cpp
===================================================================
--- vidalia/branches/breakpad/src/crashreporter/CrashReportUploader.cpp	2009-06-17 18:11:27 UTC (rev 3870)
+++ vidalia/branches/breakpad/src/crashreporter/CrashReportUploader.cpp	2009-06-18 06:31:24 UTC (rev 3871)
@@ -56,6 +56,16 @@
 {
   QByteArray body;
 
+  /* Set the destination host. If it looks like the destination URL uses SSL,
+   * then we need to tell the QHttp object to use it as well. */
+  if (! serverUrl.scheme().compare("https", Qt::CaseInsensitive)) {
+    _http->setHost(serverUrl.host(), QHttp::ConnectionModeHttps,
+                   serverUrl.port(443));
+  } else {
+    _http->setHost(serverUrl.host(), QHttp::ConnectionModeHttp,
+                   serverUrl.port(80));
+  }
+
   /* Set up the request header */
   QHttpRequestHeader header("POST", serverUrl.path());
   QString boundary = generateBoundaryMarker();
@@ -79,13 +89,12 @@
   body.append(QString("--%1\r\n").arg(boundary));
   body.append("Content-Disposition: form-data; ");
   body.append("name=\"upload_file_minidump\"; ");
-  body.append(QString("filename=\"%1\"").arg(minidumpId));
+  body.append(QString("filename=\"%1\"\r\n").arg(minidumpId));
   body.append("Content-Type: application/octet-stream\r\n\r\n");
   body.append(minidump);
   body.append(QString("\r\n--%1\r\n").arg(boundary));
 
   /* Initiate the request and return the request ID */
-  _http->setHost(serverUrl.host(), serverUrl.port());
   _requestId = _http->request(header, body);
 }