Hi,

[This may turn out to be an Apache only question, please let me know if so.]

Ok, I know that I can only read POSTed content once.  But I can't 
understand why in the code below I need to convert POST to GET, otherwise 
the process will get stuck on return.  However, if I replace 
..UNSUPPORTED... with OK (and send some headers), the code works just fine.

The only reason I can think it gets stuck is that after the handler 
returns, Apache goes on calling another handler (default-handler?, I don't 
have any others) which attempts to read the POSTed content.

I thought any return code except for DECLINED should terminate a handler 
walk ("If a handler returns DECLINED, Apache moves on the next module in 
the list" [Eagle, p. 77]).

Thanks

Hers's the code:


package Apache::AModule;

use strict;
use Apache::Constants;

sub handler
{
    my $r = shift;

    my $data;

    warn( 'Reading in: '.$r->header_in('Content-length').' bytes' );
    $r->read( $data, $r->header_in('Content-length') );

    $r->method("GET");
    $r->method_number(M_GET);
    $r->headers_in->unset("Content-length");

    return Apache::Constants::HTTP_UNSUPPORTED_MEDIA_TYPE();
}

1;
---
Dmitry Beransky
Programmer/Analyst

University of California, San Diego
Multimedia Interactive Learning Lab (http://mill.ucsd.edu)

Reply via email to