--- a/qtbase/src/network/access/qhttpprotocolhandler.cpp	2014-09-11 04:52:03.000000000 -0600
+++ b/qtbase/src/network/access/qhttpprotocolhandler.cpp	2014-10-03 14:22:15.000000000 -0600
@@ -253,6 +253,10 @@
 
 bool QHttpProtocolHandler::sendRequest()
 {
+    // only feed the QTcpSocket buffer when there is less than 32 kB in it
+    const qint64 socketBufferFill = 32*1024;
+    const qint64 socketWriteMaxSize = 16*1024;
+
     m_reply = m_channel->reply;
 
     if (!m_reply) {
@@ -317,22 +321,27 @@
 #else
         QByteArray header = QHttpNetworkRequestPrivate::header(m_channel->request, false);
 #endif
-        m_socket->write(header);
-        // flushing is dangerous (QSslSocket calls transmit which might read or error)
-//        m_socket->flush();
         QNonContiguousByteDevice* uploadByteDevice = m_channel->request.uploadByteDevice();
         if (uploadByteDevice) {
-            // connect the signals so this function gets called again
-            QObject::connect(uploadByteDevice, SIGNAL(readyRead()), m_channel, SLOT(_q_uploadDataReadyRead()));
+            QByteArray *array = uploadByteDevice->array();
+            if (array && (header.size() + array->size()) < socketWriteMaxSize) {
+                m_socket->write(header + *array);
+                uploadByteDevice->advanceReadPointer(array->size());
+                m_channel->state = QHttpNetworkConnectionChannel::WaitingState; // now wait for response
+            } else {
+                // connect the signals so this function gets called again
+                QObject::connect(uploadByteDevice, SIGNAL(readyRead()), m_channel, SLOT(_q_uploadDataReadyRead()));
 
-            m_channel->bytesTotal = m_channel->request.contentLength();
+                m_channel->bytesTotal = m_channel->request.contentLength();
 
-            m_channel->state = QHttpNetworkConnectionChannel::WritingState; // start writing data
-            sendRequest(); //recurse
+                m_socket->write(header);
+                m_channel->state = QHttpNetworkConnectionChannel::WritingState; // start writing data
+            }
         } else {
+            m_socket->write(header);
             m_channel->state = QHttpNetworkConnectionChannel::WaitingState; // now wait for response
-            sendRequest(); //recurse
         }
+        sendRequest(); //recurse
 
         break;
     }
@@ -348,11 +357,6 @@
             break;
         }
 
-        // only feed the QTcpSocket buffer when there is less than 32 kB in it
-        const qint64 socketBufferFill = 32*1024;
-        const qint64 socketWriteMaxSize = 16*1024;
-
-
 #ifndef QT_NO_SSL
         QSslSocket *sslSocket = qobject_cast<QSslSocket*>(m_socket);
         // if it is really an ssl socket, check more than just bytesToWrite()
--- a/qtbase/src/corelib/io/qnoncontiguousbytedevice_p.h	2014-09-11 04:52:09.000000000 -0600
+++ b/qtbase/src/corelib/io/qnoncontiguousbytedevice_p.h	2014-10-06 11:47:05.000000000 -0600
@@ -70,6 +70,7 @@
     virtual bool advanceReadPointer(qint64 amount) = 0;
     virtual bool atEnd() = 0;
     virtual bool reset() = 0;
+    virtual QByteArray *array() { return NULL; }
     void disableReset();
     bool isResetDisabled() { return resetDisabled; }
     virtual qint64 size() = 0;
@@ -107,6 +108,7 @@
     bool advanceReadPointer(qint64 amount);
     bool atEnd();
     bool reset();
+    virtual QByteArray *array() { return byteArray; }
     qint64 size();
 protected:
     QByteArray* byteArray;
@@ -161,6 +163,7 @@
     bool advanceReadPointer(qint64 amount);
     bool atEnd();
     bool reset();
+    virtual QByteArray *array() { return &byteArray; }
     qint64 size();
 protected:
     QBuffer* buffer;
