HTTP Proxy in Perl: Problem with accept() *Problem pin-pointed*

[b][red]This message was edited by gregster at 2003-11-24 15:9:49[/red][/b][hr]
I have managed to pin-point the source of the problem but don't quite know how to explain it:

If the first line (among the 2 listed after this paragraph) is used instead of the second one and an HTTP server sends back a response with status 302 found, I don't get any subsequent HTTP requests. (The 302 status informs the HTTP browser to search for the requested page at a different location: this location is specified in the HTTP header after "Location: "). If the second line is used, then the page specified after Location, is then requested...and the whole page is downloaded. Whereas if the first line is used, after the 302 status is sent back to the browser, there are no more requests that arrive from the client and the page isn't downloaded...

##$client_sock = $sock->accept() || die "accept $!";
accept ($client_sock, $sock)) || die "accept $!";

What's the difference between these 2 lines? One is blocking, the other isn't?

The rest of the code for the proxy is in my previous message.


  • : ##$client_sock = $sock->accept() || die "accept $!";
    : accept ($client_sock, $sock)) || die "accept $!";
    I'm pretty certain they are not (immediately, anyway) doing the same thing. Thing that stands out to me is that the first one is calling a method on an object ($sock), whereas the second is calling the accept function - a Perl builtin. Whether the end result is the same, I couldn't tell you. If they are doing different things, may I suggest that they are not equivalent. :-)


    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion