HTTP (hypertext Transfer Protocol), Hypertext Transfer Protocol, is an application-layer protocol that is established but not limited to TCP (transmission Control Protocol) transmission protocol.
Features of http:
1, stateless: is a stateless protocol, meaning no transaction processing capacity
2. No connection: Only one request can be processed at a time
3, simple and fast: the request simply transmits the path and the method, the protocol is simple
4, Flexible: Transmission data type is rich, according to Content-type definition
5. Support Server/Client mode:
HTTP request Method:
Get request gets the resource identified by the Request-uri
Post appends new data to the resource identified by Request-uri
PUT Request server stores a resource and uses Request-uri as its identity
Delete Request server deletes the resource identified by the Request-uri
HEAD request Gets the response message header for the resource identified by Request-uri
TRACE requests the server to echo received request information, primarily for testing or diagnostics
CONNECT reserved for future use
Options request the performance of the query server, or query for resource-related choices and requirements
HTTP request Format:
Contains three parts: the request header, the message header, the request body
The request line begins with a method symbol, separated by a space, followed by the requested URI and version of the Protocol, in the following format: Method Request-uri http-version CRLF
Where method represents the request approach; Request-uri is a Uniform resource identifier; Http-version represents the HTTP protocol version of the request; CRLF indicates carriage return and newline (except for the CRLF at the end, a separate CR or LF character is not allowed)
HTTP response:
Common status codes, status descriptions, descriptions:
$ OK//client request succeeded
Bad Request//client requests have syntax errors and cannot be understood by the server
401 Unauthorized//request unauthorized, this status code must be used with the Www-authenticate header field
403 Forbidden//server receives request, but refuses to provide service
404 Not Found//request resource not present, eg: Wrong URL entered
Internal Server error//server unexpected errors
503 Server Unavailable//server is currently unable to process client requests and may return to normal after some time
eg:http/1.1 OK (CRLF)
Request and return Examples:
Reference article: http://blog.csdn.net/gueter/article/details/1524447
HTTP protocol Summary