Forum Discussion

Stephan_Fantasi's avatar
Stephan_Fantasi
Icon for Nimbostratus rankNimbostratus
Nov 27, 2006

Rule based virtual server hangs during direct socket connections

I am trying to create a rule based virtual host that will direct traffic to one machine or another depending on http_uri. This seems to work fine for general browser access. And, it works fine when I test it via "telnet hostname 80". However, it just hangs when I use a perl script that opens a socket to port 80. Please see http://www.oreilly.com/openbook/webclient/ch04.html16761to see exactly what I am using. This works perfectly fine when I use it access a non rule-based host. But it hangs for the rule-based. Have any of you been able to access a rule-based virtual host via a direct socket connection without issue? I'm not doing anything fancy. This just isn't working.

 

 

Thanks,

 

 

Steve
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    That's definitely an interesting situation. I haven't tested this personally, but if the telnet connection works, and general browser access works, then the perl script must be doing something at least slightly different and/or out of the ordinary. Perhaps it's waiting for some response that's not being sent by the proxy?

     

     

    Very interesting. I'd love to hear about it if you find out more.

     

     

    Colin
  • Martin_Machacek's avatar
    Martin_Machacek
    Historic F5 Account
    Stephan,

    your Perl based web client is most likely sending just linefeed characters (\n - hex 0a) instead of carriage return, linefeed sequences (\r\n - hex 0d,0a) as line terminators as is mandated by applicable RFCs (2616, 1945). BIG-IP HTTP parser used by the iRule engine requires lines to be terminated by carriage return, linefeed sequences. All normal web clients DoTheRightThing(tm). Also Unix/Linux bases TELNET clients by default translate \n to \r\n. The example you've refered to clearly uses only \n as line terminator:

    
     contact the server
    if (open_TCP(F, $ARGV[0], 80) == undef) {
      print "Error connecting to server at $ARGV[0]\n";
      exit(-1);
    }
     
     send the GET method with / as a parameter
    print F "GET / HTTP/1.0\n\n";

    Unless there is some behind-the-scenes translation, that is your problem. It can be trivially fixed by prefixing every \n with \r, like this:

    
     contact the server
     send the GET method with / as a parameter
    print F "GET / HTTP/1.0\r\n\r\n";