httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip M. Gollucci" <pgollu...@p6m7g8.com>
Subject Re: Setting new POST_MAX or MAX_BODY
Date Fri, 15 Sep 2006 04:13:27 GMT
Boysenberry Payne wrote:
> I used:
> 
> APREQ2_ReadLimit 500000000
> 
> hopefully as only a temporary solution.
> 
> I need to be able to set the ReadLimit dynamically
> if at all possible.  Is it?
By default,
read_limit is initialized to APREQ_DEFAULT_READ_LIMIT

include/apreq.h:#define APREQ_DEFAULT_READ_LIMIT        (64 * 1024 * 1024)

You can change this via
 AP_INIT_TAKE1("APREQ2_ReadLimit", apreq_set_read_limit, NULL, OR_ALL,
                  "Maximum amount of data that will be fed into a parser."),

in httpd.conf

At run time, you can do change this per request like so:
in PERL:
	my $req = APR::Request::Custom->handle($pool,
                                 $query_string,
                                 $cookie_header,
                                 $parser,
                                 $read_limit,
                                 $brigade)

or:
	(standard or custom)
 	my $limit = $req->read_limit()
 	$req->read_limit($set)

see for example:
	t/response/TestApReq/request.pm
	t/response/TestAPI/module.pm

in C land:
static apr_status_t apache2_read_limit_set, apr_uint64_t bytes)
static apr_status_t apache2_read_limit_get(apreq_handle_t *handle, apr_uint64_t *bytes)

There is one small catch whether you set it via PERL or C since the C functions are glued
via XS to make the PERL ones.

It is only SET if and only if  -- this particular issue was asked on the list before.

  if (ctx->read_limit > bytes && ctx->bytes_read < bytes) {
        ctx->read_limit = bytes;
        return APR_SUCCESS;
  }

The only thing that circumvents that check is the httpd.conf APREQ2_ReadLimit variable.

HTH

-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

"In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night."
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /
 / /|_/ / // /\ \/ /_/ / /__
/_/  /_/\_, /___/\___\_\___/
       <___/

Mime
View raw message