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

This is a discussion on Linux Apache & CGI (Bad Header problem. Why?) - Networking ; 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= Then I modified the code, adding the Content-type line: printf("Content-type: text/html\n\n"); ...

+ Reply to Thread
Results 1 to 3 of 3

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

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

    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=

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

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

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

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

    What's wrong?


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

    On 2007-04-25, Edu 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

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

    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=
    >
    > Then I modified the code, adding the Content-type line:
    >
    > printf("Content-type: text/html\n\n");
    > printf("\n");
    > printf(" \n");
    > (...)
    >
    > compiled, replaced the binary...and I still got:
    > malformed header from script. Bad header=
    >
    > 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:


    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 to Thread