[cups.bugs] [MOD] STR #3194: Incorrect CGI handling assumes line-based output

twaugh.redhat twaugh at redhat.com
Wed May 13 05:36:40 PDT 2009


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

When sending the output of a command for CGI handling, an assumption is
made that the command will send output in a line-based fashion.  When this
does not happen, incorrect HTTP output is given.

For example, php-cgi on the system I'm using behaves like this:

$ echo | strace -ewrite php-cgi >/dev/null
write(1, "X-Powered-By: PHP/5.1.6", 23) = 23
write(1, "\r\n", 2)                     = 2
write(1, "Content-type: text/html", 23) = 23
write(1, "\r\n", 2)                     = 2
write(1, "\r\n", 2)                     = 2
write(1, "\n", 1)                       = 1

Unfortunately this caused cupsd to give this response to an HTTP request
for a php file:

X-Powered-By: PHP/5.1.6HTTP/1.0 200 OK
Date: Wed, 13 May 2009 12:34:31 GMT
Server: CUPS/1.2
Content-Language: en_US

Note that the HTTP response line is tacked onto the end of the first few
characters of output from php-cgi.

The CUPS scheduler ought to be prepared to handle this situation.

Link: http://www.cups.org/str.php?L3194
Version: 1.3.10





More information about the cups mailing list