Thanks for the reply Geoffrey.

I have updated the code to use $r->allow_methods rather than
$r->allowed per the documentation at:
http://perl.apache.org/docs/2.0/api/Apache2/Access.html#C_allow_methods_

Now additional methods are being included in the response, but the
reset boolean does not seem to completely reset the list of Allow
results.

$r->allow_methods(1, qw(PUT));
return Apache2::Const::DECLINED;
results in
Allow: GET,HEAD,POST,OPTIONS,PUT,TRACE
being returned to the client rather than
Allow: OPTIONS,PUT,TRACE

$r->allow_methods(1, qw(HEAD GET));
return Apache2::Const::DECLINED;
results in
Allow: GET,HEAD,POST,OPTIONS,TRACE
being returned to the client rather than maybe
Allow: HEAD,GET,OPTIONS,TRACE

So, this does not seem to be working as I would expect either.

And additional source of confusion is the fact that the documentation
(http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_allowed_)
about the $r->allowed() method states:
"This bitvector is used to construct the "Allow:" header required for
OPTIONS requests, and Apache2::Const::HTTP_METHOD_NOT_ALLOWED (405)
and Apache2::Const::HTTP_NOT_IMPLEMENTED (501) status codes."

Are the docs just wrong?

thanks,
Christopher

On 10/9/07, Geoffrey Young <[EMAIL PROTECTED]> wrote:
>
>
> Christopher Stanton wrote:
> > I am trying to set the allowed bitmask in a custom request handler
> > when I receive the OPTIONS method (and when I receive a method request
> > for a method I do not support).
> >
> > I have followed the example in
> > http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_allowed_
> > but Apache always returns "Allow: GET,HEAD,POST,OPTIONS,TRACE" in the
> > header irrespective of what options I set.
> >
> > For example, lets say I only accept PUT to try to restrict the
> > available options to OPTIONS, TRACE, and PUT.
> >
> > I have tried both
> > $r->allowed($r->allowed | (1<< Apache2::Const::M_PUT));
> > and
> > $r->allowed(1<<Apache2::Const::M_PUT);
> > with a return of Apache2::Const::DECLINED in either case in my handler.
> >
> > Neither ends up modifying the supported options sent to the client.
> >
> > In tha handler if I print the return value of $r->allowed:
> > print $r->allowed(1<<Apache2::Const::M_PUT) . "\n";
> > print $r->allowed() . "\n";
> > return Apache2::Const::DECLINED;
> >
> > I get:
> > 1
> > 2
> >
> > So the record is being updated, but for some reason Apache is not
> > basing its response to the client off of the record.
> >
> > Can anyone provide any insight into why I am unable to modify the list
> > of request methods my handler is capable of servicing?
>
> the Allow header appears to be built not from r->allowed but
> r->allowed_methods->method_mask.  so, try this:
>
> http://perl.apache.org/docs/2.0/api/Apache2/Access.html#C_allow_methods_
>
> HTH
>
> --Geoff
>

Reply via email to