[TIL] HTTP : The Definitive Guide "p67 ~ p68"

시윤·2024년 2월 27일
0

[TIL] Two Pages Per Day

목록 보기
28/109
post-thumbnail

Chapter 3. HTTP Messages

(해석 또는 이해가 잘못된 부분이 있다면 댓글로 편하게 알려주세요.)


❤️ 원문 번역 ❤️

Headers

Headers and methods work together to determine what clients and servers do. This section quickly sketches the purposes of the standard HTTP headers and some headers that are not explicitly defined in the HTTP/1.1 specification (RFC 2616). Appendix C summarizes all these headers in more detail.

  • 헤더와 메소드는 함께 동작하며 클라이언트와 서버가 수행할 역할을 결정합니다.

  • 이번 섹션에서는 표준 HTTP 헤더와 HTTP/1.1 명세(RFC 2616)에 명시되지 않은 몇 가지 헤더의 목적에 대해 정리합니다.

  • Appendix C는 이러한 모든 헤더들을 자세히 요약하고 있습니다.

There are headers that are specific for each type of message and headers that are more general in purpose, providing information in both request and response messages. Headers fall into five main classes:

  • 헤더에는 메시지의 유형에 따른 구체적인 것도 있고, 요청과 응답 메시지 모두에서 정보를 전달하기 위한 일반적인 것도 있습니다.

  • 헤더는 크게 다섯 가지로 분류됩니다.

General headers

These are generic headers used by both clients and servers. They serve general purposes that are useful for clients, servers, and other applications to supply to one another. For example, the Date header is a general-purpose header that allows both sides to indicate the time and date at which the message was constructed:

Date: Tue, 3 Oct 1974 02:16:00 GMT
  • Genereal headers
    - 클라이언트와 서버에 의해 모두 사용되는 일반적인 헤더입니다.
    - 클라이언트와 서버를 비롯한 여러 응용 프로그램과 다른 응용 프로그램을 통신할 때 일반적으로 유용하게 사용됩니다.
    - 예를 들어, Date 헤더는 범용 헤더입니다. 이 헤더는 양측의 프로그램이 메시지가 작성된 시간과 날짜를 나타낼 수 있게 합니다.
    Date : Tue, 3 Oct 1974 02:16:00 GMT

Request headers

As the name implies, request headers are specific to request messages. They provide extra information to servers, such as what type of data the client is willing to receive. For example, the following Accept header tells the server that the client will accept any media type that matches its request:

Accept: */*
  • Request headers
    - 말 그대로 요청 헤더는 요청 메시지에 한정된 헤더입니다.
    - 이 헤더는 서버에게 클라이언트가 희망하는 데이터의 타입 등의 추가 정보를 제공합니다.
    - 예를 들어, Accept 헤더는 클라이언트가 요청과 일치하는 모든 미디어 타입을 수용할 것임을 서버에게 전달합니다.
    Accept: */*

Response headers

Response messages have their own set of headers that provide information to the client (e.g., what type of server the client is talking to). For example, the following Server header tells the client that it is talking to a Version 1.0 Tiki-Hut server:

Server: Tiki-Hut/1.0
  • Response headers
    - 응답 메시지는 클라이언트에게 정보를 제공하기 위한 고유의 헤더 집합을 가지고 있습니다. (e.g. 클라이언트가 통신중인 서버의 타입)
    - 예를 들어, 아래의 Server 헤더는 클라이언트가 Version 1.0 Tiki-Hut 서버와 통신중임을 클라이언트에게 전달합니다.
    Server: Tiki-Hut/1.0

Entity headers

Entity headers refer to headers that deal with the entity body. For instance, entity headers can tell the type of the data in the entity body. For example, the following Content-Type header lets the application know that the data is an HTML document in the iso-latin-1 character set:

Content-Type: text/html; charset=iso-latin-1
  • Entity headers
    - 엔티티 헤더는 엔티티 본문을 처리하기 위한 헤더를 나타냅니다.
    - 그 예신로, 엔티티 헤더는 엔티티 본문의 데이터 타입을 밝힐 수 있습니다.
    - 아래의 Content-Type 헤더는 데이터가 iso-latin-1 문자 집합의 HTML 문서라는 사실을 응용 프로그램에게 알려줍니다.
    Content-Type: text/html; charset=iso-latin-1

Extension headers

Extension headers are nonstandard headers that have been created by application developers but not yet added to the sanctioned HTTP specification. HTTP programs need to tolerate and forward extension headers, even if they don’t know what the headers mean.

  • Extension headers
    - Extension 헤더는 응용 프로그램 개발자에 의해 개발되었으나 HTTP 명세에 정의되지 않은 비표준 헤더입니다.
    - HTTP 프로그램은 헤더가 무엇을 의미하는지 알지 못하더라도 확장 헤더를 허용하고 전송해야 합니다.

[1] General Headers

Some headers provide very basic information about a message. These headers are called general headers. They are the fence straddlers, supplying useful information about a message regardless of its type.

  • 일부 헤더는 메시지에 대해 아주 기본적인 정보를 제공합니다.

  • 이러한 헤더를 범용 헤더라고 부릅니다.

  • 범용 헤더는 메시지의 유형과 관계없이 메시지에 관한 유용한 정보를 공급합니다.

For example, whether you are constructing a request message or a response message, the date and time the message is created means the same thing, so the header that provides this kind of information is general to both types of messages. Table 3-11 lists the general informational headers.

  • 예를 들어 요청 메시지나 응답 메시지를 작성할 때, 메시지가 생성된 날짜와 시간은 동일한 의미를 가집니다. 따라서 이러한 종류의 정보를 제공하는 헤더는 메시지의 두 가지 유형에서 모두 범용적으로 사용됩니다.

  • Table 3-11은 범용 헤더를 나열한 것입니다.

General Caching Headers

HTTP/1.0 introduced the first headers that allowed HTTP applications to cache local copies of objects instead of always fetching them directly from the origin server. The latest version of HTTP has a very rich set of cache parameters. In Chapter 7, we cover caching in depth. Table 3-12 lists the basic caching headers.

  • HTTP/1.0은 HTTP 응용 프로그램이 항상 origin 서버에서 직접 객체를 가져오지 않고 객체의 지역 복사본을 저장하도록 하는 첫 번째 헤더를 소개했습니다.

  • HTTP의 최신 버전에서는 cache 파라미터 집합이 다소 풍부해졌습니다.

  • 캐싱에 대해서는 Chapter 7에서 깊이 있게 다룹니다.

  • Table 3-12는 기본적인 캐싱 헤더를 나열합니다.


🧡 요약 정리 🧡

Headers

  • 클라이언트와 서버가 수행할 일을 결정

[1] General Headers

  • 클라이언트와 서버에서 모두 사용되는 범용 헤더
    Connection, Date, MIME-Version, Upgrade 등 (Table 3-11 참고)
  • General Caching Headers : 응용 프로그램이 항상 origin 서버에서 객체를 직접 가져오지 않고 객체의 지역 복사본을 저장하도록 하는 헤더

💛 감상 💛

  • 그저께부터 갑자기 바빠져서 벨로그 포스팅을 해야 한다는 걸 까맣게 잊고 있었다.... 요즘 새로운 프로젝트를 준비하면서 이래저래 정리할 것이 많다. 새 프로젝트는 항상 마음이 설레고 들뜨는 것 같다. 그렇다고 원래 해오던 일을 내팽개치면 안 되는 거니까, 조금만 더 부지런히 움직여서 포스팅도 꼭 까먹지 말고 올려야겠다.

  • 오늘은 헤더의 앞부분만 맛보기를 한 거라 내용이 많지도 어렵지도 않았다. 다음 포스팅과 다다음 포스팅에서 다룰 요청 헤더와 응답 헤더까지 무사히 잘 읽어낼 수 있기를 바란다. 그러면 Chapter 3도 끝이다!

profile
맑은 눈의 다람쥐

0개의 댓글

관련 채용 정보