[TIL] HTTP : The Definitive Guide "p15 ~ p17"

시윤·2024년 1월 23일
0

[TIL] Two Pages Per Day

목록 보기
7/108
post-thumbnail

Chapter 1. Overview of HTTP

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


❤️ 원문 번역 ❤️

A Real Example Using Telnet

Because HTTP uses TCP/IP, and is text-based, as opposed to using some obscure binary format, it is simple to talk directly to a web server.

-> HTTP가 TCP/IP를 사용하고 모호한 이진 형식을 사용하는 것과 달리 텍스트 기반이기 때문에 웹 서버와 직접적으로 소통하기 편리합니다.

The Telnet utility connects your keyboard to a destination TCP port and connects the TCP port output back to your display screen. Telnet is commonly used for remote terminal sessions, but it can generally connect to any TCP server, including HTTP servers.

-> Telnet 유틸리티는 여러분의 키보드를 대상 TCP 포트에 연결하고 TCP 포트 출력을 다시 디스플레이 화면에 연결합니다.
-> Telnet은 원격 터미널 세션에 주로 사용되지만, HTTP 서버를 포함한 임의의 TCP 서버에 연결할 수 있습니다.

You can use the Telnet utility to talk directly to web servers. Telnet lets you open a TCP connection to a port on a machine and type characters directly into the port. The web server treats you as a web client, and any data sent back on the TCP connection is displayed onscreen.

-> Telnet 유틸리티는 웹 서버와 직접 소통하기 위해 사용될 수 있습니다.
-> Telnet은 여러분이 장치의 포트에 TCP 연결을 열고 직접 문자를 입력할 수 있게 합니다.
-> 웹 서버는 여러분을 웹 클라이언트로 받아들이고, TCP 연결을 통해 전달된 모든 데이터는 화면에 표시됩니다.

Let’s use Telnet to interact with a real web server. We will use Telnet to fetch the document pointed to by the URL http://www.joes-hardware.com:80/tools.html (you can try this example yourself).

-> 실제 웹 서버와 상호작용하기 위해 Telnet을 사용해봅시다.
-> 우리는 http://www.joes-hardware.com:80/tools.html 로 표현되는 문서를 가져오기 위해 Telnet을 사용할 것입니다.

Let’s review what should happen:
• First, we need to look up the IP address of www.joes-hardware.com and open a TCP connection to port 80 on that machine. Telnet does this legwork for us.
• Once the TCP connection is open, we need to type in the HTTP request.
• When the request is complete (indicated by a blank line), the server should send back the content in an HTTP response and close the connection.

-> 어떤 일이 일어나야 하는지 함께 정리해봅시다.

  • 우선, www.joes-hardware.com의 IP 주소를 알아내고 장치의 80번 포트에 TCP 연결을 열어야 합니다. Telnet이 이 역할을 수행합니다.
  • TCP 연결이 열리면, HTTP Request를 작성해야 합니다.
  • Request가 완료되었을 때(공백에 의해), 서버는 HTTP Response를 돌려보내고 연결을 종료해야 합니다.

Our example HTTP request for http://www.joes-hardware.com:80/tools.html is shown in Example 1-1. What we typed is shown in boldface.

-> http://www.joes-hardware.com:80/tools.html에 대한 예제 HTTP Request는 Example 1-1에 있습니다.
-> 여러분이 입력하는 값은 굵은 글씨로 나타납니다.

% telnet www.joes-hardware.com 80
Trying 161.58.228.45...
Connected to joes-hardware.com.
Escape character is '^]'.
GET /tools.html HTTP/1.1
Host: www.joes-hardware.com

HTTP/1.1 200 OK
Date: Sun, 01 Oct 2000 23:25:17 GMT
Server: Apache/1.3.11 BSafe-SSL/1.38 (Unix) FrontPage/4.0.4.3
Last-Modified: Tue, 04 Jul 2000 09:46:21 GMT
ETag: "373979-193-3961b26d"
Accept-Ranges: bytes
Content-Length: 403
Connection: close
Content-Type: text/html

<HTML>
<HEAD><TITLE>Joe's Tools</TITLE></HEAD>
<BODY>
<H1>Tools Page</H1>
<H2>Hammers</H2>
<P>Joe's Hardware Online has the largest selection of hammers on the earth.</P>
<H2><A NAME=drills></A>Drills</H2>
<P>Joe's Hardware has a complete line of cordless and corded drills, as well as the latest in plutonium-powered atomic drills, for those big around the house jobs.</P> ...
</BODY>
</HTML>
Connection closed by foreign host.

Telnet looks up the hostname and opens a connection to the www.joes-hardware.com web server, which is listening on port 80. The three lines after the command are output from Telnet, telling us it has established a connection.

-> Telnet은 호스트 이름을 알아내고 80번 포트로 대기중인 www.joes-hardware.com 웹 서버에 연결을 엽니다.
-> 명령 실행 직후 세 줄은 연결 설정이 완료되었음을 알려주는 Telnet으로부터의 출력값입니다.

