httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <n...@webthing.com>
Subject Re: idempotent http methods (svn commit: r617822)
Date Sat, 02 Feb 2008 18:08:49 GMT
On Sat, 02 Feb 2008 16:35:40 -0000
rpluem@apache.org wrote:


> +static int is_idempotent(request_rec *r)
> +{
> +    /*
> +     * If the request has arguments it might not be idempotent as it
> might have
> +     * side-effects.
> +     */
> +    if (r->args) {
> +        return 0;
> +    }

That breaks RFC compliance, as soon as someone uses it to test
idempotence.

> +    /*
> +     * RFC2616 (9.1.2): GET, HEAD, PUT, DELETE, OPTIONS, TRACE are
> considered
> +     * idempotent. Hint: HEAD requests use M_GET as method number as
> well.
> +     */
> +    switch (r->method_number) {
> +        case M_GET:
> +        case M_DELETE:
> +        case M_PUT:
> +        case M_OPTIONS:
> +        case M_TRACE:
> +            return 1;
> +        /* Everything else is not considered idempotent. */
> +        default:
> +            return 0;
> +    }
> +}

Suggested solution: an enum, with a third value for an idempotent
method with arguments.  The caller then determines how to use it.

That's in response to your post to dev@.  OTTOMH it seems to me
to work as a core function.  How many existing handlers apply
an equivalent test?

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

Mime
View raw message