Web Servers General Talk - HTTP Header Queries ??

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers General Talk > September 2004 > HTTP Header Queries ??





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author HTTP Header Queries ??
James

2004-09-02, 7:24 pm

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
Markus Zingg

2004-09-02, 7:24 pm

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

Juliusz Chroboczek

2004-09-08, 6:02 pm

> 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
Juliusz Chroboczek

2004-09-09, 6:02 pm

> 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
Juliusz Chroboczek

2004-09-12, 7:48 am

> 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
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com