Networking Forums

Networking Forums > Computer Networking > Linux Networking > http response & wget

Reply
Thread Tools Display Modes

http response & wget

 
 
stdazi@gmail.com
Guest
Posts: n/a

 
      10-05-2006, 01:42 PM
Hello!

I was a bit in doubt if posting the message here, or in
comp.unix.programmer. I choosed this group even if the problem is a bit
programming related.

I have a web server running on localhost, and a file named "foo.txt"
residing in the web root. Issuing the request http://localhost/foo.txt
, works fine with any http client and even manually :

azi@magicb0x ~ $ telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /foo.txt HTTP/1.1

HTTP/1.0 200 OK
Date: Thu, 05 Oct 2006 15:25:22 GMT
Content-Type: text/html
Content-Length: 7

foobar
Connection closed by foreign host.

So, you may be thinking what's the problem. using wget to retrive the
file gives a "screwed" file :

azi@magicb0x ~ $ wget localhost/foo.txt
--15:26:43-- http://localhost/foo.txt
=> `foo.txt'
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 No headers, assuming
HTTP/0.9
Length: unspecified

15:26:43 (4.64 MB/s) - `foo.txt' saved [112]
azi@magicb0x ~ $ cat foo.txt

HTTP/1.0 200 OK
Date: Thu, 05 Oct 2006 15:26:43 GMT
Content-Type: text/html
Content-Length: 7

foobar
azi@magicb0x ~ $

wget works fine if the file is placed on some other web site, so i'm
100% it's the web server fault (it's my code, and it looks like I
missed something :-). I have no clue where the fault may be, and i
really hope someone from the list can help me! I think it has something
to do with the above routine :
http://rafb.net/paste/results/yahFj799.html .


Regards!

 
Reply With Quote
 
 
 
 
Davide Bianchi
Guest
Posts: n/a

 
      10-05-2006, 01:48 PM
On 2006-10-05, (E-Mail Removed) <(E-Mail Removed)> wrote:
> residing in the web root. Issuing the request http://localhost/foo.txt
> GET /foo.txt HTTP/1.1
> Content-Type: text/html


If it's a txt file why 'text/html' ? It should be 'text/plain'.

Davide

--
!07/11 PDP a ni deppart m'I !pleH
 
Reply With Quote
 
azi.stdout@gmail.com
Guest
Posts: n/a

 
      10-05-2006, 02:48 PM

Davide Bianchi wrote:
> On 2006-10-05, (E-Mail Removed) <(E-Mail Removed)> wrote:
> > residing in the web root. Issuing the request http://localhost/foo.txt
> > GET /foo.txt HTTP/1.1
> > Content-Type: text/html

>
> If it's a txt file why 'text/html' ? It should be 'text/plain'.
>
> Davide
>

You're right! But this is not the reason for the issue i'm experiencing
;-(

 
Reply With Quote
 
Robert Harris
Guest
Posts: n/a

 
      10-05-2006, 04:54 PM
(E-Mail Removed) wrote:
> Hello!
>
> I was a bit in doubt if posting the message here, or in
> comp.unix.programmer. I choosed this group even if the problem is a bit
> programming related.
>
> I have a web server running on localhost, and a file named "foo.txt"
> residing in the web root. Issuing the request http://localhost/foo.txt
> , works fine with any http client and even manually :
>
> azi@magicb0x ~ $ telnet localhost 80
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> GET /foo.txt HTTP/1.1
>
> HTTP/1.0 200 OK
> Date: Thu, 05 Oct 2006 15:25:22 GMT
> Content-Type: text/html
> Content-Length: 7
>
> foobar
> Connection closed by foreign host.
>
> So, you may be thinking what's the problem. using wget to retrive the
> file gives a "screwed" file :
>
> azi@magicb0x ~ $ wget localhost/foo.txt
> --15:26:43-- http://localhost/foo.txt
> => `foo.txt'
> Resolving localhost... 127.0.0.1
> Connecting to localhost|127.0.0.1|:80... connected.
> HTTP request sent, awaiting response... 200 No headers, assuming
> HTTP/0.9
> Length: unspecified
>
> 15:26:43 (4.64 MB/s) - `foo.txt' saved [112]
> azi@magicb0x ~ $ cat foo.txt
>
> HTTP/1.0 200 OK
> Date: Thu, 05 Oct 2006 15:26:43 GMT
> Content-Type: text/html
> Content-Length: 7
>
> foobar
> azi@magicb0x ~ $
>
> wget works fine if the file is placed on some other web site, so i'm
> 100% it's the web server fault (it's my code, and it looks like I
> missed something :-). I have no clue where the fault may be, and i
> really hope someone from the list can help me! I think it has something
> to do with the above routine :
> http://rafb.net/paste/results/yahFj799.html .
>
>
> Regards!
>