We then type in our basic request command, “GET /tools.html HTTP/1.1”, and send a Host header providing the original hostname, followed by a blank line, asking the server to GET us the resource “/tools.html” from the server www.joes-hardware.com. After that, the server responds with a response line, several response headers, a blank line, and finally the body of the HTML document.

-> 여러분은 그 다음에 서버로부터 "/tools.html" 리소스를 얻기 위하여 기본적인 Request 명령인 "GET /tools.html HTTP/1.1"을 입력합니다. 그리고 줄바꿈하여 원본 호스트 이름을 제공하는 Host Header를 전송합니다.
-> 잠시 후, 서버가 응답 라인에 Response를 남깁니다. Response Header 뒤에는 줄바꿈하여 HTML 문서의 body 부분이 나타납니다.

Beware that Telnet mimics HTTP clients well but doesn’t work well as a server. And automated Telnet scripting is no fun at all. For a more flexible tool, you might want to check out nc (netcat). The nc tool lets you easily manipulate and script UDP- and TCP-based traffic, including HTTP. See http://netcat. sourceforge.net for details.

-> Telnet은 HTTP 클라이언트를 수준급으로 모방하고 있지만 서버로써는 제대로 작동하지 않는다는 점에 유의해야 합니다.
-> 그리고 자동화된 Telnet 스크립트는 전혀 재미있지 않습니다.
-> 보다 유연한 툴을 사용하려면 nc(netcat)을 확인해보세요.
-> nc 툴은 여러분이 손쉽게 HTTP를 포함한 UDP와 TCP 기반의 트래픽을 조작하고 스크립팅할 수 있게 합니다.
-> 자세한 내용은 http://netcat.sourceforge.net을 참고하길 바랍니다.


Protocol Versions

There are several versions of the HTTP protocol in use today. HTTP applications need to work hard to robustly handle different variations of the HTTP protocol. The versions in use are:

-> 오늘날 사용되는 HTTP 프로토콜에는 몇 가지 버전이 있습니다.
-> HTTP 애플리케이션은 HTTP 프로토콜의 다양한 형태를 강력히 처리하기 위해 열심히 노력해야 합니다.
-> 버전의 종류는 다음과 같습니다.

HTTP/0.9

The 1991 prototype version of HTTP is known as HTTP/0.9. This protocol contains many serious design flaws and should be used only to interoperate with legacy clients. HTTP/0.9 supports only the GET method, and it does not support MIME typing of multimedia content, HTTP headers, or version numbers. HTTP/0.9 was originally defined to fetch simple HTML objects. It was soon replaced with HTTP/1.0.

-> HTTP/0.9

  • HTTP의 1991년 프로토타입 버전이 HTTP/0.9로 알려져 있습니다. 이 프로토콜은 심각한 설계상의 결함을 다수 포함하고 있어서 오직 레거시 클라이언트와 상호운용하기 위해서만 사용되어야 합니다.
  • HTTP/0.9는 오직 GET 메소드만을 지원하고, 멀티미디어 콘텐츠의 MIME 타입, HTTP 헤더나 버전을 지원하지 않습니다. HTTP/0.9는 본래 간단한 HTML 객체를 불러오기 위해 정의되었습니다. 이는 곧 HTTP/1.0에 대체됩니다.

HTTP/1.0

1.0 was the first version of HTTP that was widely deployed. HTTP/1.0 added version numbers, HTTP headers, additional methods, and multimedia object handling. HTTP/1.0 made it practical to support graphically appealing web pages and interactive forms, which helped promote the wide-scale adoption of the World Wide Web. This specification was never well specified. It represented a collection of best practices in a time of rapid commercial and academic evolution of the protocol.

-> HTTP/1.0

  • 1.0은 널리 배포된 HTTP의 첫 번째 버전입니다. HTTP/1.0에는 버전과 HTTP 헤더, 몇 가지 메소드, 멀티미디어 객체 핸들링 기능이 추가되었습니다. HTTP/1.0은 매력적인 웹 페이지와 인터랙티브 폼을 그래픽적으로 지원하게 하여, World Wide Web의 광범위한 채택을 촉진하는 데 영향을 주었습니다.

  • 이러한 설명이 결코 HTTP/1.0을 구체화하지는 못합니다. 이는 프로토콜의 급격한 상업적, 학술적 진화의 측면에서 가장 실용적인 사례의 집합을 나타냅니다.
    (해석이 이게 맞는지 잘 모르겠습니다)

HTTP/1.0+
Many popular web clients and servers rapidly added features to HTTP in the mid-1990s to meet the demands of a rapidly expanding, commercially successful World Wide Web. Many of these features, including long-lasting “keep- alive” connections, virtual hosting support, and proxy connection support, were added to HTTP and became unofficial, de facto standards. This informal, extended version of HTTP is often referred to as HTTP/1.0+.

