Hypertext Transfer Protocol (HTTP) uses a client-request/server-response model. HTTP is a stateless protocol, which means it does not require the server to retain information or status about each user for the duration of multiple requests. However, for performance reasons and to avoid TCP' connection-latency issues, techniques like Persistent, Parallel or Pipelined connections may be used.
HTTP/1.1 defines a number of numeric HTTP status codes that appear in the status line - the first line of an HTTP response - to summarise what the client should do with the response.
The first digit of a status codes defines the response’s class:
1xx
Informational2xx
Client request successful3xx
Request redirected - further action necessary, such as a new request4xx
Client error - do not repeat the same request5xx
Server error - maybe try againIn practice, it is not always easy to choose the most appropriate status code.
The CONNECT
method is reserved by the method definitions specification for use with proxies that are able to switch between proxying and tunneling modes (such as for SSL tunneling).
Basic Authentication is defined in RFC2617. It can be used to authenticate against the origin server after receiving a 401 Unauthorized
as well as against a proxy server after a 407 (Proxy Authentication Required)
. In the (decoded) credentials, the password starts after the first colon. Therefore the username cannot contain a colon, but the password can.
Responses are cached separately for each URL and each HTTP method.
HTTP caching is defined in RFC 7234.
Vary
header, etc.If-Modified-Since
or If-None-Match
and response status 304
.HTTP APIs use a wide spectrum of HTTP verbs and typically return JSON or XML responses.
Cross-origin resource sharing is designed to allow dynamic requests between domains, often using techniques such as AJAX. While the scripting does most of the work, the HTTP server must support the request using the correct headers.