From: Doug MacEachern Date: Thu, 14 Mar 2002 07:04:10 +0000 (+0000) Subject: PR: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=88951dbb45652e5bf40da735a3998b58d488c679;p=apache PR: Obtained from: Submitted by: Reviewed by: fix bug in ssl_io_input_getline(): in most cases we get all the headers on the first SSL_read. however, in certain cases SSL_read will only get a partial chunk of the headers, so we now try to read until LF is seen. bug seen with netscape client (running both on linux and win32) and server running on win32. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93931 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/ssl/ssl_engine_io.c b/modules/ssl/ssl_engine_io.c index 8d200d2c21..138cb4e5c4 100644 --- a/modules/ssl/ssl_engine_io.c +++ b/modules/ssl/ssl_engine_io.c @@ -674,16 +674,36 @@ static apr_status_t ssl_io_input_getline(ssl_io_input_ctx_t *ctx, char *buf, apr_size_t *len) { - const char *pos; + const char *pos = NULL; apr_status_t status; + apr_size_t tmplen = *len, buflen = *len, offset = 0; - status = ssl_io_input_read(ctx, buf, len); + *len = 0; - if (status != APR_SUCCESS) { - return status; + /* + * in most cases we get all the headers on the first SSL_read. + * however, in certain cases SSL_read will only get a partial + * chunk of the headers, so we try to read until LF is seen. + * / + + while (tmplen > 0) { + status = ssl_io_input_read(ctx, buf + offset, &tmplen); + + if (status != APR_SUCCESS) { + return status; + } + + *len += tmplen; + + if ((pos = memchr(buf, APR_ASCII_LF, *len))) { + break; + } + + offset += tmplen; + tmplen = buflen - offset; } - if ((pos = memchr(buf, APR_ASCII_LF, *len))) { + if (pos) { char *value; int length; apr_size_t bytes = pos - buf;