[TIL] HTTP : The Definitive Guide "p358 ~ p359"

시윤·2025년 5월 24일

[TIL] Two Pages Per Day

목록 보기
141/146
post-thumbnail

Chapter 15. Entities and Encodings

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


✏️ 원문 번역


Combining Content and Transfer Encodings

Content encoding and transfer encoding can be used simultaneously. For example, Figure 15-7 illustrates how a sender can compress an HTML file using a content encoding and send the data chunked using a transfer encoding. The process to “reconstruct” the body is reversed on the receiver.

  • 콘텐츠 인코딩과 전송 인코딩은 동시에 사용됩니다.

  • Figure 15-7은 송신자가 콘텐츠 인코딩을 사용하여 HTML 콘텐츠를 압축한 후 전송 인코딩을 사용하여 분할된 데이터를 전송하는 과정을 나타냅니다.

  • 본문을 "재구성"하는 과정은 수신자에 의해 이루어집니다.


Transfer-Encoding Rules

When a transfer encoding is applied to a message body, a few rules must be followed:

  • 메시지 본문에 전송 인코딩을 적용할 때 몇 가지 규칙을 따라야 합니다.

• The set of transfer encodings must include “chunked.” The only exception is if the message is terminated by closing the connection.

• When the chunked transfer encoding is used, it is required to be the last transfer encoding applied to the message body.

• The chunked transfer encoding must not be applied to a message body more than once.

  • 연결이 종료됨과 동시에 메시지도 종료되는 경우가 아니라면, 전송 인코딩은 "chunked"를 포함해야 합니다.

  • 청크 전송 인코딩이 사용될 때 메시지 본문에 전송 인코딩을 적용하는 시점이 가장 마지막이어야 합니다.

  • 청크 전송 인코딩은 메시지 본문에 두 번 이상 적용되면 안 됩니다.

These rules allow the recipient to determine the transfer length of the message.

  • 위의 규칙들은 수신자가 전송된 메시지의 길이를 결정할 수 있게 합니다.

Transfer encodings are a relatively new feature of HTTP, introduced in Version 1.1. Servers that implement transfer encodings need to take special care not to send transfer-encoded messages to non-HTTP/1.1 applications. Likewise, if a server receives a transfer-encoded message that it can not understand, it should respond with the 501 Unimplemented status code. However, all HTTP/1.1 applications must at least support chunked encoding.

  • 전송 인코딩은 Version 1.1에서 소개된 비교적 최신의 HTTP 특성입니다.

  • 전송 인코딩을 구현하는 서버는 non-HTTP/1.1 응용 프로그램에 전송 인코딩이 적용된 메시지를 보내지 않도록 각별히 주의를 기울여야 합니다.

  • 마찬가지로 서버가 이해할 수 없는 전송 인코딩 메시지를 받는 경우에도 501 Unimplemented 상태 코드를 함께 반환해야 합니다.

  • 하지만 적어도 모든 HTTP/1.1 응용 프로그램은 청크 인코딩을 지원해야 합니다.


Time-Varing Instances

Web objects are not static. The same URL can, overtime, point to different versions of an object. Take the CNN homepage as an example—going to “http://www.cnn.com” several times in a day is likely to result in a slightly different page being returned each time.

  • 웹 오브젝트는 정적이지 않습니다.

  • 동일한 URL도 시간이 지나면 다른 버전의 객체를 가리킬 수 있습니다.

  • CNN 홈페이지를 예로 들어봅시다.

  • "http://www.cnn.com"에 매일 다른 시각에 접속할 때마다 페이지가 조금씩 달라지는 것을 확인할 수 있습니다.

Think of the CNN home page as being an object and its different versions as being different instances of the object (see Figure 15-8). The client in the figure requests the same resource (URL) multiple times, but it gets different instances of the resource as it changes over time. At time (a) and (b) it has the same instance; at time (c) it has a different instance.

  • CNN 홈페이지가 하나의 오브젝트이고, 홈페이지의 다른 버전이 오브젝트의 서로 다른 인스턴스라고 볼 수 있습니다. (Figure 15-8)

  • Figure 15-8에서 클라이언트는 동일한 리소스(URL)을 여러 번 요청하지만 시간이 흘러 리소스가 변경될 때마다 서로 다른 인스턴스를 불러옵니다.

  • (a)와 (b) 시점에는 동일한 인스턴스를 보유하고 있지만, (c) 시점에는 다른 인스턴스를 보유하고 있습니다.

The HTTP protocol specifies operations for a class of requests and responses, called instance manipulations, that operate on instances of an object. The two main instance-manipulation methods are range requests and delta encoding. Both of these methods require clients to be able to identify the exact copy of the resource that they have (if any) and request new instances conditionally. These mechanisms are discussed later in this chapter.

  • HTTP 프로토콜은 "Instance Manipulation"을 통해 요청과 응답 유형에 대한 연산을 지정합니다.

  • Instance Manipulation은 오브젝트의 인스턴스에 대해 연산을 수행합니다.

  • 범위 요청(Range Request)과 델타 인코딩(Delta Encoding)은 두 가지의 주요한 인스턴스 제어 함수입니다.

  • 두 함수 모두 클라이언트가 보유중인 리소스의 정확한 사본을 식별할 수 있고 조건부로 새로운 인스턴스를 요청할 수 있음을 전제합니다.

  • 이러한 매커니즘은 챕터의 후반부에서 다룹니다.


✏️ 요약


Transfer-Encoding Rules

: 메시지 본문에 전송 인코딩이 적용될 때 준수해야 하는 규칙

  • Persistent Connection -> 전송 인코딩은 chunked를 포함해야 한다
  • 전송 인코딩은 메시지 본문에 가장 마지막에 적용되어야 한다
    • 콘텐츠 인코딩과 전송 인코딩이 같이 쓰일 수 있음
    • 콘텐츠 인코딩 > 전송 인코딩 순으로 이루어져야 함
    • 본문의 재구성 과정은 수신자에 의해 이루어짐
  • 청크 전송 인코딩은 메시지 본문에 두 번 이상 적용될 수 없다

Time-Varing Instances

: 시간에 따라 오브젝트의 상태가 변화한 것

  • 동일한 웹 페이지에 변경이 발생하면 서로 다른 인스턴스가 된다
  • Instance Manipulation : 요청과 응답 유형에 대한 연산 지정
    • 오브젝트의 인스턴스에 대해 연산 수행
    • 범위 요청(Range Request)
    • 델타 인코딩(Delta Encoding)

✏️ 감상


왜 여기서 꾾겨 ㅠㅠ

내가 궁금한 건범위 요청과 델타 인코딩인데 😂

하지만 오늘 이걸 다 읽어버리면 다른 과제를 뒤로 미뤄버릴 테니까... 궁금해도 꾹 참고 조만간 또 부지런히 다음 섹션을 읽어봅시다~!~

profile
틈틈이 두 페이지씩 원서 읽기

0개의 댓글