Hi all,

I've written a web app as a single mod_perl handler. I started writing
my forms so they would do a POST and GET simultaneously. I did this by
making the form method=POST  action="/job_details?job=65" for example.
Now I notice that IE and Netscape do a POST and GET request every time
the form is submitted (so I'm logging two requests for the same URI and
Mime type for each form submission. The first is GET and the second is
POST). My problem is that the data returned to the browser is from the
GET request. The page that is generated has content that is affected by
the POSTed data, but this is only visible on a refresh of the same page.

I've done tests with Netscape and IE. I consistently have this problem
with Netscape, and with IE it works most of the time, but approximatelly
every 20 requests, I'll get a page that is generated from the GET data,
not the POSTed data.

I've included a source snippit from my handler below. If anyone has seen
this before, I'd appreciate any help! (I scoured the guide and archive.
I'm really sorry if I missed it!)

--snip--
sub handler
{
        my $r = Apache::Request->new(shift @_);
        $r->log_error("Request being handled: " . $r->content_type() . "
- " . $r->uri() . " - " . $r->method());
        #We dont want to handle image, CSS or javascript requests
        if($r->content_type() =~ m/(^image|^text\/css|javascript)/)
        {
                return DECLINED;
        }
        my $dbh = FUtil::connect_database();
--end snippet--

And the error log shows:
[Sun Oct  7 23:05:38 2001] [error] Request being handled:  -
/job_details - GET
[Sun Oct  7 23:05:38 2001] [error] Request being handled:  -
/job_details - POST
[Sun Oct  7 23:05:38 2001] [error] Request being handled: text/css -
/style.css - GET
[Sun Oct  7 23:05:38 2001] [error] Request being handled:
application/x-javascript - /js.js - GET

The form HTML tag that did this was:
<form action="http://www.freeusall.com/job_details?job=61"; method=POST
name="hotlist_form_jd_61">
This is doing a POST and GET.

Reply via email to