Intern
What is HTTP?
sobes.tech AI
Answer from AI
Hypertext Transfer Protocol. An application layer network protocol for data exchange.
Main features:
- Client-server architecture: The client (e.g., browser) sends a request to the server, which processes it and returns a response.
- Stateless: Each request is processed independently of previous ones. Session state is maintained at higher levels (e.g., using cookies).
- Uses TCP: The default transport protocol is TCP, ensuring reliable data delivery.
- Port 80: The standard port for HTTP.
- HTTP request methods (verbs): Define the type of action to perform on a resource.
GET: Request data from a specified resource.POST: Send data for processing or creating a new resource.PUT: Update an existing resource or create a new one at the specified URI.DELETE: Remove the specified resource.PATCH: Partially update a resource.HEAD: Request response headers, similar to GET but without the response body.OPTIONS: Request information about available methods and other communication options for the target resource.
- Response status codes: Three-digit numbers indicating the result of the request.
1xx: Informational2xx: Success -200 OK3xx: Redirection4xx: Client Error -404 Not Found5xx: Server Error -500 Internal Server Error
HTTP message structure:
| Part | Request | Response |
|---|---|---|
| Start line | Method URI HTTP Version (e.g., GET / HTTP/1.1) |
HTTP Version Status Code Status Phrase (e.g., HTTP/1.1 200 OK) |
| Headers |