http://qs321.pair.com?node_id=215508


in reply to Re: HTTP::Daemon and SSL
in thread HTTP::Daemon and SSL

Hello. I've tried your hints by doing the changes of Daemon.pm and use my script but not with desired success. Has anyone perhaps sample-code for proxying client-requests with CONNECT-method to establish ssl and what additional changes have to do? I'll be very glad, if someone can post it here. Best regards, Andreas
my $UA = LWP::UserAgent->new; $UA->agent("Mozilla/4.0"); $UA->protocols_allowed(['http','https']); my $SRV = HTTP::Daemon->new(LocalPort => 3128); while (my $conn = $SRV->accept) { while (my $request = $conn->get_request) { my $resp = $UA->simple_request($request); $conn->send_response($resp); } $conn->close; }
Debugoutput in request to local webserver and https://www.nodeworks.com looks like:
LWP::UserAgent::send_request: GET http://127.0.0.1/ LWP::UserAgent::_need_proxy: Not proxied LWP::UserAgent::send_request: http URLs are among LWP::UserAgent=HASH( +0x1fe594)'s allowed protocols (http https) LWP::Protocol::http::request: () LWP::Protocol::collect: read 639 bytes LWP::Protocol::collect: read 817 bytes LWP::UserAgent::send_request: GET http://127.0.0.1/apache_pb.gif LWP::UserAgent::_need_proxy: Not proxied LWP::UserAgent::send_request: http URLs are among LWP::UserAgent=HASH( +0x1fe594)'s allowed protocols (http https) LWP::Protocol::http::request: () LWP::UserAgent::send_request: CONNECT http://www.nodeworks.com:443 LWP::UserAgent::_need_proxy: Not proxied LWP::UserAgent::send_request: http URLs are among LWP::UserAgent=HASH( +0x1fe594)'s allowed protocols (http https) LWP::Protocol::http::request: () LWP::UserAgent::send_request: CONNECT http://www.nodeworks.com:443 LWP::UserAgent::_need_proxy: Not proxied LWP::UserAgent::send_request: http URLs are among LWP::UserAgent=HASH( +0x1fe594)'s allowed protocols (http https) LWP::Protocol::http::request: ()