Thread View: ch.comp.os.linux
5 messages
5 total messages
Started by raeburn
Thu, 20 May 1999 00:00
"Malformed header" error: Apache/Linux
Author: raeburn
Date: Thu, 20 May 1999 00:00
Date: Thu, 20 May 1999 00:00
29 lines
1527 bytes
1527 bytes
I'm doing a simple CGI script and am getting a "Malformed header" error,
for no reason I can discern. The platform is Apache 1.3.2 on Red Hat
Linux 5.2. The script looks like this:
printf("Content-type: text/html\r\n");
printf("HTTP/1.0 200 OK\r\n");
printf("MIME-version: 1.0\r\n");
printf("Server: SRVPROJ 2.0\r\n");
printf("Pragma: no-cache\r\n");
printf("\r\n");
printf("<HTML> <BODY>\n");
printf("Welcome to the big website\n");
printf("</BODY> </HTML>\n");
The problem is with the "HTTP/1.0..." line. If I remove it, no error.
The sequence of the header lines is not significant. If I do this in
Perl, the results are the same.
Hope someone knows the answer. Also, this is my first post to deja; if
there's a more appropriate group to post this to, please let me know.
Thanks,
Eric Raeburn
raeburn@cup.hp.com
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
Re: "Malformed header" error: Apache/Linux
Author: Dominik Fretz
Date: Thu, 20 May 1999 00:00
Date: Thu, 20 May 1999 00:00
32 lines
1540 bytes
1540 bytes
raeburn@cup.hp.com wrote:
>
> I'm doing a simple CGI script and am getting a "Malformed header" error,
> for no reason I can discern. The platform is Apache 1.3.2 on Red Hat
> Linux 5.2. The script looks like this:
>
> printf("Content-type: text/html\r\n");
> printf("HTTP/1.0 200 OK\r\n");
>
> [snip]
>
> Hope someone knows the answer. Also, this is my first post to deja; if
> there's a more appropriate group to post this to, please let me know.
>
> Thanks,
> Eric Raeburn
> raeburn@cup.hp.com
hi
IMHO has after the line: 'Content-type: text/html' to be a blank line.
test this out:
printf("Content-type: text/html\r\n\r\n");
printf("HTTP/1.0 200 OK\r\n");
...
btw: why do you use \r\n?
in unix, all unix has \n for the line end \r\n is windows
hope that helps
Dominik
Re: "Malformed header" error: Apache/Linux
Author: Daniel Werner
Date: Thu, 20 May 1999 00:00
Date: Thu, 20 May 1999 00:00
34 lines
2071 bytes
2071 bytes
raeburn@cup.hp.com meinte zum Thema
"Malformed header" error: Apache/Linux:
> I'm doing a simple CGI script and am getting a "Malformed header" error,
> for no reason I can discern. The platform is Apache 1.3.2 on Red Hat
> Linux 5.2. The script looks like this:
>
> printf("Content-type: text/html\r\n");
> printf("HTTP/1.0 200 OK\r\n");
> printf("MIME-version: 1.0\r\n");
> printf("Server: SRVPROJ 2.0\r\n");
> printf("Pragma: no-cache\r\n");
> printf("\r\n");
>
> printf("<HTML> <BODY>\n");
> printf("Welcome to the big website\n");
> printf("</BODY> </HTML>\n");
>
> The problem is with the "HTTP/1.0..." line. If I remove it, no error.
> The sequence of the header lines is not significant. If I do this in
> Perl, the results are the same.
I would try it with \n instead of \r\n if it is running on a linux
system.
> Hope someone knows the answer. Also, this is my first post to deja; if
> there's a more appropriate group to post this to, please let me know.
A good place would be comp.infosystems.www.authoring.cgi
Daniel
--
Unterschriftenb�gen zu den Initiativen "F�r einen freiwilligen zivilen
Friedensdienst" und "F�r eine Schweiz ohne Armee" gibt's bei der GSoA:
http://www.gsoa.ch/; Tel: 01 / 273 01 00; GSoA, Postfach, 8031 Z�rich.
Re: "Malformed header" error: Apache/Linux
Author: Berger Bruno
Date: Fri, 21 May 1999 00:00
Date: Fri, 21 May 1999 00:00
33 lines
1558 bytes
1558 bytes
raeburn@cup.hp.com wrote:
>
> I'm doing a simple CGI script and am getting a "Malformed header" error,
> for no reason I can discern. The platform is Apache 1.3.2 on Red Hat
> Linux 5.2. The script looks like this:
>
> printf("Content-type: text/html\r\n");
You have to replace this DOS/Windoze-stuff "\r\n" with "\n" ... or at
the END of the header it NEEDS two
"\n"!!
> printf("HTTP/1.0 200 OK\r\n");
Is this correct? I have never seen this in a CGI, normaly this line is
used in the communication between browser and server... but maybe I am
wrong
a the begining start only with few lines in the header like this:
printf("Content-type: text/html\n");
printf("Pragma: no-cache\n\n"); // Note the TWO
Linefeeds !
printf("<HTML> <BODY>\n");
printf("Welcome to the big website\n");
printf("</BODY> </HTML>\n");
Greetings from Bern
Bruno
Re: "Malformed header" error: Apache/Linux
Author: Andreas Umbach
Date: Fri, 21 May 1999 00:00
Date: Fri, 21 May 1999 00:00
23 lines
1434 bytes
1434 bytes
raeburn@cup.hp.com wrote:
: I'm doing a simple CGI script and am getting a "Malformed header" error,
: for no reason I can discern. The platform is Apache 1.3.2 on Red Hat
: Linux 5.2. The script looks like this:
: printf("Content-type: text/html\r\n");
Just for asthetic reasons, please remove the \r (*shudder*).
: printf("HTTP/1.0 200 OK\r\n");
: printf("MIME-version: 1.0\r\n");
: printf("Server: SRVPROJ 2.0\r\n");
Why on earth would you want to output this? The CGI output goes to the
server (who will supply these header lines), not to the client.
If you really want to supply ALL HTTP headers (then the 'HTTP/1.0 200
OK' is mandatory and you can use the above code unmodified), call your
script 'nph-something.whatever'. The nph- prefix tells apache not to do
anything with the script headers and spit out unmodified whatever you
throw at it.
- Andreas
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads