httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Kukuchka" <chr...@sequoiagroup.com>
Subject Re: Module example to submit a muitipart/form-data
Date Fri, 15 Feb 2008 22:07:44 GMT
From: "Moacir Schmidt" moacir.schmidt@gmail.com


> Does anyone have an example of module to handle a mutipart/form-data
> submission that works with apache 2.2?


I am not sure what type of "handling" you are looking for.  However, here is the block my
module uses to pass the request content.  It adequately passes large POST content as well
as multipart/form-data.

if (ap_should_client_block(r)) {
    apr_size_t rsize, len_read, rpos=0, length = r->remaining;

    while ((len_read = ap_get_client_block(r, buf, AP_IOBUFSIZE)) > 0) {
        if ((rpos + len_read) > length ) {
            rsize = length - rpos;
        }
        else {
            rsize = len_read;
        }
        if ( (status = my_socket_send(r, sock, buf, &rsize))!=OK ) return status;
        rpos += rsize;
    }
}

HTH

Chris Kukuchka
Sequoia Group, Inc.



Mime
View raw message