On 02/02/2008 09:14 PM, Ruediger Pluem wrote:

On 02/02/2008 07:08 PM, Nick Kew wrote:

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

So you think of something like this (ok, no enum, but similar):

#define METHOD_NON_IDEMPOTENT       0
#define METHOD_IDEMPOTENT           1
#define METHOD_IDEMPOTENT_WITH_ARGS 2

static int is_idempotent(request_rec *r)
{
    /*
     * 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:
            /*
             * If the request has arguments it might have side-effects and thus
             * it might be undesirable to resent it to a backend again·
             * automatically.
             */
            if (r->args) {
                return METHOD_IDEMPOTENT_WITH_ARGS;
            }
            return METHOD_IDEMPOTENT;
        /* Everything else is not considered idempotent. */
        default:
            return METHOD_NON_IDEMPOTENT;
    }
}

Ok, committed as r627097.


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


I know of none currently, but I assume that at least in mod_proxy(_http) the
need for this test will rise, once we try to finally solve the race problem in
mod_proxy_http when it sends a request over a connection that is closed just
at this moment.

Ping, WDYT now? core or proxy_util?

Regards

Rüdiger

Reply via email to