2af9fb064ec3a1f730a50ee47ce6e21b28d0c83c
[dh-make-perl] / dev / arm / libnet-ssleay-perl / libnet-ssleay-perl-1.35 / debian / libnet-ssleay-perl / usr / lib / perl5 / auto / Net / SSLeay / open_proxy_tcp_connection.al
1 # NOTE: Derived from blib/lib/Net/SSLeay.pm.
2 # Changes made here will be lost when autosplit is run again.
3 # See AutoSplit.pm.
4 package Net::SSLeay;
5
6 #line 1834 "blib/lib/Net/SSLeay.pm (autosplit into blib/lib/auto/Net/SSLeay/open_proxy_tcp_connection.al)"
7 ### Open connection via standard web proxy, if one was defined
8 ### using set_proxy().
9
10 sub open_proxy_tcp_connection {
11     my ($dest_serv, $port) = @_;
12     return open_tcp_connection($dest_serv, $port) if !$proxyhost;
13     
14     warn "Connect via proxy: $proxyhost:$proxyport" if $trace>2;
15     my ($ret, $errs) = open_tcp_connection($proxyhost, $proxyport);
16     return wantarray ? (0, $errs) : 0 if !$ret;  # Connection fail
17     
18     warn "Asking proxy to connect to $dest_serv:$port" if $trace>2;
19     #print SSLCAT_S "CONNECT $dest_serv:$port HTTP/1.0$proxyauth$CRLF$CRLF";
20     #my $line = <SSLCAT_S>;   # *** bug? Mixing stdio with syscall read?
21     ($ret, $errs) =
22         tcp_write_all("CONNECT $dest_serv:$port HTTP/1.0$proxyauth$CRLF$CRLF");
23     return wantarray ? (0,$errs) : 0 if $errs;
24     ($line, $errs) = tcp_read_until($CRLF . $CRLF, 1024);
25     warn "Proxy response: $line" if $trace>2;
26     return wantarray ? (0,$errs) : 0 if $errs;
27     return wantarray ? (1,'') : 1;  # Success
28 }
29
30 # end of Net::SSLeay::open_proxy_tcp_connection
31 1;