tags:

views:

23

answers:

1

Hi All,

I've been fiddling with TCP/IP networking in Gawk and am having a hard time figuring out why it behaves well with some sites but not for others. I've even tried using HTTP Live Headers in Windows to try and debug what's going on, but to no avail.

The sample Gawk code below (Version 3.1.5) will work fine for the site www.sobell.com but will hang on www.drudgreport.com.

BEGIN {
print "Dumping HTML of www.sobell.com"

server = "/inet/tcp/0/www.sobell.com/80"
print "GET http://www.sobell.com" |& server
while ((server |& getline) > 0)
    print $0
close(server)

print "Dumping HTML of www.drudgereport.com"

server = "/inet/tcp/0/www.drudgereport.com/80"
print "GET http://www.drudgereport.com" |& server
while ((server |& getline) > 0)
    print $0
close(server)

}

I appreciate any help! Thanks All.

+1  A: 
schot
Great schot, works perfect. It is odd the gawkinet I read (for 3.1 and later) mentions the current HTTP being 1.1 but does not write the example code with your approach. Oh well, very glad to have it working!
jparanich