-> HTTP/1.0+

  • 많은 웹 클라이언트와 서버가 1990년대 중반에 HTTP의 특성을 재빠르게 추가하였습니다. 상업적으로 성공하여 급속도로 확장되고 있는 World Wide Web의 요구를 충족시키기 위함입니다.
  • 추가된 HTTP의 특성에는 장시간 지속되는 연결, 가상 호스팅 지원, 프록시 연결 지원 등이 있습니다. 이러한 특성들은 비공식적인 de facto(사실상) 표준이 되었습니다. 이 비공식적이지만 확장된 버전의 HTTP는 HTTP/1.0+로 종종 언급됩니다.

HTTP/1.1
HTTP/1.1 focused on correcting architectural flaws in the design of HTTP, specifying semantics, introducing significant performance optimizations, and removing mis-features. HTTP/1.1 also included support for the more sophisticated web applications and deployments that were under way in the late 1990s. HTTP/1.1 is the current version of HTTP.

-> HTTP/1.1

  • HTTP/1.1은 HTTP 설계에서의 구조적 결함을 바로잡고, 의미를 구체화하고, 주요한 성능 최적화를 도입하고, 잘못된 특징들을 삭제하는 데 초점을 맞추었습니다.
  • HTTP/1.1은 1990년대 후반에 배포된 더 많은 정교한 웹 애플리케이션과 배포물을 지원합니다.
  • HTTP/1.1은 HTTP의 현재 버전입니다(당시에는 그랬습니다).

HTTP-NG (a.k.a. HTTP/2.0)
HTTP-NG is a prototype proposal for an architectural successor to HTTP/1.1 that focuses on significant performance optimizations and a more powerful framework for remote execution of server logic. The HTTP-NG research effort concluded in 1998, and at the time of this writing, there are no plans to advance this proposal as a replacement for HTTP/1.1. See Chapter 10 for more information.

-> HTTP-NG (HTTP/2.0)

  • HTTP-NG는 HTTP/1.1의 구조적인 성공을 위해 제안된 프로토타입입니다. 이는 주요한 성능 최적화와 서버 로직의 원격 실행을 위한 더 강력한 프레임워크에 초점을 맞추고 있습니다.
  • HTTP-NG 연구를 위한 노력은 1998년에 완료되었고, 이 글을 쓰고 있는 지금은 HTTP/1.1를 대체하기 위한 이 제안을 발전시킬 계획이 없습니다. 자세한 내용은 Chapter 10을 참고하길 바랍니다.

🧡 요약 정리 🧡

Telnet

  • HTTP 서버를 비롯한 모든 TCP 서버에 연결 가능(주로 원격 터미널 세션에 사용)
  • 대상 TCP 포트에 연결되어 TCP 포트의 출력을 디스플레이에 표시

HTTP Versions

  • HTTP/0.9 : 간단한 HTML 문서를 불러오는 GET 메소드 지원, 설계상의 결함이 다수 포함되어 있는 프로토타입 버전
  • HTTP/1.0 : 버전, 헤더, 메소드, 멀티미디어 객체 핸들링 기능, 그래픽적 웹 페이지 지원
  • HTTP/1.0+ : 지속적 연결, 가상 호스팅, 프록시 연결 지원 -> 사실상 표준
  • HTTP/1.1 : HTTP 설계에서의 구조적 결함 보완, 성능 최적화
  • HTTP-NG : HTTP/1.1의 구조적 성공을 위해 제안된 프로토타입, 현재는 연구되고 있지 않음

💛 감상 💛

  • Telnet은 지금까지 이름만 들어봤을 뿐 구체적으로 무엇인지 알지 못했다. 책의 내용을 곧이곧대로 해석하는 것만으로는 어딘가 내용이 와닿지 않아서 구글링을 몇 번 거친 다음에야 Telnet이 어떤 것인지 이해할 수 있었다.
    (Telnet은 원격 컴퓨터에 직접적으로 접근하기 위한 프로토콜이고, 이를 통해 서버의 포트가 잘 열려 있는지 확인하거나 직접적으로 서버를 활용하는 등의 행동을 취할 수 있다. 요즘에는 보안상의 문제 때문에 Telnet보다는 암호화된 연결을 지원하는 SSH(Secure Shell)를 사용한다... 등)
  • HTTP가 0.X 버전이 있는 줄은 몰랐다. 메소드가 GET밖에 안 된다니 진짜 엄청난 원시 프로토타입인 것 같다.
  • 2024년인 현재까지도 HTTP/1.X가 많이 사용되고 있다. HTTP/1.X가 그만큼 다양한 메소드와 웹 애플리케이션을 제공하고 있기 때문일 것이다. 이 책이 최초로 발행된 연도가 2002년이라는데 지금도 너무 편리하게 잘 사용하고 있는 HTTP가 그 당시에는 얼마나 혁명적인 발상이었을지 가늠조차 되지 않는다.
profile
맑은 눈의 다람쥐

0개의 댓글

관련 채용 정보