HTTP Header Queries ?? - Network

This is a discussion on HTTP Header Queries ?? - Network ; Hi, I am trying to write a small http client that justs "Posts" some data to the server and prints the data returned by the server. Posting (Sending data from client to server) is fine. But from server to client ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: HTTP Header Queries ??

  1. HTTP Header Queries ??

    Hi,
    I am trying to write a small http client that justs "Posts"
    some data to the server and prints the data returned by the server.

    Posting (Sending data from client to server) is fine.


    But from server to client i am having a problem.


    I have tested my program with a couple of web servers IIS and Apache.

    In IIS,
    The First Line i get is
    HTTP/1.1 200 OK

    If there is an error I will get (say)
    HTTP/1.1 501 Not Implemented


    Where as in apache ( if i am executing a script)

    I dont get the usual first Line (The first line is the line which i
    read first from the socket)

    The first line i get is the Content-Type: text/plain


    Why does Apache does so.

    I found out it was NOT apache but the scripts that come with standard
    linux
    distribution. The first line they print is Content-Type .


    Why is this difference.


    Regards,
    Sriram

  2. Re: HTTP Header Queries ??

    On 31 Aug 2004 02:34:20 -0700, james_sparker@yahoo.co.uk (James)
    wrote:

    >Hi,
    > I am trying to write a small http client that justs "Posts"
    >some data to the server and prints the data returned by the server.
    >
    >Posting (Sending data from client to server) is fine.
    >
    >
    >But from server to client i am having a problem.
    >
    >
    >I have tested my program with a couple of web servers IIS and Apache.
    >
    >In IIS,
    > The First Line i get is
    > HTTP/1.1 200 OK
    >
    >If there is an error I will get (say)
    >HTTP/1.1 501 Not Implemented
    >
    >
    >Where as in apache ( if i am executing a script)
    >
    >I dont get the usual first Line (The first line is the line which i
    >read first from the socket)
    >
    >The first line i get is the Content-Type: text/plain
    >
    >
    >Why does Apache does so.
    >
    >I found out it was NOT apache but the scripts that come with standard
    >linux
    >distribution. The first line they print is Content-Type .
    >
    >
    >Why is this difference.
    >
    >
    >Regards,
    >Sriram


    Sriram,

    The order of those lines is not defined. You should read all header
    lines (up until the first empty line) and check for the return code
    and the other information. Then, if you want to keep things simpler,
    use HTTP/1.0 instead of HTTP/1.1 in your GET statement.

    Markus


  3. Re: HTTP Header Queries ??

    > I have tested my program with a couple of web servers IIS and Apache.
    >
    > In IIS,
    > The First Line i get is
    > HTTP/1.1 200 OK
    >
    > If there is an error I will get (say)
    > HTTP/1.1 501 Not Implemented


    IIS is recognising your input as HTTP/1.0 or 1.1, and replying in HTTP/1.1.

    > Where as in apache ( if i am executing a script)


    > The first line i get is the Content-Type: text/plain


    Apache is not recognising your first line, and falling back to
    HTTP/0.9. There's probably something wrong in your input, and IIS's
    parser is more lax.

    Double check the traffic you're generating using a packet sniffer. Is
    there exactly one space between the URL and the HTTP/whatever
    signature? Do you terminate your lines with a CRLF?

    Followups restricted.

    Juliusz Chroboczek

+ Reply to Thread