HTTP 메시지 구조
start-line 시작라인 header 헤더 empty line 공백라인 (CRLF) message body
공식 스펙
HTTP-massage = start-line * ( header-field CRLF ) CRLF { message body }
GET/search?1=hello&hi=ko HTTP/1.1 👈 start-line (request-line)
Host:www.google.com 👈 header
👈 empty line
메서드
- GET, POST, PUT, DELETE
- 서버가 수행해야 할 동작 지정
- GET : 리소스 조회
- POST : 요청 내역 처리
요청 대상
- absolute-path[?query] 절대경로[?쿼리]
HTTP/1.1 200 OK 👈 start-line (status-line)
Content-Type: text/html;charset=UTF-8 👈 header
Content-Length:3423
👈 empty line
<html> 👈 message body
<body>...</body>
</html>
헤더
- field-name: OWS field-value OWS
OWS : 띄어쓰기 허용
- field-name은 대소문자 구분 x
메시지 바디
- 실제 전송할 데이터
- byte로 표현 가능한 모든 데이터 전송 가능