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: ()
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|