-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Boundary begins with CRLF? #272
Conversation
…was not recognized by a server I was communicating with.
I did some more research on this, and the most helpful article I found was http://www.stucharlton.com/blog/archives/000126.html but I'm still not clear on if I'm wrong or this .NET/IIS server I'm talking to is wrong. Stu there did some informal tests and found inconsistent results in implementations: Yikes. I've sent an email feedback to the WS-I organization indicating that this seems to be a misstatement.
|
Re-reading the spec for the 15th time, I'm more sure that "3 CR/LFs" between the last http header and the first mime boundary is "correct". I made changes to the pull request herein to only add one extra cr/lf there, and updated the tests to match ... I'm up for comments/discussion on how I'm wrong too though :) The [...that initial CRLF is considered to be part of the encapsulation boundary rather than part of the preceding part.] seems to be the key part that causes the confusion in implementations. My current understanding is that the first 2 CR/LFs are for other purposes, but then another CR/LF is required as "part of the encapsulation boundary" because the first 2 didn't count. |
the number of options we need to support peoples varied HTTP implementations is getting out of control. i hate the world :) |
A (.NET) server I was working with was missing the first part of my multipart (i.e. it recognized the boundary of the second section I was sending, and thought it was the first section, but missed the existence of the first section entirely), until I added a CRLF at the beginning of my boundary as in the code in this pull request.
Reading the RFC it looks like it might be required to be like that?
Note that the encapsulation boundary must occur at the
beginning of a line, i.e., following a CRLF, and that that
initial CRLF is considered to be part of the encapsulation
boundary rather than part of the preceding part. The
boundary must be followed immediately either by another CRLF
and the header fields for the next part, or by two CRLFs, in
which case there are no header fields for the next part (and
it is therefore assumed to be of Content-Type text/plain).
from http://www.ietf.org/rfc/rfc1341.txt
I thought I'd share this pull request just in case there's something to it.