Skip to content

CGI script using LF line breaks in headers causes error #165

Open
@paulownia

Description

@paulownia

The change introduced in #138 disallows bare LFs in headers and request lines. This change is good, but it also affects CGIHandler, causing scripts that use bare LF as a header separator to fail. However, according to RFC 3875, unlike HTTP, bare LFs are allowed in CGI header syntax.

For example, the following CGI script will fail when run under WEBrick 1.8 and later:

#!/usr/bin/ruby

print "Content-Type: text/html\n"
print "\n"
print "<html>example</html>"

In this case, the error message displayed in the browser is:

bad header 'Content-Type: text/html '. 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions