HTTP messages의 정의 및 구성에 관한 내용을 요약정리합니다.
• HTTP Messages의 정의
MDN에 기재 된 HTTP Messages의 정의는 하기와 같습니다.
HTTP messages are how data is exchanged between a server and a client.
There are two types of messages: requests sent by the client to trigger an action on the server, and responses, the answer from the server.
HTTP Messages - HTTP | MDN
HTTP messages are how data is exchanged between a server and a client. There are two types of messages: requests sent by the client to trigger an action on the server, and responses, the answer from the server.
developer.mozilla.org
• HTTP Messages의 구조
HTTP Messages는 Requests, Responses 각각 start-line, headers, body의 정보로 이루어져 있습니다.
• Requests
start-line
Requests start-line은 HTTP method, request target, HTTP version 세 가지 정보로 이루어져 있습니다.
HTTP method는 GET, POST, PUT, DELETE등이 있습니다.
request target은 대체로 URL인 경우가 많습니다.
HTTP version은 messages의 구조를 정의하여 response로 받고싶은 version을 지시합니다.
headers
Requests headers는 resource fetch에 필요한 정보, client자체에 대한 추가정보로 이루어져 있습니다.
Request header - MDN Web Docs Glossary: Definitions of Web-related terms | MDN
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. For example, the Accept-* headers indicate the allowed and preferred formats of the respons
developer.mozilla.org
body
Requests body는 HTTP method가 POST, PUT등과 같이 server 데이터 수정에 필요한 정보를 보낼 때 사용됩니다.
GET, DELETE 등과 같은 method의 경우 HTTP messages에 포함되지 않습니다.
• Responses
start-line
Responses start-line은 HTTP version, status code, status text로 이루어져 있습니다.
headers
Responses header는 Age, Location, Server 정보 등의 추가정보로 이루어져 있습니다.
Response header - MDN Web Docs Glossary: Definitions of Web-related terms | MDN
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.
developer.mozilla.org
body
Responses body는 대체로 Single-resource body, Multiple-resource body로 나뉩니다.
Single-resource body는 Content-Type, Content-Length로 정의되는 단일 정보입니다.
Multiple-resource body는 대체로 HTML Forms등과 관련 되어있습니다.
모든 Responses가 body를 가지는 것은 아닙니다.
status code 201, 204과 같이 그 자체로 처리결과가 충분히 묘사되는 경우는 대체로 Reponses body를 갖지 않습니다.
'웹개발자공부 > HTTP' 카테고리의 다른 글
HTTP - HTTP Cookies, Web Storage의 정의 및 특징 (0) | 2023.02.10 |
---|---|
HTTP - response status codes 간략 정리 (0) | 2022.11.29 |