Re: <FORM action="script" method="post"> calls "script" TWICE!!!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2008-06-19 at 23:45 +0000, Kanito 73 wrote:
> Hi
> 
> I have a very strange problem!!! sending a <FORM> to my apache server
> results in duplicate execution of (action=)script, the first one the
> sript receives the full variables, the second "ghost" call to the
> script is with NO VARIABLES just the script is executed again with
> empty data!!!

Believe it or not, I've actually seen this behavior before, though there
is no guarantee that the cause is the same for you.

I found that certain browser versions tried to do an HTTP HEAD request
on the script page, and that I needed to explicitly have the script
check for whether the request was GET, POST, or HEAD and behave
accordingly.

Not all browsers did this. I observed it mostly with older versions, and
haven't seen it recently.

The other possibility where I've seen this is that someone might have
the URL for "script" in a cache or bookmark and might access it with a
GET request.

Take a look at your Apache logs and see what kind of HTTP transactions
are hitting your script, whether they are GET, POST, or HEAD. In most
scripting languages you can query an environment variable to find out
which method is in use, and your script can react accordingly. For HEAD
it may just want to return a sensible raw HTTP response, whereas with
GET you probably want to send an HTTP redirect to the page where the
user fills out the form, rather than the page where they are sent when
the form is submitted.

To do HTTP responses directly, you will need to take more control of the
HTTP transaction than what is the default mode in some scripting
languages. The mechanisms for doing this depend on your choice of
scripting language, and some languages have more than one way to do
this.

Hope this helps.

Kind regards,

Scott

-- 
Scott Courtney <scourtney@xxxxxxxxxxxxxx>
Sine Nomine Associates


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux