HTTP protocol #5

Open
opened 2025-02-05 11:08:55 +01:00 by lang · 1 comment
Collaborator
  • HTTP headers
  • HTTP request methods
  • HTTP response status codes
  • HTTP resources and specifications

Here is a good documentation.

- [x] HTTP headers - [x] HTTP request methods - [x] HTTP response status codes - [x] HTTP resources and specifications [Here](https://developer.mozilla.org/en-US/docs/Web/HTTP) is a good documentation.
lang changed title from HTTP protokoll to HTTP protocol 2025-02-05 11:14:53 +01:00
Owner

Hypertext Transfer Protocol (HTTP) is an application-layer protocol for transmitting hypermedia documents, such as HTML. It was designed for communication between web browsers and web servers, but it can also be used for other purposes, such as machine-to-machine communication, programmatic access to APIs, and more.

HTTP headers
HTTP headers let the client and server pass additional information with an HTTP request or response.
Message headers are used to send metadata about a resource or a HTTP message, and to describe the behavior of the client or the server.
Headers can be grouped according to their contexts:

  • Request Headers (Contain more information about the resource to be fetched, or about the client requesting the resource.)
    A request header is an HTTP header that can be used in an HTTP request to provide information about the request context, so that the server can tailor the response.
  • Response Headers (Hold additional information about the response, like its location or about the server providing it.)
    A response header is an HTTP header that can be used in an HTTP response and that doesn't relate to the content of the message. Response headers, like Age, Location or Server are used to give a more detailed context of the response.
  • Representation header (Contain information about the body of the resource, like its MIME type, or encoding/compression applied.)
    A representation header (or 'representation metadata') is an HTTP header that describes how to interpret the data contained in the message.
  • Payload header (Contain representation-independent information about payload data, including content length and the encoding used for transport.)
    A payload header is an HTTP header that describes the payload information related to safe transport and reconstruction of the original resource representation, from one or more messages. This includes information like the length of the message payload, which part of the resource is carried in this payload (for a multi-part message), any encoding applied for transport, message integrity checks, etc.
    Payload headers may be present in both HTTP request and response messages (i.e. in any message that is carrying payload data).

Headers can also be grouped according to how proxies handle them:

End-to-end headers

These headers must be transmitted to the final recipient of the message: the server for a request, or the client for a response. Intermediate proxies must retransmit these headers unmodified and caches must store them.

Hop-by-hop headers

These headers are meaningful only for a single transport-level connection, and must not be retransmitted by proxies or cached. Note that only hop-by-hop headers may be set using the Connection header.

HTTP request methods

  • GET
  • HEAD
  • POST
  • PUT
  • DELETE
  • CONNECT
  • OPTIONS
  • PATCH
  • TRACE

POST GET PUT DELETE
C R U D
create read update delete

HTTP response status codes

  1. Informational responses (100-199)
  2. Successful responses (200-299)
  3. Redirection messages (300-399)
  4. Client error responses (400-499)
  5. Server error responses (500-599)

Most important HTTP response status codes:
101 - Switching Protocols
200 - OK
201 - Created
204 - No Content
304 - Not Modified
400 - Bad Request
401 - Unauthorized
403 - Forbidden
404 - Not Found
409 - Conflict
410 - Gone
429 - Too Many Requests
500 - Internal Server Error
503 - Service Unavailable (server unavailable)

Hypertext Transfer Protocol (HTTP) is an [application-layer](https://en.wikipedia.org/wiki/Application_Layer) protocol for transmitting hypermedia documents, such as HTML. It was designed for communication between web browsers and web servers, but it can also be used for other purposes, such as machine-to-machine communication, programmatic access to APIs, and more. **HTTP headers** HTTP headers let the client and server pass additional information with an HTTP request or response. Message headers are used to send metadata about a resource or a HTTP message, and to describe the behavior of the client or the server. Headers can be grouped according to their contexts: - Request Headers (Contain more information about the resource to be fetched, or about the client requesting the resource.) A request header is an [HTTP header](https://developer.mozilla.org/en-US/docs/Glossary/HTTP_header) that can be used in an HTTP request to provide information about the request context, so that the server can tailor the response. - Response Headers (Hold additional information about the response, like its location or about the server providing it.) A response header is an [HTTP header](https://developer.mozilla.org/en-US/docs/Glossary/HTTP_header) that can be used in an HTTP response and that doesn't relate to the content of the message. Response headers, like [`Age`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Age), [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) or [`Server`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server) are used to give a more detailed context of the response. - Representation header (Contain information about the body of the resource, like its [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types), or encoding/compression applied.) A representation header (or 'representation metadata') is an [HTTP header](https://developer.mozilla.org/en-US/docs/Glossary/HTTP_header) that describes how to interpret the data contained in the message. - Payload header (Contain representation-independent information about payload data, including content length and the encoding used for transport.) A payload header is an [HTTP header](https://developer.mozilla.org/en-US/docs/Glossary/HTTP_header) that describes the payload information related to safe transport and reconstruction of the original resource [representation](https://developer.mozilla.org/en-US/docs/Glossary/Representation_header), from one or more messages. This includes information like the length of the message payload, which part of the resource is carried in this payload (for a multi-part message), any encoding applied for transport, message integrity checks, etc. Payload headers may be present in both HTTP request and response messages (i.e. in any message that is carrying payload data). Headers can also be grouped according to how [proxies](https://developer.mozilla.org/en-US/docs/Glossary/Proxy_server) handle them: [End-to-end headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers#end-to-end_headers) These headers _must_ be transmitted to the final recipient of the message: the server for a request, or the client for a response. Intermediate proxies must retransmit these headers unmodified and caches must store them. [Hop-by-hop headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers#hop-by-hop_headers) These headers are meaningful only for a single transport-level connection, and _must not_ be retransmitted by proxies or cached. Note that only hop-by-hop headers may be set using the [`Connection`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection) header. **HTTP request methods** - GET - HEAD - POST - PUT - DELETE - CONNECT - OPTIONS - PATCH - TRACE POST GET PUT DELETE C R U D create read update delete **HTTP response status codes** 1. Informational responses (100-199) 2. Successful responses (200-299) 3. Redirection messages (300-399) 4. Client error responses (400-499) 5. Server error responses (500-599) Most important HTTP response status codes: 101 - Switching Protocols 200 - OK 201 - Created 204 - No Content 304 - Not Modified 400 - Bad Request 401 - Unauthorized 403 - Forbidden 404 - Not Found 409 - Conflict 410 - Gone 429 - Too Many Requests 500 - Internal Server Error 503 - Service Unavailable (server unavailable)
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: andi/Practice-1#5
No description provided.