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

Expect/100-continue support #316

Closed
wants to merge 0 commits into from
Closed

Expect/100-continue support #316

wants to merge 0 commits into from

Conversation

mnot
Copy link

@mnot mnot commented Sep 30, 2010

This branch adds server- and client-side support for HTTP/1.1 Expect/continue.

This is important because some clients (e.g., Curl) will send Expect/Continue on requests with bodies, and by default will pause until either a) they see a 100 Continue response, or b) they time out (1-3 secs, IME). Since node doesn't handle Expect/continue, it introduces an unnecessary delay.

On the server side, it creates a new event, 'check_continue' that is emitted when a request contains 'Expect: 100-continue'.

The event is passed request and response objects, just like the 'request' event. If the server wants the request to continue, it calls response.sendContinue(); if not, it sends a final status code. Note that 'request' is not fired if 'check_continue' is; see the test case for an example.

If the event is not handled, node will automagically generate the 100 Continue when appropriate. This is IMO the most reasonable default behaviour, while still allowing full control over the feature.

On the client side, it creates a new 'continue' event that's fired if a 100 Continue is received.

This probably needs a bit more testing around the corner cases to make sure it always does the right thing; I'll try to do so and report back. Just figured it would be good to get some review and others' experience in the meantime.

@ry
Copy link

ry commented Oct 1, 2010

Thanks! Finally proper 100-continue support!

Committed in d59512f.

The only modification was squashing and:

:%s/sendContinue/writeContinue/g
:%s/check_continue/checkContinue/g

This pull request was closed.
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.

2 participants