단순 전송
: Content-Length
Length를 알 수 있을 때 사용
HTTP/1.1 200 OK
Content-Type: text/html;charset=UTF-8
Content-Length: 3423
html
압축 전송
: Content-Encoding
HTTP/1.1 200 OK
Content-Type: text/html;charset=UTF-8
Content-Encoding: gzip
Content-Length: 521
html
분할 전송
: Transfer-Encoding
덩어리로 쪼개서 전송, 응답이 오는 대로 바로바로 확인 가능
Content-Length를 넣으면 안됨. (길이가 예상이 안됨)
HTTP/1.1 200 OK
Content-Type: text/plain
Transfer-Encoding: chunked
5
hello
5
world
0
\r\n
범위 전송
: Range, Content-Range
응답 받고 싶은 범위를 지정해서 요청
GET /event
Range: bytes=1001-2000
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Range: bytes 1001-2000 /2000
qweqwe1l2iu3019u2osodfwqq
출처: 모든 개발자를 위한 HTTP 웹 개발 지식