diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2015-01-05 14:00:20 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-01-09 11:16:54 +0100 |
commit | 7bd3d4591a126cd99f797f1a9f83c966547e29e1 (patch) | |
tree | a902941f97c242843a375997ab02963f1a2c521a /src/corelib/io | |
parent | de61130bd48e2a028fea9bd408703805e41fb05b (diff) |
Fix authenticated POST/PUT http requests with buffering disabled
If reset is disabled then POST and PUT requests can not be authenticated
as the upload device can not be reset. There shouldn't be any reason
that shouldn't be allowed if the QIODevice given supports resetting.
The disableReset feature of QNonContiguousByteDevice is removed as it
is not used anywhere else, and is redundant when reset can indicate
success or failure.
Task-number: QTBUG-43628
Change-Id: If941a98fd3f797872351c10bdca6aa6745dbefea
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qnoncontiguousbytedevice.cpp | 29 | ||||
-rw-r--r-- | src/corelib/io/qnoncontiguousbytedevice_p.h | 3 |
2 files changed, 2 insertions, 30 deletions
diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp index 11510a8397..1c10ef9f83 100644 --- a/src/corelib/io/qnoncontiguousbytedevice.cpp +++ b/src/corelib/io/qnoncontiguousbytedevice.cpp @@ -94,17 +94,7 @@ QT_BEGIN_NAMESPACE Moves the internal read pointer back to the beginning. Returns \c false if this was not possible. - \sa atEnd(), disableReset() - - \internal -*/ -/*! - \fn void QNonContiguousByteDevice::disableReset() - - Disable the reset() call, e.g. it will always - do nothing and return false. - - \sa reset() + \sa atEnd() \internal */ @@ -131,7 +121,7 @@ QT_BEGIN_NAMESPACE \internal */ -QNonContiguousByteDevice::QNonContiguousByteDevice() : QObject((QObject*)0), resetDisabled(false) +QNonContiguousByteDevice::QNonContiguousByteDevice() : QObject((QObject*)0) { } @@ -139,11 +129,6 @@ QNonContiguousByteDevice::~QNonContiguousByteDevice() { } -void QNonContiguousByteDevice::disableReset() -{ - resetDisabled = true; -} - // FIXME we should scrap this whole implementation and instead change the ByteArrayImpl to be able to cope with sub-arrays? QNonContiguousByteDeviceBufferImpl::QNonContiguousByteDeviceBufferImpl(QBuffer *b) : QNonContiguousByteDevice() { @@ -176,8 +161,6 @@ bool QNonContiguousByteDeviceBufferImpl::atEnd() bool QNonContiguousByteDeviceBufferImpl::reset() { - if (resetDisabled) - return false; return arrayImpl->reset(); } @@ -224,9 +207,6 @@ bool QNonContiguousByteDeviceByteArrayImpl::atEnd() bool QNonContiguousByteDeviceByteArrayImpl::reset() { - if (resetDisabled) - return false; - currentPosition = 0; return true; } @@ -275,9 +255,6 @@ bool QNonContiguousByteDeviceRingBufferImpl::atEnd() bool QNonContiguousByteDeviceRingBufferImpl::reset() { - if (resetDisabled) - return false; - currentPosition = 0; return true; } @@ -378,8 +355,6 @@ bool QNonContiguousByteDeviceIoDeviceImpl::atEnd() bool QNonContiguousByteDeviceIoDeviceImpl::reset() { - if (resetDisabled) - return false; bool reset = (initialPosition == 0) ? device->reset() : device->seek(initialPosition); if (reset) { eof = false; // assume eof is false, it will be true after a read has been attempted diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h index 1be28ff4b3..d36422e82c 100644 --- a/src/corelib/io/qnoncontiguousbytedevice_p.h +++ b/src/corelib/io/qnoncontiguousbytedevice_p.h @@ -62,8 +62,6 @@ public: virtual bool advanceReadPointer(qint64 amount) = 0; virtual bool atEnd() = 0; virtual bool reset() = 0; - void disableReset(); - bool isResetDisabled() { return resetDisabled; } virtual qint64 size() = 0; virtual ~QNonContiguousByteDevice(); @@ -72,7 +70,6 @@ protected: QNonContiguousByteDevice(); - bool resetDisabled; Q_SIGNALS: void readyRead(); void readProgress(qint64 current, qint64 total); |