home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / tcpcat.al < prev    next >
Encoding:
Text File  |  2003-11-16  |  1.4 KB  |  38 lines

  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 1972 "blib\lib\Net\SSLeay.pm (autosplit into blib\lib\auto\Net\SSLeay\tcpcat.al)"
  7. sub tcpcat { # address, port, message, $crt, $key --> reply / (reply,errs,cert)
  8.     my ($dest_serv, $port, $out_message) = @_;
  9.     my ($got, $errs, $written);
  10.     
  11.     ($got, $errs) = open_proxy_tcp_connection($dest_serv, $port);
  12.     return (wantarray ? (undef, $errs) : undef) unless $got;
  13.     
  14.     ### Connected. Exchange some data (doing repeated tries if necessary).
  15.         
  16.     warn "tcpcat $$: sending " . blength($out_message) . " bytes...\n"
  17.     if $trace==3;
  18.     warn "tcpcat $$: sending `$out_message' (" . blength($out_message)
  19.     . " bytes)...\n" if $trace>3;
  20.     ($written, $errs) = tcp_write_all($out_message);
  21.     goto cleanup unless $written;
  22.     
  23.     sleep $slowly if $slowly;  # Closing too soon can abort broken servers
  24.     CORE::shutdown SSLCAT_S, 1;  # Half close --> No more output, send EOF to server
  25.     
  26.     warn "waiting for reply...\n" if $trace>2;
  27.     ($got, $errs) = tcp_read_all($ssl);
  28.     warn "Got " . blength($got) . " bytes.\n" if $trace==3;
  29.     warn "Got `$got' (" . blength($got) . " bytes)\n" if $trace>3;
  30.  
  31. cleanup:
  32.     close SSLCAT_S;    
  33.     return wantarray ? ($got, $errs) : $got;
  34. }
  35.  
  36. # end of Net::SSLeay::tcpcat
  37. 1;
  38.