IO::Socket...HTTP/1.0\n\n needs to be HTTP/1.1\r\n

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • john2357
    New Member
    • Oct 2008
    • 1

    #1

    IO::Socket...HTTP/1.0\n\n needs to be HTTP/1.1\r\n

    I can not use the LWP module, and must use IO::Socket. Using 'Wireshark' and Mozilla and passing in the parameters below I get a valid reply. However Wireshark shows HTTP needs to be 1.1 and that the Internet line terminator needs to be "\r\n" and not "\n\n". How do I get IO::Socket to use the 1.1 Protocol? Also, how do I get Perl to indicate it is a Mozilla browser? I have been Googling this for several hours and am unable to find anything of use. Any help is appreciated. John
    Code:
    use IO::Socket;
    $first_name = 'Steve';
    $last_name = 'Dunn';
    
    $sym_url = "/cgi-bin/pd.exe/search?p1=$last_name&p2=$first_name&p3=&input=grp_sxo_name&type=name&dlnumber=CC&dlstate=CC";
    
    $socket = IO::Socket::INET->new
            ( PeerAddr => 'search.criminalcheck.com',    
            PeerPort => 80,  
            Proto => 'tcp',  
            Type => SOCK_STREAM,      
            Reuse => 1)  
    
    # this does not work:
    print $socket "GET $sym_url HTTP/1.0\n\n";
    # I think the server wants this:
    print $socket "GET $sym_url HTTP/1.1\r\n\n";   # BUT it doesn't wk either
                                                                     
    while (<$socket>) {       # read in entire web page line by line
            print "$_\n";
        print OUT_HTML $_;        # Writes each line as it is read to the filehandle "OUT"
     }
     
       ### done reading web page
        print "\n\n----- done with web page -------\n\n";
       
    ## for testing the URL I am using is:
    #http://search.criminalcheck.com/cgi-bin/pd.exe/search?p1=Dunn&p2=Steve&p3=&input=grp_sxo_name&type=name&dlnumber=CC&dlstate=CC
    Last edited by numberwhun; Oct 10 '08, 12:42 PM. Reason: Please use code tags
  • Icecrack
    Recognized Expert New Member
    • Sep 2008
    • 174

    #2
    First Please use code tags,

    Second Change:

    Code:
    print $socket "GET $sym_url HTTP/1.1\r\n\n"
    to:

    Code:
    print $socket "GET $sym_url HTTP/1.1\r\n"

    Comment

    Working...