View Full Version : Ruby CGI Puts Newline (HTTP Header)

06-17-2003, 02:17 AM
I'm writing a CGI script using Ruby. From my understanding, the difference between puts and print is that puts appends a newline character after the string, print doesn't.

So here's my question... in the example, why does the correct code need two newlines if one is already being outputted by puts? Wouldn't that really make it 3 newlines outputted, one newline more than RFC1945 asks for? In my mind, the incorrect code is just as valid.

INCORRECT: puts "Content-Type: text/plain\n"
CORRECT: puts "Content-Type: text/plain\n\n"

Thanks guys,