Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

http: Don't unshift empty bodyHead onto socket #5623

Closed
wants to merge 1 commit into from

Conversation

isaacs
Copy link

@isaacs isaacs commented Jun 3, 2013

In some cases, the http CONNECT/Upgrade API is unshifting an empty
bodyHead buffer onto the socket.

Normally, stream.unshift(chunk) does not set state.reading=false.
However, this check was not being done for the case when the chunk was
empty (either `''` or `Buffer(0)`), and as a result, it was causing the
socket to think that a read had completed, and to stop providing data.

This bug is not limited to http or web sockets, but rather would affect
any parser that unshifts data back onto the source stream without being
very careful to never unshift an empty chunk.  Since the intent of
unshift is to *not* change the state.reading property, this is a bug.

Fixes nodejs#5557
Fixes socketio/socket.io#1242
@isaacs
Copy link
Author

isaacs commented Jun 3, 2013

I think I confused github. Duplicate of #5624.

@isaacs isaacs closed this Jun 3, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant