httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Moacir Schmidt" <>
Subject Re: ap_get_brigade hangs when submitting a muitipart/form-data
Date Thu, 14 Feb 2008 22:02:33 GMT
Thanks for your replay, Jarek. Unfortunately, ap_get_client_block was used
on my module's first version (currently version is named t02.c because
of this, eh eh). On my initial researchs I figured out that
ap_get_client_block is implemented using ap_get_brigade (as  you can see on
http_filters.c, ). I've read some apache developers public
messages suggesting that the ap_get_client_block could be deprecated in the
future. Then I decided to try another implementation using ap_get_brigades
hoping that the problem could be solved. Unfortunately, first version hangs
exactly as second one did.

Anyway, i'm posting the first version using ap_get_client_block that has
exactly the same problem:
#include <httpd.h>
#include <http_protocol.h>
#include <http_config.h>
static int helloworld_handler(request_rec* r)
  int rc;
  if (!r->handler || strcmp(r->handler, "helloworld"))
    return DECLINED;
  ap_set_content_type(r, "text/html;charset=ascii"); // debug purposes
  if ((rc=ap_setup_client_block(r, REQUEST_CHUNKED_ERROR))!=OK) {
    return rc;
  if (ap_should_client_block(r)) {
    char argsbuf[HUGE_STRING_LEN];
    int rsize, len_read, rpos=0;
    long length = r->remaining;
    char buf[45000];
    while ((len_read=ap_get_client_block(r,argsbuf,sizeof(argsbuf))) > 0) {
      if ((rpos+len_read) > length) {
        rsize =  length-rpos;
      } else {
        rsize = len_read;
      memcpy((char *)buf+rpos,argsbuf,rsize);
      rpos += rsize;
      ap_rputs(buf,r); // debug purposes
  return OK;
static void register_hooks(apr_pool_t* pool)
  ap_hook_handler(helloworld_handler, NULL, NULL, APR_HOOK_MIDDLE);
module AP_MODULE_DECLARE_DATA helloworld_module = {

On Thu, Feb 14, 2008 at 5:14 PM, Jarek Kucypera <>

> > I don't know if there is something wrong with my code or if there is
> > some bug on ap_get_brigade function. Any help will be very appreciate!
> >
> ap_get_brigade is designed to be used in input filters.
> If you want read request data in your content handler,
> you must use ap_should_client_block and ap_get_client_block.
> Regards,
> J.K.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message