Last Line of a HTTP multipart formdata request with CRLF or not? #2186
-
Hi, I'm using undici to POST a multipart formdata to a webserver with https://github.com/yhirose/cpp-httplib as server library. The library expects every line to end in a CRLF. Undici does not send the last line with a CRLF (see here). So my question would be what is the correct behaviour? Add the CRLF to the last line of a http request or relax the checking in cpp-httplib to not require a CRLF on the last line? Btw, curl does add a CRLF after the last line (after the boundary--). Maybe some expert could give me a hint before just "patching something"... Thanks Christian |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi! According to spec,
Although it just specifies it between body parts, not mentioning the last part of the body. |
Beta Was this translation helpful? Give feedback.
-
Thanks, did some digging and https://datatracker.ietf.org/doc/html/rfc2046#section-5.1 states the BNF form of a multipart body is:
So a CRLF is not required after the close-delimiter. |
Beta Was this translation helpful? Give feedback.
Hi!
According to spec,
CRLF
seems to not be mandatory unless the body is ofform-data
content type, quoting:Although it just specifies it between body parts, not mentioning the last part of the body.
Just made quick look, haven't looked deeper into it yet