Is your server, by any chance, emitting a newline before the header?

Robert
 
Reply With Quote
 
stdazi@gmail.com
Guest
Posts: n/a

 
      10-05-2006, 05:23 PM

Robert Harris wrote:
> (E-Mail Removed) wrote:
> > Hello!
> >
> > I was a bit in doubt if posting the message here, or in
> > comp.unix.programmer. I choosed this group even if the problem is a bit
> > programming related.
> >
> > I have a web server running on localhost, and a file named "foo.txt"
> > residing in the web root. Issuing the request http://localhost/foo.txt
> > , works fine with any http client and even manually :
> >
> > azi@magicb0x ~ $ telnet localhost 80
> > Trying 127.0.0.1...
> > Connected to localhost.
> > Escape character is '^]'.
> > GET /foo.txt HTTP/1.1
> >
> > HTTP/1.0 200 OK
> > Date: Thu, 05 Oct 2006 15:25:22 GMT
> > Content-Type: text/html
> > Content-Length: 7
> >
> > foobar
> > Connection closed by foreign host.
> >
> > So, you may be thinking what's the problem. using wget to retrive the
> > file gives a "screwed" file :
> >
> > azi@magicb0x ~ $ wget localhost/foo.txt
> > --15:26:43-- http://localhost/foo.txt
> > => `foo.txt'
> > Resolving localhost... 127.0.0.1
> > Connecting to localhost|127.0.0.1|:80... connected.
> > HTTP request sent, awaiting response... 200 No headers, assuming
> > HTTP/0.9
> > Length: unspecified
> >
> > 15:26:43 (4.64 MB/s) - `foo.txt' saved [112]
> > azi@magicb0x ~ $ cat foo.txt
> >
> > HTTP/1.0 200 OK
> > Date: Thu, 05 Oct 2006 15:26:43 GMT
> > Content-Type: text/html
> > Content-Length: 7
> >
> > foobar
> > azi@magicb0x ~ $
> >
> > wget works fine if the file is placed on some other web site, so i'm
> > 100% it's the web server fault (it's my code, and it looks like I
> > missed something :-). I have no clue where the fault may be, and i
> > really hope someone from the list can help me! I think it has something
> > to do with the above routine :
> > http://rafb.net/paste/results/yahFj799.html .
> >
> >
> > Regards!
> >

> Is your server, by any chance, emitting a newline before the header?


It does. It also looks like this was the root of evil :-). Thank you
very much for the hint!

 
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
Any http proxy to accelerate http GET method? Trent.Zhou@gmail.com Linux Networking 7 11-23-2007 05:16 AM
forward http://p2p.mydomain.com to http://mydomainIP:50001/gui/index.html, is that possible? aticatac Network Routers 1 11-13-2007 12:00 AM
Question about "expires" in http response yinglcs@gmail.com Linux Networking 1 07-10-2007 08:13 AM
Apache problem: Can see http://localhost/ but not http://ipaddress/ Andrew Linux Networking 4 02-13-2005 12:26 PM
wget and certificates? Karl Moosberg Linux Networking 7 08-01-2004 06:53 PM



1 2 3 4 5 6 7 8 9 10 11