๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

WEB

[ HTTP ] HTTP์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ธฐ

 

HTTP : HyperText Transfer Protocol

 

 

HTTP๋Š” HTML ๋ฌธ์„œ์™€ ๊ฐ™์€ ๋ฆฌ์†Œ์Šค๋“ค์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ฃผ๋Š” ํ”„๋กœํ† ์ฝœ์ด๋‹ค.

 HTTP๋Š” ์›น์—์„œ ์ด๋ฃจ์–ด์ง€๋Š” ๋ชจ๋“  ๋ฐ์ดํ„ฐ ๊ตํ™˜์˜ ๊ธฐ์ดˆ์ด๋ฉฐ, ํด๋ผ์ด์–ธํŠธ-์„œ๋ฒ„ ํ”„๋กœํ† ์ฝœ์ด๊ธฐ๋„ ํ•˜๋‹ค.

ํ•˜๋‚˜์˜ ์™„์ „ํ•œ ๋ฌธ์„œ๋Š” ํ…์ŠคํŠธ, ๋ ˆ์ด์•„์›ƒ ์„ค๋ช…, ์ด๋ฏธ์ง€, ๋น„๋””์˜ค, ์Šคํฌ๋ฆฝํŠธ ๋“ฑ ๋ถˆ๋Ÿฌ์˜จ(fetched) ํ•˜์œ„ ๋ฌธ์„œ๋“ค๋กœ ์žฌ๊ตฌ์„ฑ๋œ๋‹ค.

 

๋ณดํ†ต ๋ธŒ๋ผ์šฐ์ €์ธ ํด๋ผ์ด์–ธํŠธ์— ์˜ํ•ด ์ „์†ก๋˜๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ์š”์ฒญ(requests)์ด๋ผ๊ณ  ๋ถ€๋ฅด๋ฉฐ, ๊ทธ์— ๋Œ€ํ•ด ์„œ๋ฒ„์—์„œ ์‘๋‹ต์œผ๋กœ ์ „์†ก๋˜๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ์‘๋‹ต(responses)์ด๋ผ๊ณ  ๋ถ€๋ฅธ๋‹ค.

 

HTTP/1.0์€ 1996๋…„

HTTP/1.1์€ 1999๋…„

HTTP/2๋Š” 2015๋…„ ๋ฐœํ‘œ๋˜์—ˆ๋‹ค.

 

 

 

 

HTTP ์š”์ฒญ ๋ฉ”์†Œ๋“œ

 

- GET: ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์„œ๋ฒ„์—๊ฒŒ URL์— ํ•ด๋‹นํ•˜๋Š” ์ž๋ฃŒ์˜ ์ „์†ก์„ ์š”์ฒญํ•œ๋‹ค.

 

- HEAD: GET ์š”์ฒญ์œผ๋กœ ๋ฐ˜ํ™˜๋  ๋ฐ์ดํ„ฐ ์ค‘ ํ—ค๋” ๋ถ€๋ถ„์— ํ•ด๋‹นํ•˜๋Š” ๋ฐ์ดํ„ฐ๋งŒ ์š”์ฒญํ•œ๋‹ค.

 

- POST: ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์„œ๋ฒ„์—์„œ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ์ž๋ฃŒ๋ฅผ ๋ณด๋‚ธ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ๊ฒŒ์‹œํŒ์— ๊ธ€์„ ์“ธ ๋•Œ ํด๋ผ์ด์–ธํŠธ์˜ ๋ฌธ์„œ๊ฐ€ ์„œ๋ฒ„๋กœ ์ „์†ก๋˜์–ด์•ผ ํ•œ๋‹ค. ๋ฉฑ๋“ฑ์„ฑ์„ ๋ณด์žฅํ•˜์ง€ ์•Š๋Š”๋‹ค.

 

- PATCH: ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์„œ๋ฒ„์—๊ฒŒ ์ง€์ •ํ•œ URL์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋ถ€๋ถ„์ ์œผ๋กœ ์ˆ˜์ •ํ•  ๊ฒƒ์„ ์š”์ฒญํ•œ๋‹ค.

 

- PUT: ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์„œ๋ฒ„์—๊ฒŒ ์ง€์ •ํ•œ URL์— ์ง€์ •ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•  ๊ฒƒ์„ ์š”์ฒญํ•œ๋‹ค.

 

- DELETE: ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์„œ๋ฒ„์—๊ฒŒ ์ง€์ •ํ•œ URL์˜ ์ •๋ณด๋ฅผ ์ œ๊ฑฐํ•  ๊ฒƒ์„ ์š”์ฒญํ•œ๋‹ค.
 
- TRACE: ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์„œ๋ฒ„์—๊ฒŒ ์†ก์‹ ํ•œ ์š”์ฒญ์˜ ๋‚ด์šฉ์„ ๋ฐ˜ํ™˜ํ•ด ์ค„ ๊ฒƒ์„ ์š”์ฒญํ•œ๋‹ค.
 
- CONNECT: ํด๋ผ์ด์–ธํŠธ๊ฐ€ ํŠน์ • ์ข…๋ฅ˜์˜ ํ”„๋ก์‹œ ์„œ๋ฒ„์—๊ฒŒ ์—ฐ๊ฒฐ์„ ์š”์ฒญํ•œ๋‹ค.
 
- OPTIONS: ํ•ด๋‹น URL์—์„œ ์ง€์›ํ•˜๋Š” ์š”์ฒญ ๋ฉ”์„ธ์ง€์˜ ๋ชฉ๋ก์„ ์š”์ฒญํ•œ๋‹ค.

 

 

 

์ถœ์ฒ˜:์œ„ํ‚ค๋ฐฑ๊ณผ-HTTP

 

 

์š”์ฒญ(Request) ๋ฉ”์„ธ์ง€ ํฌ๋งท

ํด๋ผ์ด์–ธํŠธ์™€ ์„œ๋ฒ„ ์‚ฌ์ด์˜ ์†Œํ†ต์€ ํ‰๋ฌธ(ASCII) ๋ฉ”์‹œ์ง€๋กœ ์ด๋ฃจ์–ด์ง€๋ฉฐ ํด๋ผ์ด์–ธํŠธ๋Š” ์„œ๋ฒ„๋กœ ์š”์ฒญ ๋ฉ”์‹œ์ง€๋ฅผ ์ „๋‹ฌํ•˜๊ณ  ์„œ๋ฒ„๋Š” ์‘๋‹ต ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋‚ธ๋‹ค.

 

- ์š”์ฒญ๋‚ด์šฉ

- ํ—ค๋”

- ๋นˆ ์ค„

- ๊ธฐํƒ€ ๋ฉ”์‹œ์ง€๋ฅผ ํฌํ•จํ•˜์—ฌ ํ‘œ์‹œ๋œ๋‹ค.

 

 

 

 

ํด๋ผ์ด์–ธํŠธ ์š”์ฒญ ์˜ˆ์‹œ

GET /restapi/v1.0 HTTP/1.1
Accept: application/json
Authorization: Bearer UExBMDFUMDRQV1MwMnzpdvtYYNWMSJ7CL8h0zM6q6a9ntw

 

 

 

 

์‘๋‹ต(Response) ๋ฉ”์„ธ์ง€ ํฌ๋งท

- ์ƒํƒœ ํ‘œ์‹œ ํ–‰ (status line) : ์ƒํƒœ์ฝ”๋“œ์™€ reason message๋ฅผ ํฌํ•จํ•œ๋‹ค.

- ์‘๋‹ต ํ—ค๋” ํ•„๋“œ

- ๋นˆ ์ค„

- ๊ธฐํƒ€ ๋ฉ”์‹œ์ง€

 

HTTP ์ƒํƒœ ์ฝ”๋“œ ์ฐธ๊ณ 

 

 

 

 

 

์„œ๋ฒ„ ์‘๋‹ต ์˜ˆ์‹œ

Date: Mon, 23 May 2005 22:38:34 GMT
Content-Type: text/html; charset=UTF-8
Content-Encoding: UTF-8
Content-Length: 138
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)
ETag: "3f80f-1b6-3e1cb03b"
Accept-Ranges: bytes
Connection: close

<html>
<head>
  <title>An Example Page</title>
</head>
<body>
  Hello World, this is a very simple HTML document.
</body>
</html>

 

 

 

 

 

 

์ถœ์ฒ˜ )

MDN - HTTP

์œ„ํ‚ค๋ฐฑ๊ณผ - HTTP