Commit 0f1d5677 authored by Doug MacEachern's avatar Doug MacEachern
Browse files

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/modules/ssl@93931 13f79535-47bb-0310-9956-ffa450edef68
parent 5df8c9f0
Loading
Loading
Loading
Loading
+22 −2
Changes for ssl_engine_io.c: 22 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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;

    /*
     * 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) {
        char *value;
        int length;
        apr_size_t bytes = pos - buf;