in reply to Re: CGI: newlines, write exactly "\r\n" to end the headers, then turn off binmode
in thread CGI: newlines, write exactly "\r\n" to end the headers, then turn off binmode
You're not sending an HTTP response, though. You're sending a CGI response. What server are you using? Apache accepts LF.
Interesting. I sent a curl request to my Apache server, and I sniffed the response using Wireshark, and Apache performs conversions on the characters that a cgi script uses to terminate the headers. Here are the conversions that I observed:
I think Apache is following the dictum: "Be permissive in what you allow, but be strict in what you do." Likewise, I am going to be strict in what I do, and I'm not going to rely on a server to convert newlines to the HTTP 1.1 spec.
(I think it also accepts CRLF.)
It seems obvious to me that any http server would accept the header termination characters in the HTTP 1.1 spec? Why the hesitation? Were you speculating that "\r\n\r\n" might get converted to "\r\r\n\r\r\n"?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CGI: newlines, write exactly "\r\n" to end the headers, then turn off binmode
by dsheroh (Monsignor) on Mar 10, 2018 at 10:30 UTC | |
by 7stud (Deacon) on Mar 10, 2018 at 11:35 UTC | |
|
Re^2: CGI: newlines, write exactly "\r\n" to end the headers, then turn off binmode
by haukex (Archbishop) on Mar 10, 2018 at 11:15 UTC | |
|
Re^2: CGI: newlines, write exactly "\r\n" to end the headers, then turn off binmode
by ikegami (Patriarch) on Mar 12, 2018 at 19:14 UTC |