[BusyBox] httpd and cgi

Steven Scholz steven.scholz at imc-berlin.de
Mon Apr 28 12:52:20 UTC 2003


Hi there,

I want an cgi script to generate a vaild html page that than is send 
to the browser.

But I noticed that busybox' httpd itself is prepending an "HTTP/1.0 
200 OK\n" if this is not contained in the buffer return from the cgi 
script.

line 1150:
           if (firstLine) {
             /* check to see if the user script added headers */
             if (strncmp(buf, "HTTP/1.0 200 OK\n", 4) != 0) {
               bb_full_write(s, "HTTP/1.0 200 OK\n", 16);
             }
             if (strstr(buf, "ontent-") == 0) {
               bb_full_write(s, "Content-type: text/plain\n\n", 26);
             }
             firstLine=0;
           }

And that "HTTP/1.0 200 OK\n" apparently causes my browser to display 
the html stuff as text instead of interpreting them.

So instead of viewing a nice web page created by the cgi script I only 
see the source code of it.

Is that normal, standard behaviour in handling CGI?
How can I work around this httpd "feature"?

Thanks,

Steven



More information about the busybox mailing list