본문 바로가기
TIL (Today I Learned)/컴퓨터 시스템(CS)

[CS] 네트워크 기초, HTTP 2 #8

by 둥굴프 2022. 12. 11.
이 문서는 유튜브 '생활코딩'님의 'WEB2 - HTTP' 강의를 토대로 작성되었습니다.

 

클라이언트-서버 HTTP 통신

출처 : https://www3.ntu.edu.sg/home/ehchua/programming/webprogramming/http_basics.html

 

In Introduction to HTTP Basics

HTTP (HyperText Transfer Protocol) Basics Introduction The WEB Internet (or The Web) is a massive distributed client/server information system as depicted in the following diagram. Many applications are running concurrently over the Web, such as web browsi

www3.ntu.edu.sg

 

 

 

웹 브라우저가 하는 역할?

사용자가 요청한 정보를 웹 서버에게 대신 물어봐준다.

어떻게? TEXT 정보를 만들어서!

이때의 TEXT 정보가 Request Headers 이다.

Request Headers에 필수적인 두가지 요소가 있다.

 

1. HTTP 요청 라인 (요청 행) :

GET /1.html HTTP/1.1

method URI version

 

2. HTTP 요청 헤더 :

Host : localhost:8080

Host : 접속주소(웹 브라우저가 접속한 주소)

 

 

웹 서버는 뭐 하는 기계?

자신이 가지고 있는 정보를 보내주면서 Response Headers를 만들어주는 기계.

Response Headers의 첫 줄에는 필수적으로 응답 라인이 오도록 약속되어있다.

 

1. HTTP 응답 라인 :

HTTP/1.1 200 OK

version status-code status-message

 

추가적으로, 브라우저는 응답받은 정보를 화면에 렌더링 해주는 역할을 한다.

 

 

1. status

status-code

  1. Informational responses (100  199)
  2. Successful responses (200  299) "성공 - 200 OK"
  3. Redirection messages (300  399) "리다이렉션 - 서버 Application에서 언급"
  4. Client error responses (400  499) "클라이언트 에러 - 404 Not found/ 403 Forbidden"
  5. Server error responses (500  599) "서버 에러 - 500 Internal Server Error"

출처 : https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#successful_responses

 

HTTP response status codes - HTTP | MDN

HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped in five classes:

developer.mozilla.org

 

2. headers

Content-Type : 웹 서버가 응답하는 데이터 타입

참고자료 : https://ko.wikipedia.org/wiki/%EB%AF%B8%EB%94%94%EC%96%B4_%ED%83%80%EC%9E%85

 

Content-Length : 응답하는 컨텐트의 길이, 단위는 Byte

Content-Encoding : 압축 타입

 

 

 

 

 

 

긴 글 읽어주셔서 감사드립니다.

22.12.11

댓글