I have a module that saves a copy of the postdata in an input filter.  Here is 
how it works: In the ap_hook_fixups function, I check to see if I am interested 
in this request (examine url).  If yes, I then check if r->method_number == 
M_POST.  If yes, then I add my input filter function to capture the postdata.

All worked fine until someone did this:

conf:
<Directory "/test">
    DirectoryIndex index.php index.php3 index.html index.htm
</Directory>

index.htm:
<html><body>
<form action="" method="post">
  <input type="text" name="test"/>
  <input type="submit"/>
 </form>
</body></html>

Now, load the above page with http://localhost/test/ (NOTE, without index.htm), 
and then sumbit the form.  By the time I decided if I should add my input 
filter for index.htm, the test r->method_number == M_POST is false (it is a 
M_GET).

Some debugging showed that the "referer" header is not null in this case, so I 
modified the test from
r->method_number == M_POST 
to
r->method_number == M_POST || apr_table_get(r->headers_in, "Referer")

and in my input filter, I check to see if the 1st bucket is EOS before saving a 
copy of the postdata (because a non-null referer does not mean it is really a 
POST request.

Is this the right way?  I would like it to work on apaceh 2.*

Thanks
John



Reply via email to