Return-Path: Delivered-To: apmail-apache-bugdb-archive@apache.org Received: (qmail 66486 invoked by uid 500); 10 Oct 2000 15:50:11 -0000 Mailing-List: contact apache-bugdb-help@apache.org; run by ezmlm Precedence: bulk Reply-To: apache-bugdb@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list apache-bugdb@apache.org Received: (qmail 66431 invoked by uid 501); 10 Oct 2000 15:50:04 -0000 Resent-Date: 10 Oct 2000 15:50:04 -0000 Resent-Message-ID: <20001010155004.66430.qmail@locus.apache.org> Resent-From: gnats-admin@bugz.apache.org (GNATS Management) Resent-To: apache-bugdb@apache.org Resent-Cc: apache-bugdb@apache.org Resent-Reply-To: gnats-admin@bugz.apache.org, Jim.Patterson@Cognos.COM Received: (qmail 62969 invoked by uid 501); 10 Oct 2000 15:48:21 -0000 Message-Id: <20001010154820.62931.qmail@locus.apache.org> Date: 10 Oct 2000 15:48:20 -0000 From: Jim Patterson Reply-To: Jim.Patterson@Cognos.COM To: submit@bugz.apache.org X-Send-Pr-Version: 3.110 Subject: general/6650: POST request puts server in hard loop >Number: 6650 >Category: general >Synopsis: POST request puts server in hard loop >Confidential: no >Severity: critical >Priority: medium >Responsible: apache >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Tue Oct 10 08:50:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Jim.Patterson@Cognos.COM >Release: 2.0a7 >Organization: apache >Environment: Windows 2000 Pro SP1 Visual C++ 5.0 SP2 >Description: When I run a CGI command triggered through a form using POST method, the Apache server goes into a hard loop and must be terminated. >How-To-Repeat: Create a page that has an embedded FORM specifying METHOD=POST and an ACTION that runs a CGI application on the server. Run the form and click on its SUBMIT button, so as to invoke the CGI application using POST method. The server will hang waiting for input. At this point click on STOP in the browser. Now, the server enters a different phaase in which it loops with all available CPU being utilized. Here is a sample document - I don't think the CGI program is relevant because it won't be called. Test POST problem

>Fix: The problem is in main/http_core.c . With a POST request, there usually isn't a trailing linefeed so the "while" loop won't end. The change here skips the follow-up reads if the buffer read so far already contains a linefeed as it will for a well formed POST request. It also checks the return status from apr_recv to detect a disconnect or other errors. It could be optimized better for the usual GET case. *** http_core.c-orig Tue Oct 10 11:10:56 2000 --- http_core.c Tue Oct 10 11:23:20 2000 *************** *** 3309,3317 **** if (rv == APR_SUCCESS) { if (length > 0) { templen = length - 1; ! while (buff[templen] != ASCII_LF) { ! rv = apr_recv(csock, buff + templen + 1, &length); ! templen += length; } /* This should probably be a pool bucket, but using a transient is --- 3309,3321 ---- if (rv == APR_SUCCESS) { if (length > 0) { templen = length - 1; ! if (memchr(buff, ASCII_LF, length) == NULL) { ! while (buff[templen] != ASCII_LF) { ! rv = apr_recv(csock, buff + templen + 1, &length); ! if (rv != APR_SUCCESS) ! break; ! templen += length; ! } } /* This should probably be a pool bucket, but using a transient is >Release-Note: >Audit-Trail: >Unformatted: [In order for any reply to be added to the PR database, you need] [to include in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]