Can clients using http 1.0 or older use UDP sockets instead of TCP sockets?
I was wondering as to what could prevent such use apart from firewall issues and packet size limitations.开发者_如何学Python However, if that isn't a problem, is there anything else that prevents such use.
Also, have they been used traditionally?
From RFC 1945, "Hypertext Transfer Protocol -- HTTP/1.0", section 1.3, "Overall Operation":
On the Internet, HTTP communication generally takes place over TCP/IP connections. The default port is TCP 80 [15], but other ports can be used. This does not preclude HTTP from being implemented on top of any other protocol on the Internet, or on other networks. HTTP only presumes a reliable transport; any protocol that provides such guarantees can be used, and the mapping of the HTTP/1.0 request and response structures onto the transport data units of the protocol in question is outside the scope of this specification.
So, if you can implement a reliable transport over UDP then you can use HTTP. Of course, at that point you may as well use TCP instead of abusing datagrams.
精彩评论