100 Continue는 최종 응답이 아니라 임시(interim) 응답입니다. 클라이언트가 큰 본문을 보내기 전에 서버가 요청 헤더만 먼저 검사하고 "본문을 계속 보내도 좋다"고 알리는 신호이며, 클라이언트가 요청에 Expect: 100-continue 헤더를 넣었을 때만 발생합니다.
이 핸드셰이크는 대역폭 낭비를 막아 줍니다. 서버가 인증 실패나 크기 제한 등으로 요청을 거부할 상황이라면, 수 메가바이트의 본문을 다 받기 전에 미리 거절할 수 있기 때문입니다. 실제 최종 상태(200, 201 등)는 본문 전송이 끝난 뒤 별도로 도착합니다.
PUT /uploads/large-file.bin HTTP/1.1
Host: api.example.com
Content-Length: 10485760
Expect: 100-continue
Content-Type: application/octet-streamHTTP/1.1 100 Continue
(client now streams the 10 MB body, then receives the final response)
HTTP/1.1 201 Created
Location: /uploads/large-file.bincurl -v --data-binary @large.bin \
-H 'Expect: 100-continue' \
https://api.example.com/uploadimport requests
r = requests.put('https://api.example.com/upload',
data=open('large.bin', 'rb'),
headers={'Expect': '100-continue'})
print(r.status_code) # final status, e.g. 201