Protocol¶
[common]\ enum Protocol : Enum<Protocol>
Protocols that OkHttp implements for ALPN selection.
Protocol vs Scheme¶
Despite its name, java.net.URL.getProtocol returns the java.net.URI.getScheme (http, https, etc.) of the URL, not the protocol (http/1.1, spdy/3.1, etc.). OkHttp uses the word protocol to identify how HTTP messages are framed.
Entries¶
HTTP_1_0 | [common] HTTP_1_0 An obsolete plaintext framing that does not use persistent sockets by default. |
HTTP_1_1 | [common] HTTP_1_1 A plaintext framing that includes persistent connections. |
HTTP_2 | [common] HTTP_2 The IETF’s binary-framed protocol that includes header compression, multiplexing multiple requests on the same socket, and server-push. HTTP/1.1 semantics are layered on HTTP/2. |
H2_PRIOR_KNOWLEDGE | [common] H2_PRIOR_KNOWLEDGE Cleartext HTTP/2 with no "upgrade" round trip. This option requires the client to have prior knowledge that the server supports cleartext HTTP/2. |
QUIC | [common] QUIC QUIC (Quick UDP Internet Connection) is a new multiplexed and secure transport atop UDP, designed from the ground up and optimized for HTTP/2 semantics. HTTP/1.1 semantics are layered on HTTP/2. |
HTTP_3 | [common] HTTP_3 HTTP/3 is the third and upcoming major version of the Hypertext Transfer Protocol used to exchange information. HTTP/3 runs over QUIC, which is published as RFC 9000. |
Types¶
Name | Summary |
---|---|
Companion | [common] object Companion |
Functions¶
Name | Summary |
---|---|
toString | [common] open override fun toString(): String Returns the string used to identify this protocol for ALPN, like "http/1.1", "spdy/3.1" or "h2". |
Properties¶
Name | Summary |
---|---|
name | [common] val name: String |
ordinal | [common] val ordinal: Int |