Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is HTTP 1.1 Full duplex?

Tags:

http

wondering whether any one can provide a convincing explanation about the whether HTTP 1.1 is half duplex or full duplex in the context of pipelining? As far as I understand,multiple requests can be send over the same persistent connection before the client gets the response. So does that mean that server can respond for the previous request while client sends a new request?

like image 761
akd Avatar asked May 02 '14 01:05

akd


People also ask

Is HTTP 1.1 bidirectional?

If we take as endpoints "client" and "server" (no matter how many TCP connections between the two), then obviously both HTTP/1.1 and HTTP/2 are full duplex. If we take as endpoints the two ends of a single TCP connection between client and server, again both HTTP/1.1 and HTTP/2 are - in general - full duplex.

How do you know if its half or full-duplex?

A half-duplex transmission could be considered a one-way street between sender and receiver. Full-duplex, on the other hand, enables two-way traffic at the same time. A communications channel can be used to communicate one way at a time or in both directions at once.

Are WebSockets full-duplex?

WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011. The current API specification allowing web applications to use this protocol is known as WebSockets.

What is the example of full-duplex?

Simultaneous transmission of data is enabled between connected systems. The most familiar example of a full-duplex communication channel is telephony, where both participants in a call can send and receive audio simultaneously.


3 Answers

HTTP is request-response protocol. The client sends request. The server waits till the complete request is received. Then sends a response. The client and server cannot send simultaneously.

Full Duplex channel implies that client and server can send data simultaneously. Phone lines are example of Full Duplex. To achieve full duplex in Web, Web sockets is the recommended standard. Once a Web socket connection is established, both parties can exchange messages simultaneously. Web sockets work on top of TCP and does not use the HTTP protocol.

like image 79
vijayst Avatar answered Dec 15 '22 21:12

vijayst


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.
like image 30
fvu Avatar answered Dec 15 '22 22:12

fvu


Most implementations do allow full-duplex HTTP (for 2xx responses).

A formal discussion can be found at

https://datatracker.ietf.org/doc/html/draft-zhu-http-fullduplex

like image 43
Wenbo Zhu Avatar answered Dec 15 '22 20:12

Wenbo Zhu