From 29aec5a92cdd6149adc147a0fc135661055993c8 Mon Sep 17 00:00:00 2001 From: Justin Erenkrantz Date: Sun, 20 Jan 2002 11:43:37 +0000 Subject: [PATCH] Make core_input_filter use the new apr_brigade_split_line function. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92944 13f79535-47bb-0310-9956-ffa450edef68 --- server/core.c | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/server/core.c b/server/core.c index 19c05c7495..713c2716ec 100644 --- a/server/core.c +++ b/server/core.c @@ -3167,40 +3167,19 @@ static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, } /* we are reading a single LF line, e.g. the HTTP headers */ - while (!APR_BRIGADE_EMPTY(ctx->b)) { - const char *pos; - - e = APR_BRIGADE_FIRST(ctx->b); - rv = apr_bucket_read(e, &str, &len, block); - - /* We should treat EAGAIN here the same as we do for EOF (brigade is - * empty). We do this by returning whatever we have read. This may - * or may not be bogus, but is consistent (for now) with EOF logic. - */ - if (APR_STATUS_IS_EAGAIN(rv)) { - break; - } - else if (rv != APR_SUCCESS) { - return rv; - } + rv = apr_brigade_split_line(b, ctx->b, block, HUGE_STRING_LEN); + /* We should treat EAGAIN here the same as we do for EOF (brigade is + * empty). We do this by returning whatever we have read. This may + * or may not be bogus, but is consistent (for now) with EOF logic. + */ + if (APR_STATUS_IS_EAGAIN(rv) || rv == APR_SUCCESS) { + apr_off_t total; - pos = memchr(str, APR_ASCII_LF, len); - /* We found a match. */ - if (pos != NULL) { - apr_bucket_split(e, pos - str + 1); - APR_BUCKET_REMOVE(e); - APR_BRIGADE_INSERT_TAIL(b, e); - *readbytes += pos - str; - return APR_SUCCESS; - } - APR_BUCKET_REMOVE(e); - APR_BRIGADE_INSERT_TAIL(b, e); - *readbytes += len; - /* We didn't find an APR_ASCII_LF within the predefined maximum - * line length. */ - if (*readbytes >= HUGE_STRING_LEN) { - break; - } + apr_brigade_length(b, 1, &total); + *readbytes = total; + } + else { + return rv; } return APR_SUCCESS; -- 2.40.0