Networking Forums

Networking Forums > Computer Networking > Linux Networking > Linux Apache & CGI (Bad Header problem. Why?)

Reply
Thread Tools Display Modes

Linux Apache & CGI (Bad Header problem. Why?)

 
 
Edu
Guest
Posts: n/a

 
      04-25-2007, 04:25 PM
Hi,

I was trying a CGI built with C in Apache2.Firstly, I forgot the
Content-type header and got the error (in apache's error.log):

malformed header from script. Bad header=<html>

Then I modified the code, adding the Content-type line:

printf("Content-type: text/html\n\n");
printf("<html>\n");
printf(" <HEAD>\n");
(...)

compiled, replaced the binary...and I still got:
malformed header from script. Bad header=<html>

I also tried to restart the server, but it was the same.

What's wrong?

 
Reply With Quote
 
 
 
 
Davide Bianchi
Guest
Posts: n/a

 
      04-25-2007, 04:31 PM
On 2007-04-25, Edu <(E-Mail Removed)> wrote:
> What's wrong?


Impossible to say, but is not a problem in Apache.
Davide

--
What you end up with, after running an operating system concept through
these many marketing coffee filters, is something not unlike plain hot
water.
-- Matt Welsh
 
Reply With Quote
 
Robert Harris
Guest
Posts: n/a

 
      04-25-2007, 06:21 PM
Edu wrote:
> Hi,
>
> I was trying a CGI built with C in Apache2.Firstly, I forgot the
> Content-type header and got the error (in apache's error.log):
>
> malformed header from script. Bad header=<html>
>
> Then I modified the code, adding the Content-type line:
>
> printf("Content-type: text/html\n\n");
> printf("<html>\n");
> printf(" <HEAD>\n");
> (...)
>
> compiled, replaced the binary...and I still got:
> malformed header from script. Bad header=<html>
>
> I also tried to restart the server, but it was the same.
>
> What's wrong?
>

You need a proper HTTP header. HTTP version 1.1 (the current version) is
defined by RFC2817; you can read it at:
<http://www.ietf.org/rfc/rfc2817.txt>

Note specifically that header lines should end with "\r\n".

Some versions of web servers will allow you to get away with headers of
varying degrees of badness. Some won't.

Robert
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux stripping off VLAN header Prasanna Linux Networking 4 06-04-2008 07:37 AM
linux cooked header to ethernet header conversion makwak Linux Networking 0 05-10-2005 12:36 PM
Linux-Apache should beat W2K+3/IIS Diego Banuelos Linux Networking 0 02-18-2005 07:10 PM
premature end of script header on apache server zhe@foundrynet.com Linux Networking 2 01-05-2005 11:18 PM
Windows can't see Apache on Linux machine when in one location, can in other. Linux PC can see server in both locations. Agent X Linux Networking 9 07-12-2004 05:17 PM



1 2 3 4 5 6 7 8 9 10 11