Hi Monks.
I want to write a small proxy with the capable of logging requests and responses.

The basic and perhaps often seen scriptlet looks like

my $UA = LWP::UserAgent->new; $UA->agent("Mozilla/4.0"); $UA->protocols_allowed(['http','https']); my $SRV = HTTP::Daemon->new(LocalPort => 3128); print "Please contact me at: <URL:", $SRV->url, ">\n"; while (my $conn = $SRV->accept) { while (my $request = $conn->get_request) { my $resp = $UA->simple_request($request); $conn->send_response($resp); } $conn->close; }

On my system the modules Crypt::SSLeay, openssl package and IO::Net::SSL are installed.
If I define a request-object like

my $req = new HTTP::Request('GET', 'https://www.nodeworks.com');

or get one about the HTTP::Daemon

my $req = new HTTP::Request('CONNECT', 'http://www.nodeworks.com:443');

, only the first one works.

I've read something about patching the Daemon, other people choose the way to patch http.pm - Modules, but nothing seems to work.
What is to do now, or what do I wrong? I don't want low level programming, if anyone has samplecode, please post it.

Here are some Postings, I've studied and tried them out.
If we get it to work, perhaps we should write a small howto; during my inquest I found many people who was in the same situation with no satisfactory solution.

http://www.byte.com/documents/s=493/byt20010214s0005/index3.htm
http://www.perlmonks.org/index.pl?node_id=179922
http://groups.google.de/groups?q=perl+SSL+HTTP::Daemon&hl=de&lr=&ie=UTF-8&selm=3CB9EFAF.80809%40computer.org&rnum=1

Thanks in advance and
best regards,
Andreas


In reply to LWP, Proxy, SSL by niemeand

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.