Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.1
    • Component/s: core
    • Labels:
      None

      Description

      In HTTP/1.1 any method may include a request body, whereas in HTTP/1.0 only POST and PUT were allowed to. To avoid any potential problems if a handler were trying to emulate in part the default Apache handler for requests, in would be appropriate for a handler to ensure that any request body is discarded. Apache provides a function specifically for this purpose which is called ap_discard_request_body(). For completeness this function should be available in the request object API as req.discard_request_body().

        Activity

        Hide
        grahamd Graham Dumpleton added a comment -

        Here is the prototype and documentation:

        /**

        • In HTTP/1.1, any method can have a body. However, most GET handlers
        • wouldn't know what to do with a request body if they received one.
        • This helper routine tests for and reads any message body in the request,
        • simply discarding whatever it receives. We need to do this because
        • failing to read the request body would cause it to be interpreted
        • as the next request on a persistent connection.
        • @param r The current request
        • @return error status if request is malformed, OK otherwise
          */
          AP_DECLARE(int) ap_discard_request_body(request_rec *r);

        Note that by rights, mod_python.publisher and mod_python.psp should both call this method for GET requests. As pointed out in documentation above, if it didn't and GET request contained content then not discarding it can stuff up a following request if a persistent connection is used and multiple requests are pipelined.

        Show
        grahamd Graham Dumpleton added a comment - Here is the prototype and documentation: /** In HTTP/1.1, any method can have a body. However, most GET handlers wouldn't know what to do with a request body if they received one. This helper routine tests for and reads any message body in the request, simply discarding whatever it receives. We need to do this because failing to read the request body would cause it to be interpreted as the next request on a persistent connection. @param r The current request @return error status if request is malformed, OK otherwise */ AP_DECLARE(int) ap_discard_request_body(request_rec *r); Note that by rights, mod_python.publisher and mod_python.psp should both call this method for GET requests. As pointed out in documentation above, if it didn't and GET request contained content then not discarding it can stuff up a following request if a persistent connection is used and multiple requests are pipelined.
        Hide
        grahamd Graham Dumpleton added a comment -

        New function added, but decision as to whether this function should be called by mod_python.publisher and mod_python.psp for a GET request defered to another time and to be dealt with as separate issue if need be.

        Show
        grahamd Graham Dumpleton added a comment - New function added, but decision as to whether this function should be called by mod_python.publisher and mod_python.psp for a GET request defered to another time and to be dealt with as separate issue if need be.

          People

          • Assignee:
            grahamd Graham Dumpleton
            Reporter:
            grahamd Graham Dumpleton
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development