On Thu, Apr 18, 2002 at 01:53:57PM -0700, Justin Erenkrantz wrote:
> On Thu, Apr 18, 2002 at 04:43:15PM -0400, Cliff Woolley wrote:
> > I think this matches the existing semantics, so it shouldn't be that big a
> > deal. HOWEVER, note that this patch causes two of the apache/limits.t
> > tests (7 and 9) to fail with an assertion pop, though I think this
> > represents a legitimate bug in Apache. Basically, the buckets code now
> > enforces the fact that you absolutely positively CANNOT access an mmap
> > bucket except to delete it after the apr_mmap_t in it gets cleaned up.
> >
> > --Cliff
> >
> >
> > This backtrace is from test 7 of limits.t:
>
> The backtrace looks like it is caused by the fact that ap_http_filter
> still calls ap_getline rather than ap_get_brigade. Patch coming.
> I have no idea why changes to the mmap would expose this. -- justin
Cliff, can you please test this patch? I still don't have httpd-test
working on my TiBook. -- justin
Index: modules/http/http_protocol.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.411
diff -u -r1.411 http_protocol.c
--- modules/http/http_protocol.c 17 Apr 2002 04:09:07 -0000 1.411
+++ modules/http/http_protocol.c 18 Apr 2002 21:08:00 -0000
@@ -831,10 +831,19 @@
/* We can't read the chunk until after sending 100 if required. */
if (ctx->state == BODY_CHUNK) {
char line[30];
+ apr_bucket_brigade *bb;
+ apr_size_t len = 30;
- if ((rv = ap_getline(line, sizeof(line), f->r, 0)) < 0) {
+ bb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
+
+ rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
+ APR_BLOCK_READ, 0);
+
+ if (rv != APR_SUCCESS) {
return rv;
}
+ apr_brigade_flatten(bb, line, &len);
+
ctx->remaining = get_chunk_size(line);
}
}
@@ -851,19 +860,27 @@
case BODY_CHUNK:
{
char line[30];
+ apr_bucket_brigade *bb;
+ apr_size_t len = 30;
- ctx->state = BODY_NONE;
+ bb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
/* We need to read the CRLF after the chunk. */
- if ((rv = ap_getline(line, sizeof(line), f->r, 0)) < 0) {
+ rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
+ APR_BLOCK_READ, 0);
+ if (rv != APR_SUCCESS) {
return rv;
}
+ apr_brigade_cleanup(bb);
/* Read the real chunk line. */
- if ((rv = ap_getline(line, sizeof(line), f->r, 0)) < 0) {
+ rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
+ APR_BLOCK_READ, 0);
+
+ if (rv != APR_SUCCESS) {
return rv;
}
- ctx->state = BODY_CHUNK;
+ apr_brigade_flatten(bb, line, &len);
ctx->remaining = get_chunk_size(line);
if (!ctx->remaining) {