diff --git a/src/kits/network/libnetapi/HttpRequest.cpp b/src/kits/network/libnetapi/HttpRequest.cpp index 0b3b242d0b..3f2f64d7b0 100644 --- a/src/kits/network/libnetapi/HttpRequest.cpp +++ b/src/kits/network/libnetapi/HttpRequest.cpp @@ -98,7 +98,7 @@ BHttpRequest::BHttpRequest(const BHttpRequest& other) fOptHeaders(NULL), fOptPostFields(NULL), fOptInputData(NULL), - fOptInputDataSize(0), + fOptInputDataSize(-1), fOptRangeStart(other.fOptRangeStart), fOptRangeEnd(other.fOptRangeEnd), fOptFollowLocation(other.fOptFollowLocation) @@ -1000,6 +1000,12 @@ BHttpRequest::_SendPostData() } else if ((fRequestMethod == B_HTTP_POST || fRequestMethod == B_HTTP_PUT) && fOptInputData != NULL) { + // If the input data is seekable, we rewind it for each new request. + BPositionIO* seekableData + = dynamic_cast(fOptInputData); + if (seekableData) + seekableData->Seek(0, SEEK_SET); + for (;;) { char outputTempBuffer[kHttpBufferSize]; ssize_t read = fOptInputData->Read(outputTempBuffer,