gregaiken has asked for the wisdom of the Perl Monks concerning the following question:
I recently discovered Makino Takaki's boilerplade Perl proxy program (http://www.snowelm.com/~t/doc/tips/simple-proxy.en.html). I found this code to be relatively straight forward to use for the purpose of better understanding this mechanism and to experiment with.
i've added a few lines of my own code to this boilerplate program, and am having trouble getting...
$c->send_redirect("file:///C:/http_proxy_server/log.html", 303)to work as I'm wanting it to work. according to documentation, above command redirects the client to a new url, and the HTTP header code set to (in this case) 303 (meaning 'See Other'). when my Perl proxy is running, I am wanting to use it in a fun way (where I can send it 'commands' - encoded as URL get requests).
with my web browser viewing a local file 'log.html' file (which contains many HTML forms). When I click one particular form, the form sends a get request like this 'http://proxycommand.code?function=AppendNewRecordToLogHtmlFile&newrecord=helloworld' to my Perl proxy server.
my proxy program can then search the requested URL to see if it contains 'proxycommand.code'. if so, it then parses the GET query string to discover the special function I want my proxy to execute. In this case, the special function is to append a new record to the 'log.html' file, where the new record is 'hello world'.
in my code, im able to successfully append the new record to 'log.html'. i sleep for a few seconds. i then send the above Perl command to tell the browser to redisplay the newly modified 'log.html' file
in the chrome web browser, the browser itself is satisfied that its received a wellformed HTTP reply, the address field of the browser does reflect the newly requested local file. but since the browser was previosly viewing the exact same file (prior to my clicking the form submit button) - perhaps some caching mechanism is preventing the browser from showing the newly added record at the bottom of the 'log.html' file. if i manually click the chrome browsers 'refresh' button - this causes the appended new record to display in the browser.
does anyone know why the browser is not displaying the newest version of the 'log.html' file? is this due to browser caching issues? if so, what is the solution? I would think this LWP-UserAGent module would automatically include a newer HTTP 'Date' header, but maybe its not, and i need to manually set this header myself? One website suggested setting a NON-standard HTTP header, 'Refresh: 1' which supposedly is used by most browsers but not an official part of RFC2616.
any help here would be appreciated, as i'm a little confused
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl HTTP proxy experts
by Anonymous Monk on Sep 17, 2014 at 18:57 UTC | |
by gregaiken (Initiate) on Sep 18, 2014 at 21:03 UTC | |
by Anonymous Monk on Sep 19, 2014 at 11:16 UTC | |
by gregaiken (Initiate) on Sep 19, 2014 at 21:09 UTC | |
|
Re: Perl HTTP proxy experts
by FloydATC (Deacon) on Sep 19, 2014 at 08:47 UTC |