Hypertext Transfer Protocol
- It is a request-response protocol between a client and server.
HTTP Messages
HTTP-message = <request> | <response> ; HTTP/1.1 messages
HTTP Requests and Responses
# HTTP requests and responses use the generic format # consists of the following four items. * Start-line = Request-Line | Status-Line * Zero or more header fields followed by CRLF (return) * An empty line (indicating the end of the header fields * Optionally a message-body # Example Request-Line = "GET /hello.htm HTTP/1.1" Status-Line = "HTTP/1.1 200 OK"
HTTP Request Methods
- GET
- GET requests can be cached
- GET requests remain in the browser history
- GET requests can be bookmarked
- GET requests should never be used when dealing with sensitive data
- GET requests have length restrictions
- GET requests should be used only to retrieve data
- POST
- POST requests are never cached
- POST requests do not remain in the browser history
- POST requests cannot be bookmarked
- POST requests have no restrictions on data length
- HEAD
- PUT
- DELETE
- OPTIONS
- CONNECT
/test/demo_form.asp?name1=value1&name2=value2
POST /test/demo_form.asp HTTP/1.1 Host: w3schools.com name1=value1&name2=value2
HTTP Message Header Fields
message-header = field-name ":" [ field-value ]
- General-header
- Request-header
- Response-header
- Entity-header
HTTP Message Body Fields (Optional)
- Content-Type and Content-Length headers lines specify the nature of the body associated.
HTTP Response/Status Line
* HTTP/1.0 200 OK * HTTP/1.0 404 Not Found * The status code is a three-digit integer - 1xx indicates an informational message only - 2xx indicates success of some kind - 3xx redirects the client to another URL - 4xx indicates an error on the client's part - 5xx indicates an error on the server's part
No comments:
Post a Comment