CapitaineCaverne has asked for the wisdom of the Perl Monks concerning the following question:
What I should see, along with the HTTP response is the HTML header, however, here is what I get on the screen.use strict; use IO::Socket; my $host = IO::Socket::INET->new ( PeerAddr=> 'www.smartadserver.com', PeerPort=> '80', Proto => "tcp", Type => SOCK_STREAM, ); print $host <<EOM; GET /call/pubj/445/3197/138/M/5249542624/target? HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, applicati +on/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdoc +ument, application/x-ms-xbap, application/x-ms-application, applicati +on/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, * +/* Accept-Language: fr UA-CPU: x86 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CL +R 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.2) Host: www.smartadserver.com Proxy-Connection: Keep-Alive EOM my $byte; while (sysread($host,$byte,1)==1) { print $byte; }
And tcpdump is indeed showing the HTML code, so it is really being sent ! On top of this, if I do this manually (i.e. open a telnet on port 80 on www.smartadserver.com and paste the same HTTP request that is contained in the perl programm, I get the full response (HTTP answer+HTML code)).HTTP/1.1 302 Object moved Date: Tue, 01 Jul 2008 20:08:00 GMT Server: Microsoft-IIS/6.0 P3P: CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo" pragma: no-cache cache-control: private Location: /def/def/showdef.asp Content-Length: 210 Content-Type: text/html Expires: Mon, 30 Jun 2008 20:08:00 GMT Set-Cookie: sasd=%24a%3D78t%3B%24cn%3DFR%5FA8%3B%24isp%3D102%3B%24qt%3 +D184%5F1338%5F12468t; path=/ Set-Cookie: pdomid=5; path=/ Set-Cookie: TestIfCookieP=ok; expires=Fri, 26-Nov-2010 23:00:00 GMT; d +omain=smartadserver.com; path=/ Set-Cookie: TestIfCookie=ok; domain=smartadserver.com; path=/ Set-Cookie: ASPSESSIONIDSCCSCBCA=HGFAJNDBEBFKPPGMPLNOOJBM; path=/ Cache-control: no-cache ****** Suprisingly, HTML DATA is missing here...*****
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't read end data out of a socket
by pc88mxer (Vicar) on Jul 01, 2008 at 20:42 UTC | |
by sgifford (Prior) on Jul 02, 2008 at 00:34 UTC | |
by pjotrik (Friar) on Jul 01, 2008 at 21:47 UTC | |
|
Re: Can't read end data out of a socket
by moritz (Cardinal) on Jul 01, 2008 at 21:01 UTC | |
by Anonymous Monk on Jul 02, 2008 at 07:43 UTC |