Skip to content
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

Support beautification of HTTP 100 responses. #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jparise
Copy link

@jparise jparise commented May 14, 2012

Detect when the server sends an HTTP 100 (Continue) response header
and kick our beautification loop into 'continuing' mode. While in
this mode, we wait for another ^HTTP/ header to be received before
responding to the \r\n break sequence signalling the end of the
headers and the start of the body. This gives us output like:

HTTP/1.1 100 (Continue)

HTTP/1.1 200 OK
Content-Length: 387
Content-Type: application/json; charset=UTF-8

{
}

This comes into play when uploading files using curlish.

Previously, these types of HTTP conversations were not "beautified"
because the header processing loop bailed out after the initial
HTTP/1.1 100 (Continue)\r\n\r\n content was handled.

Detect when the server sends an HTTP 100 (Continue) response header
and kick our beautification loop into 'continuing' mode.  While in
this mode, we wait for another ^HTTP/ header to be received before
responding to the `\r\n` break sequence signalling the end of the
headers and the start of the body.  This gives us output like:

    HTTP/1.1 100 (Continue)

    HTTP/1.1 200 OK
    Content-Length: 387
    Content-Type: application/json; charset=UTF-8

    {
    }

This comes into play when uploading files using curlish.

Previously, these types of HTTP conversations were not "beautified"
because the header processing loop bailed out after the initial
`HTTP/1.1 100 (Continue)\r\n\r\n` content was handled.
@mitsuhiko
Copy link
Contributor

I will apply this. I wonder though it it makes sense to match for HTTP/\d+\.\d+\s+100 instead of just one space.

@jparise
Copy link
Author

jparise commented May 30, 2012

That's probably a good improvement. The same would apply to the existing HTTP/\d+.\d+ [45]\d+ test, as well.

@jparise
Copy link
Author

jparise commented Oct 24, 2012

@mitsuhiko, would you consider merging this for a future release?

@mitsuhiko
Copy link
Contributor

Yes, will do that. Just have to check that it works :)

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.

2 participants