Skip to content

do_httpx3: GET request has body #491

@EnDe

Description

@EnDe

The generated request message in do_httpx3() ends with two CRNL. This causes some servers to reject the connection and return nothing (TCP reset).
RFC 2616 defines exactly one CRNL between message header and body, means that the second CRNL becomes the message body. Many (most?) servers don't care about data in the body, but some seem to follow RFC 7231, see GET where we read:

A payload within a GET request message has no defined semantics;
sending a payload body on a GET request might cause some existing
implementations to reject the request.

This behaviour results in an undefined content in do_httpx3() because nothing is returned from the server.

I'd suggest following patch:

index 3838b59..9dac6a2 100644
--- a/SSLeay.pm
+++ b/SSLeay.pm-1.94-do_httpx3-patch
@@ -1782,7 +1782,7 @@ sub do_httpx3 {
        $content = "Content-Type: $mime_type$CRLF"
            . "Content-Length: $len$CRLF$CRLF$content";
     } else {
-       $content = "$CRLF$CRLF";
+       $content = "$CRLF";
     }
     my $req = "$method $path HTTP/1.0$CRLF";
     unless (defined $headers && $headers =~ /^Host:/m) {

See also issue #490

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions