like you, i initially thought this was a matter due to caching. i then changed my script to serve a file that has NEVER PREVIOUSLY been opened in the browser (to see if in fact, the client browser would request in response to the redirect HTTP headers). unfortunately, the file referenced in the HTTP redirect was NOT opened in the browser - so this tells me the problem has nothing to do with caching.

ive distilled the program down to its 'bare-bones' version to show the relevant code. this is not my actual program, but only serves to demonstrate the problem.

use HTTP::Daemon; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); my $d = HTTP::Daemon->new( LocalHost => "localhost", # remove this to listen from other + machines # (i.e. open-relay... be careful o +f spammers!) LocalPort => 8888 #always best to run 'netstat -ano | fi +nd "8888"' prior to running this command (to find an unused port) ) || die; #after this program is launched ru +n again 'netstat -ano | find "8888"' to confirm this port is now bein +g bound to this program #then to actually use this with a +browser must go to browsers proxy setting (a global windows setting): + set server=127.0.0.1 port=8888 #main 'accept-getrequest-process' loop is the next two lines while (my $c = $d->accept) { while (my $request = $c->get_request) { #we wish to send the web client browser a redirect to a local fi +le on his same machine #as a test of the nifty 'send_redirect' function #since this particular file has never before been opened in the +web browser #if it does NOT open/display in the client web browser #the fault for this can NOT be attributed to caching issues #unfortunately, when this proxy program is ran, and the computer + environment told to use this proxy #this page never displays in the client web browser window (i am + unsure as to why it does not display. #ive also tried various "300" codes, 301, 302,303, 307 with no c +hange in the result.) #because 'Wireshark' cant capture traffic thats on the localhost + (eg: not being sent out of the network card) #i have no way to 'view' the actual data being sent between the +client program and the proxy program (on Windows) $c->send_redirect("file:///C:/http_proxy_server/FileThatsNeverBe +foreBeenOpenedInTheBrowser_eg-NotCached.html", 303); } $c->close; undef($c); }

note because the client (browser app) and server (perl proxy server program) are both running on the same machine - this is particularly hard to troubleshoot as 'wireshark' does not capture any TCP packets that are not actually sent out of the network card. does anyone know how to monitor TCP/IP traffic sent/received to the 'localhost' only?


In reply to Re^2: Perl HTTP proxy experts by gregaiken
in thread Perl HTTP proxy experts by gregaiken

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.