--------------enig7A1724C04F6BEE4D2D85C59B
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

shiwei zhang wrote:
> Hi, All,
> 
>         On my Linux machine, I configured Mod_fcgid.2.0 in Apache2.2.3.nd
> I also installed ruby-1.8.5. Then I wrote two .rb files in the Apache
> cgi-bin directory,  as follows.
> //////////////////////cgitest01.rb starts/////////////////////
> #!/usr/local/bin/ruby
> puts "";
> puts "nice prog!";
> //////////////////////cgitest01.rb ends//////////////////////
> //////////////////////cgitest02.rb starts/////////////////////
> #!/usr/local/bin/ruby
> puts "nice prog!";
> //////////////////////cgitest02.rb ends/////////////////////
>          At this moment I visited http://xx.yyy.com/cgi-bin/cgitest01.rb,
> and it worked well. It printed out "nice prog!" normally.
>          However,  when  I visited
> http://ts.cn.oracle.com/cgi-bin/cgitest02.rb, I got the following error:
> [Wed Nov 08 17:18:26 2006] [error] [client 146.56.236.149] malformed header
> from script. Bad header=nice prog!: cgitest02.rb
> 
> Anybody can tell me why I encountered the error when visiting cgitest02.rb?
> Why must I put out an empty line (puts "";) at the biginning of the file if
> I want to successfully visit it?
> 
> Many Thanks in advance!
> 
> Rgds,
> Shiwei
> 

You Have To Because That's How HTTP Works.

Read up on the format of HTTP requests and replies, it will do you a
load of good. For the abridged version, a HTTP request or reply consist
of a sequence of headers, one per line (AFAIK), a blank line, and the body.

The blank line is part of the HTTP syntax which indicates that headers
end. (And for a GET request, that the request ends.)

David Vallner


--------------enig7A1724C04F6BEE4D2D85C59B
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)

iD8DBQFFUmOLy6MhrS8astoRAtqeAJ9i36vZTSSajTEbXxiBZ9Rt7t9PWgCeM+NU
d/+a5MU2T9R5WamJ9mNjz4EHq
-----END PGP SIGNATURE-----

--------------enig7A1724C04F6BEE4D2D85C59B--