HTTP POST 요청 구조 분석
폼 데이터
- name: 콜라
- price: 1000
- qty: 5개
HTTP 요청 전체 구조
POST /product.do?cmd=insert-form HTTP/1.1
Host: localhost:8080
Content-Type: application/x-www-form-urlencoded
Content-Length: 30
Connection: keep-alive
Cache-Control: max-age=0
Origin: <http://localhost:8080>
Referer: <http://localhost:8080/product.do?cmd=insert-form>
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) ...
name=콜라&price=1000&qty=5
HTTP 헤더 (Request Headers)
필수 헤더
POST /product.do?cmd=insert-form HTTP/1.1
Host: localhost:8080
Content-Type: application/x-www-form-urlencoded
Content-Length: 30
헤더 설명
- POST: HTTP 메서드
- /product.do?cmd=insert-form: 요청 URL (form의 action이 “#”이므로 현재 페이지 URL 사용)
- HTTP/1.1: HTTP 프로토콜 버전
- Host: 서버 호스트명과 포트
- Content-Type: 요청 본문의 데이터 형식 (
application/x-www-form-urlencoded)
- Content-Length: 요청 본문의 바이트 길이
추가 헤더 (브라우저가 자동으로 추가)
Connection: keep-alive
Cache-Control: max-age=0
Origin: <http://localhost:8080>
Referer: <http://localhost:8080/product.do?cmd=insert-form>
User-Agent: Mozilla/5.0 ...
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7
Accept-Encoding: gzip, deflate, br
HTTP 바디 (Request Body)