Re: Setting new POST_MAX or MAX_BODY

"Philip M. Gollucci" <[email protected]>
Newsgroups gmane.comp.apache.apreq
Organization P6M7G8 Inc.
Message-ID <[email protected]>
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 ([email protected]) 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."
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /
 / /|_/ / // /\ \/ /_/ / /__
/_/  /_/\_, /___/\___\_\___/
       <___/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.