http

Is HTTP/1.1 full duplex?


I was wondering whether anyone can provide a convincing explanation about whether HTTP/1.1 is half duplex or full duplex in the context of pipelining.

As far as I understand, multiple requests can be sent over the same persistent connection before the client gets the response. Does that mean that the server can respond to the previous request while the client sends a new request?


Solution

  • Let's have a look at the standard, in this case RFC-2616. There we find in paragraph 8.1.1, Persistent connections:

      - HTTP requests and responses can be pipelined on a connection.
        Pipelining allows a client to make multiple requests without
        waiting for each response, allowing a single TCP connection to
        be used much more efficiently, with much lower elapsed time.
    

    and a bit later in the document:

    8.1.2.2 Pipelining
    
       A client that supports persistent connections MAY "pipeline" its
       requests (i.e., send multiple requests without waiting for each
       response). A server MUST send its responses to those requests in the
       same order that the requests were received.
    

    As in both cases it's clearly stated that the client can send requests without waiting for a response, I think it's safe to state that HTTP 1.1 supports full-duplex.

    EDIT: in RFC-7230, part of the RFC set that replaces RFC-2616, this statement becomes:

    A client that supports persistent connections MAY "pipeline" its
    requests (i.e., send multiple requests without waiting for each
    response).  A server MAY process a sequence of pipelined requests in
    parallel if they all have safe methods (Section 4.2.1 of [RFC7231]),
    but it MUST send the corresponding responses in the same order that
    the requests were received.