--- a/qtbase/src/network/access/qnetworkreplyhttpimpl.cpp	2014-09-11 04:52:04.000000000 -0600
+++ b/qtbase/src/network/access/qnetworkreplyhttpimpl.cpp	2014-10-06 11:52:38.000000000 -0600
@@ -856,33 +856,37 @@
         QObject::connect(q, SIGNAL(readBufferFreed(qint64)), delegate, SLOT(readBufferFreed(qint64)));
 
         if (uploadByteDevice) {
-            QNonContiguousByteDeviceThreadForwardImpl *forwardUploadDevice =
-                    new QNonContiguousByteDeviceThreadForwardImpl(uploadByteDevice->atEnd(), uploadByteDevice->size());
-            if (uploadByteDevice->isResetDisabled())
-                forwardUploadDevice->disableReset();
-            forwardUploadDevice->setParent(delegate); // needed to make sure it is moved on moveToThread()
-            delegate->httpRequest.setUploadByteDevice(forwardUploadDevice);
+            if (QByteArray *array = uploadByteDevice->array()) {
+                delegate->httpRequest.setUploadByteDevice(QNonContiguousByteDeviceFactory::create(array));
+            } else {
+                QNonContiguousByteDeviceThreadForwardImpl *forwardUploadDevice =
+                        new QNonContiguousByteDeviceThreadForwardImpl(uploadByteDevice->atEnd(), uploadByteDevice->size());
+                if (uploadByteDevice->isResetDisabled())
+                    forwardUploadDevice->disableReset();
+                forwardUploadDevice->setParent(delegate); // needed to make sure it is moved on moveToThread()
+                delegate->httpRequest.setUploadByteDevice(forwardUploadDevice);
 
-            // If the device in the user thread claims it has more data, keep the flow to HTTP thread going
-            QObject::connect(uploadByteDevice.data(), SIGNAL(readyRead()),
-                             q, SLOT(uploadByteDeviceReadyReadSlot()),
-                             Qt::QueuedConnection);
+                // If the device in the user thread claims it has more data, keep the flow to HTTP thread going
+                QObject::connect(uploadByteDevice.data(), SIGNAL(readyRead()),
+                                 q, SLOT(uploadByteDeviceReadyReadSlot()),
+                                 Qt::QueuedConnection);
 
-            // From main thread to user thread:
-            QObject::connect(q, SIGNAL(haveUploadData(QByteArray,bool,qint64)),
-                             forwardUploadDevice, SLOT(haveDataSlot(QByteArray,bool,qint64)), Qt::QueuedConnection);
-            QObject::connect(uploadByteDevice.data(), SIGNAL(readyRead()),
-                             forwardUploadDevice, SIGNAL(readyRead()),
-                             Qt::QueuedConnection);
+                // From main thread to user thread:
+                QObject::connect(q, SIGNAL(haveUploadData(QByteArray,bool,qint64)),
+                                 forwardUploadDevice, SLOT(haveDataSlot(QByteArray,bool,qint64)), Qt::QueuedConnection);
+                QObject::connect(uploadByteDevice.data(), SIGNAL(readyRead()),
+                                 forwardUploadDevice, SIGNAL(readyRead()),
+                                 Qt::QueuedConnection);
 
-            // From http thread to user thread:
-            QObject::connect(forwardUploadDevice, SIGNAL(wantData(qint64)),
-                             q, SLOT(wantUploadDataSlot(qint64)));
-            QObject::connect(forwardUploadDevice, SIGNAL(processedData(qint64)),
-                             q, SLOT(sentUploadDataSlot(qint64)));
-            QObject::connect(forwardUploadDevice, SIGNAL(resetData(bool*)),
-                    q, SLOT(resetUploadDataSlot(bool*)),
-                    Qt::BlockingQueuedConnection); // this is the only one with BlockingQueued!
+                // From http thread to user thread:
+                QObject::connect(forwardUploadDevice, SIGNAL(wantData(qint64)),
+                                 q, SLOT(wantUploadDataSlot(qint64)));
+                QObject::connect(forwardUploadDevice, SIGNAL(processedData(qint64)),
+                                 q, SLOT(sentUploadDataSlot(qint64)));
+                QObject::connect(forwardUploadDevice, SIGNAL(resetData(bool*)),
+                                 q, SLOT(resetUploadDataSlot(bool*)),
+                                 Qt::BlockingQueuedConnection); // this is the only one with BlockingQueued!
+            }
         }
     } else if (synchronous) {
         QObject::connect(q, SIGNAL(startHttpRequestSynchronously()), delegate, SLOT(startRequestSynchronously()), Qt::BlockingQueuedConnection);
