Skip to content

A content length of zero should also be sent #1362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2016

Conversation

shmuelzon
Copy link
Contributor

This is needed since when the content-length header is not sent the clients will
wait for data anyways. Sending a content length of zero will tell the client not
to expect any content and it will close the connection immediately.

Since size_t is unsigned, checking if the content-length is >=0 seems redundant.

@shmuelzon shmuelzon changed the title A content length of zero shoud also be sent A content length of zero should also be sent Jan 4, 2016
@igrr
Copy link
Member

igrr commented Jan 4, 2016

For the case when _contentLength == CONTENT_LENGTH_UNKNOWN, this will call

sendHeader("Content-Length", String(contentLength));

where contentLength may be zero. So this will send Content-Length: 0 header even though content length was declared to be unknown.

@shmuelzon shmuelzon force-pushed the zero-content-length branch from a2c70fb to 03f3408 Compare January 4, 2016 18:21
@shmuelzon
Copy link
Contributor Author

I've rearranged the conditions a bit so the code (to me) is a bit more readable and also answers the issue Ivan raised.

@shmuelzon shmuelzon force-pushed the zero-content-length branch from 03f3408 to 3776391 Compare January 5, 2016 04:30
@Links2004
Copy link
Collaborator

the build/test server has failed, try to merge the latest version to trigger a retest.
@igrr may the get.py script need some retry function for download errors.

@shmuelzon shmuelzon force-pushed the zero-content-length branch from 3776391 to 1c3d294 Compare January 5, 2016 11:24
@shmuelzon
Copy link
Contributor Author

Done

This is needed since when the content-length header is not sent the clients will
wait for data anyways. Sending a content length of zero will tell the client not
to expect any content and it will close the connection immediately.
@shmuelzon shmuelzon force-pushed the zero-content-length branch from 1c3d294 to 9e61e60 Compare January 10, 2016 06:11
igrr added a commit that referenced this pull request Jan 10, 2016
A content length of zero should also be sent
@igrr igrr merged commit e8d60be into esp8266:master Jan 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants