This repository was archived by the owner on Nov 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 230
This repository was archived by the owner on Nov 1, 2021. It is now read-only.
Unable to upload files more than 65536 bytes #91
Copy link
Copy link
Open
Description
Hello,
We've started discussion here #85, but there was no answer so I decided to open an issue.
There is a function:
(void)didReadWindowUpdateFrame:(SPDYWindowUpdateFrame )windowUpdateFrame frameDecoder:(SPDYFrameDecoder *)frameDecoder
{
/*
SPDY WINDOW_UPDATE frame processing requirements: *
Receivers of a WINDOW_UPDATE that cause the window size to exceed 2^31
must send a RST_STREAM with the status code FLOW_CONTROL_ERROR. *
Sender should ignore all WINDOW_UPDATE frames associated with a stream
after sending the last frame for the stream. */
SPDYStreamId streamId = windowUpdateFrame.streamId;
SPDY_DEBUG(@"received WINDOW_UPDATE.%u (+%lu)", streamId, (unsigned long)windowUpdateFrame.deltaWindowSize);
if (streamId == kSPDYSessionStreamId) {
// Check for numerical overflow
if (_sessionSendWindowSize > INT32_MAX - windowUpdateFrame.deltaWindowSize) {
[self _closeWithStatus:SPDY_SESSION_PROTOCOL_ERROR];
return;
}
_sessionSendWindowSize += windowUpdateFrame.deltaWindowSize;
for (SPDYStream *stream in _activeStreams) {
[self _sendData:stream];
if (_sessionSendWindowSize == 0) break;
}
return;
}
// Ignore frames for non-existent or half-closed streams
SPDYStream *stream = _activeStreams[streamId];
if (!stream || stream.localSideClosed) {
return;
}
// Check for numerical overflow
if (stream.sendWindowSize > INT32_MAX - windowUpdateFrame.deltaWindowSize) {
[self _sendRstStream:SPDY_STREAM_FLOW_CONTROL_ERROR streamId:streamId];
return;
}
stream.sendWindowSize += windowUpdateFrame.deltaWindowSize;
[self _sendData:stream];
}
if streamId is eqal to kSPDYSessionStreamId then _sessionSendWindowSize should be increased, but if not, stream.sendWindowSize should be increased instead. So only one sendWindowSize will be increased, not the both.
In _sendData:(SPDYStream *)stream function both of sendWindowSize were decreased at the same time:
_sessionSendWindowSize -= bytesSent;
stream.sendWindowSize -= bytesSent;
and in case of bytesSent equals 65536 bytes, they both equal 0.
Upon next call to the _sendData this line will always return 0:
uint32_t sendWindowSize = MIN(_sessionSendWindowSize, stream.sendWindowSize);
because only one sendWindowSize was increased in didReadWindowUpdateFrame.
So, a file with size more than 65536 bytes will never send.
Metadata
Metadata
Assignees
Labels
No labels