httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pelikan Stephan" <s.peli...@apa.at>
Subject POST-data in multiple states of a request
Date Wed, 18 Dec 2002 07:38:23 GMT
Hi,

I wrote several Apache-modules which use formular-field's data
and use libapreq and Apache::Request to handle those data. This
modules are concatinated in the same request during different
request-phases.

This works fine as long as I use the GET-method because the
formular's data are store permanently in the request-record and
can be extracted by every new generated object. Sometimes it is
necessary to do a POST-request and you know what happens: The
first object retrieves the data and all other modules get nothing.

So I did a patch and I hope you may include it into the source:

c/apache_request.c:

ApacheRequest *ApacheRequest_new(request_rec *r)
{
    ApacheRequest *req=0;
    char tmp[50];

    const char *ereq = ap_table_get(r->notes, "ApacheRequestAddress");
    if ((sscanf(ereq, "%p", &req)) != EOF) return req;

    req = (ApacheRequest *) ap_pcalloc(r->pool, sizeof(ApacheRequest));
    req->status = OK;
    req->parms = ap_make_table(r->pool, DEFAULT_TABLE_NELTS);
    req->upload = NULL;
    req->post_max = -1;
    req->disable_uploads = 0;
    req->upload_hook = NULL;
    req->hook_data = NULL;
    req->temp_dir = NULL;
    req->parsed = 0;
    req->r = r;

    sprintf(tmp, "%p", (void *) req);
    ap_table_set(r->notes, "ApacheRequestAddress", tmp);

    return req;
}

My trick is to return always the same object by storing the
object's address in the request's notes. If it is there it will
be returned otherwise the object will be created.

I hope this is not "too dirty", but it works really fine and it is
well-proven for more than 1 year. What do you think about it?

regards,

Stephan

Mime
View raw message