3. Message Format

HTTP-message = start-line *( header-field CRLF ) CRLF [ message-body ]

HTTP ๋ฉ”์‹œ์ง€๋ฅผ ๋ถ„์„ํ•˜๋Š” ์ผ๋ฐ˜์ ์ธ ์ ˆ์ฐจ๋Š” start-line์„ ์ฝ๊ณ , ๊ฐ ํ—ค๋” ํ•„๋“œ๋ฅผ ๋นˆ ํ–‰๊นŒ์ง€ ํ•„๋“œ ์ด๋ฆ„์œผ๋กœ ํ•ด์‹œ ํ…Œ์ด๋ธ”๋กœ ์ฝ์€ ๋‹ค์Œ ๋ถ„์„๋œ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์ด ํ•„์š”ํ•œ์ง€ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์ด ํ‘œ์‹œ๋œ ๊ฒฝ์šฐ, ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ ๊ธธ์ด์™€ ๋™์ผํ•œ octet์˜ ์–‘์„ ์ฝ๊ฑฐ๋‚˜ ์ปค๋„ฅ์…˜์„ ๋‹ซ์„ ๋•Œ๊นŒ์ง€ ์ŠคํŠธ๋ฆผ์œผ๋กœ ์ฝ๋Š”๋‹ค.

  • ์ˆ˜์‹ ์ž๋Š” ๋ฐ˜๋“œ์‹œ HTTP ๋ฉ”์‹œ์ง€๋ฅผ US-ASCII [USASCII]์˜ ์ƒ์œ„ ์ง‘ํ•ฉ์ธ ์ธ์ฝ”๋”ฉ์—์„œ octet๋กœ ๊ตฌ ๋ฌธ ๋ถ„์„ํ•ด์•ผ ํ•œ๋‹ค.(MUST)

  • ๋ฐœ์‹ ์ž๋Š” start-line๊ณผ ์ฒซ ๋ฒˆ์งธ ํ—ค๋” ํ•„๋“œ ์‚ฌ์ด์— ๊ณต๋ฐฑ์„ ๋ณด๋‚ด๋ฉด ์•ˆ ๋œ๋‹ค.(MUST NOT)

  • start-line ๊ณผ ์ฒซ ๋ฒˆ์งธ ํ—ค๋” ํ•„๋“œ ์‚ฌ์ด์˜ ๊ณต๋ฐฑ์„ ์ˆ˜์‹ ํ•˜๋Š” ์ˆ˜์‹ ์ž๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ์œ ํšจํ•˜์ง€ ์•Š์€ ๊ฒƒ์œผ๋กœ ๊ฑฐ๋ถ€ ํ•˜๊ฑฐ๋‚˜ ๋ฉ”์‹œ์ง€๋ฅผ ๋” ์ด์ƒ ์ฒ˜๋ฆฌํ•˜์ง€ ์•Š๊ณ  ๊ฐ ๊ณต๋ฐฑ์ด ์ง€์ •๋œ ์ค„์„ ์†Œ๋น„ํ•ด์•ผ ํ•œ๋‹ค.(MUST) (i.e., ๊ณต ๋ฐฑ์ด์˜ค๋Š”๋ชจ๋“ ํ›„์†์ค„๊ณผํ•จ๊ป˜, ์˜ฌ๋ฐ”๋ฅด๊ฒŒํ˜•์„ฑ๋œํ—ค๋”ํ•„๋“œ๊ฐ€์ˆ˜์‹ ๋˜๊ฑฐ๋‚˜ํ—ค๋”๋ถ€๋ฌธ์ด๋๋‚  ๋•Œ๊นŒ์ง€, ์ „์ฒด ๋ผ์ธ์„ ๋ฌด์‹œํ•œ๋‹ค)

3.1 Start Line

์š”์ฒญ๊ณผ ์‘๋‹ต ๋ฉ”์„ธ์ง€์˜ ์œ ์ผํ•œ ์ฐจ์ด๋Š” start line ๊ณผ ๋ฉ”์„ธ์ง€ body์˜ ๊ธธ์ด๋ฅผ ๊ฒฐ์ •ํ•˜๊ธฐ ์œ„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด๋‹ค. ์‹ค์งˆ์ ์œผ๋กœ๋Š” start line์œผ๋กœ ๊ตฌ๋ถ„์„ ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, ์„œ๋ฒ„๋Š” ์š”์ฒญ๋งŒ ๋ฐ›๋„๋ก ๊ตฌํ˜„๋˜๊ณ  ํด๋ผ์ด์–ธํŠธ๋Š” ์‘๋‹ต๋งŒ ๋ฐ›๋„๋ก ๊ตฌํ˜„๋œ๋‹ค.

start-line = request-line / status-line

3.1.1 Request Line

์š”์ฒญ ๋ฉ”์‹œ์ง€์˜ ์ฒซ ๋ฒˆ์งธ ์ค„์€ request-line ์ด๋‹ค.

request-line = method SP request-target SP HTTP-version CRLF

method ํ† ํฐ์€ ๋Œ€์ƒ ๋ฆฌ์†Œ์Šค๋ฅผ ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•œ ์š”์ฒญ ๋ฉ”์„œ๋“œ๋ฅผ ํ‘œ์‹œํ•œ๋‹ค. ์š”์ฒญ ๋ฉ”์„œ๋“œ๋Š” ๋Œ€์†Œ๋ฌธ์ž๋ฅผ ๊ตฌ๋ถ„ํ•œ๋‹ค.

request-target์€ Section 5.3์— ์ •์˜๋œ ๋Œ€๋กœ ์š”์ฒญ์„ ์ ์šฉํ•  ๋Œ€์ƒ ๋ฆฌ์†Œ์Šค๋ฅผ ์‹๋ณ„ํ•œ๋‹ค.

  • ์œ ํšจํ•˜์ง€ ์•Š์€ request-line์˜ ์ˆ˜์‹ ์ž๋Š” 400(Bad Request) ์˜ค๋ฅ˜ ๋˜๋Š” 301(Moved Permanently) ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ๋กœ ์‘๋‹ตํ•ด์•ผ ํ•˜๋ฉฐ, request-target์€ ์ ์ ˆํžˆ ์ธ์ฝ”๋”ฉ๋˜์–ด์•ผ ํ•œ๋‹ค.(SHOULD)

  • ์œ ํšจํ•˜์ง€ ์•Š์€ request-line์€ ์š”์ฒญ ์ฒด์ธ์„ ๋”ฐ๋ผ ๋ณด์•ˆ ํ•„ํ„ฐ๋ฅผ ์šฐํšŒํ•˜๋„๋ก ์˜๋„์ ์œผ ๋กœ ์กฐ์ž‘๋  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์ˆ˜์‹ ์ž๋Š” ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ ์—†์ด ์š”์ฒญ์„ ์ž๋™ ์ˆ˜์ •ํ•˜๊ณ  ์ฒ˜๋ฆฌํ•ด์„œ๋Š” ์•ˆ๋œ๋‹ค.(SHOULD NOT)

HTTP๋Š” Section 2.5์—์„œ ์„ค๋ช…ํ•œ ๊ฒƒ์ฒ˜๋Ÿผ request-line์˜ ๊ธธ์ด์— ๋Œ€ํ•ด ๋ฏธ๋ฆฌ ์ •์˜๋œ ์ œํ•œ์„ ๋‘ ์ง€ ์•Š๋Š”๋‹ค.

  • ๊ตฌํ˜„ํ•œ ๊ฒƒ๋ณด๋‹ค ๋” ๊ธด ๋ฉ”์„œ๋“œ๋ฅผ ์ˆ˜์‹ ํ•œ ์„œ๋ฒ„๋Š” 501(Not Implemented)์ƒํƒœ ์ฝ”๋“œ ๋กœ ์‘๋‹ตํ•ด์•ผ ํ•œ๋‹ค.(SHOULD)

  • request-target์„ ๊ตฌ๋ฌธ ๋ถ„์„ํ•˜๋ ค๋Š” URI๋ณด๋‹ค ๊ธด 414(URI Too Long)์ƒํƒœ ์ฝ”๋“œ๋กœ ์‘๋‹ตํ•ด์•ผ ํ•œ๋‹ค.(MUST)([RFC95231]์˜ Section 6.5.12 ์ฐธ์กฐ)

  • ๋ชจ๋“  HTTP ๋ฐœ์‹ ์ž์™€ ์ˆ˜์‹ ์ž๋Š”, ์ตœ์†Œ 8000 octet ๊ธธ์ด์˜ request-line์„, ์ง€์›ํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•œ ๋‹ค.(RECOMMENDED)

3.1.2 Status Line

์‘๋‹ต ๋ฉ”์‹œ์ง€์˜ ์ฒซ ๋ฒˆ์งธ ์ค„์€ status-line ์ด๋‹ค.

status-line = HTTP-version SP status-code SP reason-phrase CRLF

reason-phrase ์š”์†Œ๋Š” ์ˆซ์ž ์ƒํƒœ ์ฝ”๋“œ์™€ ๊ด€๋ จ๋œ ํ…์ŠคํŠธ ์„ค๋ช…์„ ์ œ๊ณตํ•˜๋Š” ์œ ์ผํ•œ ๋ชฉ์ ์œผ๋กœ ์กด์žฌํ•œ๋‹ค.

  • ํด๋ผ์ด์–ธํŠธ๋Š” reason-phase ๋‚ด์šฉ์„ ๋ฌด์‹œํ•ด์•ผ ํ•œ๋‹ค.(SHOULD)

reason-phrase = *( HTAB / SP / VCHAR / obs-text )

3.2 Header Fields

๊ฐ ํ—ค๋” ํ•„๋“œ๋Š” ๋Œ€์†Œ๋ฌธ์ž๋ฅผ ๊ตฌ๋ถ„ํ•˜์ง€ ์•Š๋Š” ํ•„๋“œ ์ด๋ฆ„ ๋’ค์— ์ฝœ๋ก (":"), ์„ ํƒ์  ์•ž์˜ ๊ณต๋ฐฑ (OWS), ํ•„๋“œ ๊ฐ’, ์„ ํƒ์  ๋’ค์˜ ๊ณต๋ฐฑ(OWS)์œผ๋กœ ๊ตฌ์„ฑ๋œ๋‹ค.

header-field = field-name ":" OWS field-value OWS

3.2.1 Field Extensibility

์ง€์ •๋œ ๋ฉ”์‹œ์ง€์— ์‚ฌ์šฉ๋˜๋Š” ํ—ค๋” ํ•„๋“œ์˜ ๊ฐœ์ˆ˜์—๋„ ์ œํ•œ์ด ์—†๋‹ค.

  • field-name์ด Connection ํ—ค๋” ํ•„๋“œ(Section 6.1)์— ๋‚˜์—ด๋˜์–ด ์žˆ์ง€ ์•Š๊ฑฐ๋‚˜ ํ”„์‹œ๊ฐ€ ์ด๋Ÿฌ ํ•œ ํ•„๋“œ๋ฅผ ์ฐจ๋‹จํ•˜๊ฑฐ๋‚˜ ๋ณ€ํ™˜ํ•˜๋„๋ก ํŠน๋ณ„ํžˆ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์ง€ ์•Š๋Š” ๊ฒฝ์šฐ, ํ”„๋ก๋Š” ์ธ์‹ํ•˜์ง€ ๋ชปํ•˜๋Š” ํ—ค๋” ํ•„๋“œ๋ฅผ ์ „๋‹ฌํ•ด์•ผ ํ•œ๋‹ค.(MUST)

  • ๋‹ค๋ฅธ ์ˆ˜์‹ ์ž๋Š” ์ธ์‹ํ•  ์ˆ˜ ์—†๋Š” ํ—ค๋” ํ•„๋“œ๋ฅผ ๋ฌด์‹œํ•ด์•ผ ํ•œ ๋‹ค.(SHOULD)

์ •์˜๋œ ๋ชจ๋“  ํ—ค๋” ํ•„๋“œ๋Š” [RFC7131] Section 8.3์— ์„ค๋ช…๋œ ๋Œ€๋กœ "Message Headers" ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์˜ IANA์— ๋“ฑ๋ก๋˜์–ด์•ผ ํ•œ๋‹ค.

3.2.2 Field Order

ํ—ค๋” ํ•„๋“œ์˜ ์ˆœ์„œ๋Š” ์ค‘์š”ํ•˜์ง€ ์•Š์œผ๋‚˜ ์š”์ฒญ ์‹œ Host, ์‘๋‹ต ์‹œ Date ๋“ฑ ์ œ์–ด ๋ฐ์ดํ„ฐ๊ฐ€ ํฌํ•จ๋œ ํ—ค๋” ํ•„๋“œ๋ฅผ ๋จผ์ € ๋ณด๋‚ด ๊ตฌํ˜„ ์‹œ ๋ฉ”์‹œ์ง€๋ฅผ ์ฒ˜๋ฆฌํ•˜์ง€ ์•Š์„ ์‹œ๊ธฐ๋ฅผ ๊ฒฐ์ •ํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค.

  • ์„œ๋ฒ„๋Š” ํ—ค๋” ํ•„๋“œ์—๋Š” ์กฐ๊ฑด, ์ธ์ฆ ์ž๊ฒฉ ์ฆ๋ช… ๋˜๋Š” ์š”์ฒญ ์ฒ˜๋ฆฌ์— ์˜ํ–ฅ์„ ๋ฏธ์น  ์ˆ˜ ์žˆ๋Š” ์˜๋„์ ์œผ๋กœ ์ž˜๋ชป๋œ ์ค‘๋ณต ํ—ค๋” ํ•„๋“œ๊ฐ€ ํฌํ•จ๋  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์ „์ฒด ์š”์ฒญ ํ—ค๋” ๋ถ€๋ฌธ์„ ๋ฐ›์„ ๋•Œ๊นŒ์ง€ ๋Œ€์ƒ ๋ฆฌ์†Œ์Šค์— ์š”์ฒญ์„ ์ ์šฉํ•˜๋ฉด ์•ˆ ๋œ๋‹ค.(MUST NOT)

  • ๋ฐœ์‹ ์ž๋Š” ํ—ค๋” ํ•„๋“œ์˜ ์ „์ฒด ํ•„๋“œ ๊ฐ’์ด ์‰ผํ‘œ๋กœ ๊ตฌ๋ถ„๋œ ๋ชฉ๋ก [i.e., #(values)]์œผ๋กœ ์ •์˜๋˜์–ด ์žˆ๊ฑฐ๋‚˜ ํ—ค๋” ํ•„๋“œ๊ฐ€ ์ž˜ ์•Œ๋ ค์ง„ ์˜ˆ์™ธ(์•„๋ž˜ ์„ค๋ช… ์ฐธ์กฐ)๊ฐ€ ์•„๋‹Œ ํ•œ, ๋ฉ”์‹œ์ง€์— ๋™์ผํ•œ ํ•„๋“œ ์ด๋ฆ„์„ ๊ฐ€์ง„ ํ—ค๋” ํ•„๋“œ๋ฅผ ์—ฌ๋Ÿฌ๊ฐœ ์ƒ์„ฑํ•ด์„œ๋Š” ์•ˆ ๋œ๋‹ค.(MUST NOT)

  • ์ˆ˜์‹ ์ž๋Š” ๊ฐ ํ›„์† ํ•„๋“œ ๊ฐ’์„ ์‰ผํ‘œ๋กœ ๊ตฌ๋ถ„ํ•˜์—ฌ ๊ฒฐํ•ฉ๋œ ํ•„๋“œ ๊ฐ’์— ์ˆœ์„œ๋Œ€๋กœ ์ถ”๊ฐ€ํ•˜์—ฌ ๋ฉ”์‹œ์ง€์˜ ์˜๋ฏธ๋ก ์„ ๋ณ€๊ฒฝํ•˜์ง€ ์•Š๊ณ  ๋™์ผํ•œ ํ•„๋“œ ์ด๋ฆ„์„ ๊ฐ€์ง„ ์—ฌ๋Ÿฌ ํ—ค๋” ํ•„๋“œ๋ฅผ ํ•˜๋‚˜์˜ โ€œfield-name: field-valueโ€œ ์Œ์œผ๋กœ ๊ฒฐํ•ฉํ•  ์ˆ˜ ์žˆ๋‹ค.(MAY)

  • ๋ฉ”์‹œ์ง€๋ฅผ ์ „๋‹ฌํ•  ๋•Œ ํ”„๋ฝ์‹œ๋Š” ์ด๋Ÿฌํ•œ ํ•„๋“œ ๊ฐ’์˜ ์ˆœ์„œ๋ฅผ ๋ณ€๊ฒฝํ•ด์„œ๋Š” ์•ˆ ๋œ๋‹ค.(MUST NOT)

์ฐธ๊ณ : ์‹ค์ œ๋กœ "Set-Cookie" ํ—ค๋” ํ•„๋“œ([RFC6065])๋Š” ์‘๋‹ต ๋ฉ”์‹œ์ง€์— ์—ฌ๋Ÿฌ๋ฒˆ ๋‚˜ํƒ€๋‚˜๋ฉฐ ๋ชฉ๋ก ๊ตฌ๋ฌธ์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์•„ ๋™์ผํ•œ ์ด๋ฆ„์˜ ์—ฌ๋Ÿฌ ํ—ค๋” ํ•„๋“œ์—์„œ ์œ„์˜ ์š”๊ตฌ ์‚ฌํ•ญ์„ ์œ„๋ฐ˜ํ•œ๋‹ค. ํ•„๋“œ ๊ฐ’์„ ํ•˜๋‚˜์˜ ํ•„๋“œ ๊ฐ’์œผ๋กœ ๊ฒฐํ•ฉํ•  ์ˆ˜ ์—†์œผ๋ฏ€๋กœ, ์ˆ˜์‹ ์ž๋Š” ํ—ค๋” ํ•„๋“œ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ๋™์•ˆ "Set-Cookie"๋ฅผ ํŠน๋ณ„ํ•œ ๊ฒฝ์šฐ๋กœ ์ฒ˜๋ฆฌํ•ด์•ผ ํ•œ๋‹ค. (์ž์„ธํ•œ ๋‚ด์šฉ์€ [Kri2001]์˜ Appendix A.2.3 ์„ ๋ด๋ผ.)

3.2.3 Whitespace

์ด ๋ช…์„ธ๋Š” OWS(optional whitespace ์„ ํƒ์  ๊ณต๋ฐฑ), RWD(required whitespace ํ•„์ˆ˜ ๊ณต๋ฐฑ)๋ฐ BWS(bad whitespace "๋ถˆ๋Ÿ‰" ๊ณต๋ฐฑ)์˜ ์‚ฌ์šฉ์„ ๋‚˜ํƒ€๋‚ด๋Š” ์„ธ ๊ฐ€์ง€ ๊ทœ์น™์„ ์‚ฌ์šฉํ•œ๋‹ค.

  • ๊ฐ€๋…์„ฑ์„ ํ–ฅ์ƒ์‹œํ‚ค๊ธฐ ์œ„ํ•ด ์„ ํƒ์ ์ธ ๊ณต๋ฐฑ(OWS)์„ ์„ ํ˜ธํ•˜๋Š” ํ”„๋กœํ† ์ฝœ ์š”์†Œ์˜ ๊ฒฝ์šฐ, ๋ฐœ์‹ ์ž๋Š” ๋‹จ์ผ SP๋กœ์„œ ์„ ํƒ์ ์ธ ๊ณต๋ฐฑ(OWS)๋ฅผ ์ƒ์„ฑํ•ด์•ผ ํ•œ๋‹ค. (SHOULD)

  • ๊ทธ๋ ‡์ง€ ์•Š์€๊ฒฝ์šฐ, ๋ฐœ์‹ ์ž๋Š” ๋‚ด๋ถ€ ๋ฉ”์‹œ์ง€ ํ•„ํ„ฐ๋ง ์ค‘์— ์œ ํšจํ•˜์ง€ ์•Š๊ฑฐ๋‚˜ ์›ํ•˜์ง€ ์•Š๋Š” ํ”„๋กœํ† ์ฝœ ์š”์†Œ๋ฅผ ํ™”์ดํŠธ ์•„์›ƒํ•˜๋Š”๋ฐ ํ•„์š”ํ•œ ๊ฒฝ์šฐ๋ฅผ ์ œ์™ธํ•˜๊ณ  ์„ ํƒ์  ๊ณต๋ฐฑ์„ ์ƒ์„ฑํ•ด์„œ๋Š” ์•ˆ ๋œ๋‹ค.(SHOULD NOT)

RWS ๊ทœ์น™์€ ํ•„๋“œ ํ† ํฐ์„ ๋ถ„๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ํ•˜๋‚˜ ์ด์ƒ์˜ ์„ ํ˜• ๊ณต๋ฐฑ octets์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ์— ์‚ฌ์šฉ๋œ๋‹ค.

  • ๋ฐœ์‹ ์ž๋Š” ๋‹จ์ผ SP๋กœ์„œ RWS๋ฅผ ์ƒ์„ฑํ•ด์•ผ ํ•œ๋‹ค.(SHOULD)

BWS ๊ทœ์น™์€ ์˜ค์ง ์—ญ์‚ฌ์ ์ธ ์ด์œ ๋กœ ์„ ํƒ์ ์ธ ๊ณต๋ฐฑ(OWS)์„ ํ—ˆ๋ฝํ•˜๋Š” ๋ฌธ๋ฒ•์—์„œ ์‚ฌ์šฉ๋œ๋‹ค.

  • ๋ฐœ์‹ ์ž๋Š” ๋ฉ”์‹œ์ง€์—์„œ BWS๋ฅผ ์ƒ์„ฑํ•ด์„œ๋Š” ์•ˆ๋œ๋‹ค.(MUST NOT)

  • ์ˆ˜์‹ ์ž๋Š” ์ด๋Ÿฌํ•œ ์ž˜๋ชป๋œ ๊ณต๋ฐฑ์„ ๊ตฌ๋ฌธ ๋ถ„์„ํ•œ ํ›„ ํ”„๋กœํ† ์ฝœ ์š”์†Œ๋ฅผ ํ•ด์„ํ•˜๊ธฐ ์ „์— ์ œ๊ฑฐํ•ด์•ผ ํ•œ๋‹ค.(MUST)

3.2.4 Field Parsing

๋ฉ”์‹œ์ง€๋Š” ๊ฐœ๋ณ„ ํ—ค๋” ํ•„๋“œ ์ด๋ฆ„๊ณผ ๋…๋ฆฝ์ ์œผ๋กœ ์ผ๋ฐ˜์ ์ธ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ตฌ๋ฌธ ๋ถ„์„๋œ๋‹ค.

ํ—ค๋” field-name๊ณผ ์ฝœ๋ก  ์‚ฌ์ด์—๋Š” ๊ณต๋ฐฑ์ด ํ—ˆ์šฉ๋˜์ง€ ์•Š๋Š”๋‹ค.

  • ์„œ๋ฒ„๋Š” ์‘๋‹ต ์ฝ”๋“œ๊ฐ€ 400(Bad Request)๊ณผ ํ•จ๊ป˜ ํ—ค๋” ํ•„๋“œ ์ด๋ฆ„๊ณผ ์ฝœ๋ก  ์‚ฌ์ด์— ๊ณต๋ฐฑ์ด ํฌํ•จ๋œ ์ˆ˜์‹ ๋œ ์š”์ฒญ ๋ฉ”์‹œ์ง€ ๋ฅผ ๊ฑฐ๋ถ€ํ•ด์•ผ ํ•œ๋‹ค.(MUST)

  • ํ”„๋ฝ์‹œ๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ๋‹ค์šด ์ŠคํŠธ๋ฆผ์œผ๋กœ ์ „๋‹ฌํ•˜๊ธฐ ์ „์— ์‘๋‹ต ๋ฉ”์‹œ์ง€์—์„œ ์ด๋Ÿฌํ•œ ๊ณต๋ฐฑ์„ ๋ชจ๋‘ ์ œ๊ฑฐํ•ด์•ผ ํ•œ๋‹ค.(MUST)

์—ญ์‚ฌ์ ์œผ๋กœ, HTTP ํ—ค๋” ํ•„๋“œ ๊ฐ’์„ ๊ฐ ์—ฌ๋Ÿฌ ์ค„ ์•ž์— ์ตœ์†Œ ํ•˜๋‚˜ ์ด์ƒ์˜ ๊ณต๋ฐฑ ๋˜๋Š” ์ˆ˜ํ‰ ํƒญ(obs- fold)์„ ๋‘์–ด ์—ฌ๋Ÿฌ์ค„๋กœ ํ™•์žฅํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค.

  • ๋ฐœ์‹ ์ž๋Š” ๋ฉ”์‹œ์ง€๊ฐ€ ๋ผ์ธ ํด๋”ฉ(์ฆ‰, obs-fold ๊ทœ์น™๊ณผ ์ผ์น˜ํ•˜๋Š” field- value ํฌํ•จ)์„ ํฌํ•จํ•˜๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ์ƒ์„ฑํ•ด์„œ๋Š” ์•ˆ๋œ๋‹ค. ๋‹จ, message/http ๋ฏธ๋””์–ด ํƒ€์ž… ๋‚ด์—์„œ ํŒจํ‚ค์ง• ๋˜๋„๋ก ์˜๋„๋œ๊ฒƒ๋“ค์€ ํ—ˆ์šฉํ•œ๋‹ค. (MUST NOT)

  • message/http ์ปจํ…Œ์ด๋„ˆ ๋‚ด์— ์—†๋Š” ์š”์ฒญ ๋ฉ”์‹œ์ง€์—์„œ obs-fold๋ฅผ ์ˆ˜์‹ ํ•˜๋Š” ์„œ๋ฒ„๋Š” 400(Bad Request)์„ ๋ฐœ์†กํ•˜์—ฌ ๋ฉ”์‹œ์ง€๋ฅผ ๊ฑฐ๋ถ€ํ•ด์•ผ ํ•œ๋‹ค.(MUST)

  • message/http ์ปจํ…Œ์ด๋„ˆ ๋‚ด์— ์—†๋Š” ์‘๋‹ต ๋ฉ”์‹œ์ง€์—์„œ obs-fold๋ฅผ ์ˆ˜์‹ ํ•˜๋Š” ํ”„๋ฝ์‹œ ๋˜๋Š” ๊ฒŒ์ดํŠธ์›จ์ด๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ์‚ญ์ œํ•˜๊ณ  502(Bad Gateway) ์‘๋‹ต์œผ๋กœ ๋Œ€์ฒดํ•ด์•ผ ํ•œ๋‹ค. (MUST)

  • message/http ์ปจํ…Œ์ด๋„ˆ ๋‚ด์— ์—†๋Š” ์‘๋‹ต ๋ฉ”์‹œ์ง€์—์„œ obs-fold๋ฅผ ์ˆ˜์‹ ํ•˜๋Š” ์‚ฌ์šฉ์ž ์—์ด์ „ํŠธ๋Š” ํ•„๋“œ ๊ฐ’์„ ํ•ด์„ํ•˜๊ธฐ ์ „์—, ์ˆ˜์‹ ๋œ ๊ฐ obs-fold๋ฅผ ํ•˜๋‚˜ ๋˜๋Š” ๋” ๋งŽ์€ SP octets ์œผ๋กœ ๋Œ€์ฒดํ•ด ์•ผ ํ•œ๋‹ค.(MUST)

  • ์ƒˆ๋กœ ์ •์˜๋œ ํ—ค๋” ํ•„๋“œ๋Š” ํ•„๋“œ ๊ฐ’์„ US-ASCII octet์œผ๋กœ ์ œํ•œํ•ด์•ผ ํ•œ๋‹ค.(SHOULD)

  • ์ˆ˜์‹ ์ž๋Š” ํ•„๋“œ ๋‚ด์šฉ(obs-text)์˜ ๋‹ค๋ฅธ octet์„ ๋ถˆํˆฌ๋ช… ๋ฐ์ดํ„ฐ๋กœ ์ฒ˜๋ฆฌํ•ด์•ผ ํ•œ๋‹ค.(SHOULD)

3.2.5 Field Limits

  • ์ฒ˜๋ฆฌํ•˜๋ ค๋Š” ๊ฒƒ๋ณด๋‹ค ํฐ ์š”์ฒญ ํ—ค๋” ํ•„๋“œ ๋˜๋Š” ํ•„๋“œ ์ง‘ํ•ฉ์„ ์ˆ˜์‹ ํ•˜๋Š” ์„œ๋ฒ„๋Š” ์ ์ ˆํ•œ 4xx(Client Error)์ƒํƒœ ์ฝ”๋“œ๋กœ ์‘๋‹ตํ•ด์•ผ ํ•œ๋‹ค.(MUST)

์ด๋Ÿฌํ•œ ํ—ค๋” ํ•„๋“œ๋ฅผ ๋ฌด์‹œํ•˜๋ฉด ์„œ๋ฒ„์˜ smuggling ๊ณต๊ฒฉ ์ทจ์•ฝ์„ฑ์ด ์ฆ๊ฐ€ํ•œ๋‹ค(Section 9.5).

3.2.6 Field Value Components

๋Œ€๋ถ€๋ถ„์˜ HTTP ํ—ค๋” ํ•„๋“œ ๊ฐ’์€ ๊ณต๋ฐฑ ๋˜๋Š” ํŠน์ • ๊ตฌ๋ถ„ ๋ฌธ์ž๋กœ ๊ตฌ๋ถ„๋œ ์ผ๋ฐ˜ ๊ตฌ๋ฌธ ๊ตฌ์„ฑ ์š”์†Œ (token, quoted-string ๋ฐ comment)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ •์˜๋œ๋‹ค. ๊ตฌ๋ถ„ ๊ธฐํ˜ธ๋Š” ํ† ํฐ (DQUOTE and โ€œ(),/:;<=>?@[\]{}")์— ํ—ˆ์šฉ๋˜์ง€ ์•Š๋Š” US-ASCII ์‹œ๊ฐ์  ๋ฌธ์ž ์ง‘ํ•ฉ์—์„œ ์„ ํƒ๋œ๋‹ค.

ํ…์ŠคํŠธ ๋ฌธ์ž๋Š” double-quote๋กœ ๋ฌถ์—ฌ ์žˆ์œผ๋ฉด ํ•˜๋‚˜์˜ ๊ฐ’์œผ๋กœ ๋ถ„์„๋œ๋‹ค.

  • quoted-string ๊ฐ’์„ ์ฒ˜๋ฆฌํ•˜๋Š” ์ˆ˜์‹ ์ž๋Š” quoted-pair๋ฅผ ๋ฐฑ์Šฌ๋ž˜์‹œ๋กœ octet์— ์˜ํ•ด ๋Œ€์ฒด๋œ ๊ฒƒ ์ฒ˜๋Ÿผ ์ฒ˜๋ฆฌํ•ด์•ผ ํ•œ๋‹ค.(MUST)

  • ๋ฐœ์‹ ์ž๋Š” DQUOTE์™€ ๋ฐฑ์Šฌ๋ž˜์‹œ octets์„ ํ•ด๋‹น ๋ฌธ์ž์— ์ธ์šฉํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ๋ฅผ ์ œ์™ธํ•˜๊ณ  quoted-string์—์„œ quoted-pair๋ฅผ ์ƒ์„ฑ๋ฉด ์•ˆ ๋œ๋‹ค.(SHOULD NOT)

  • ๋ฐœ์‹ ์ž๋Š” ๊ด„ํ˜ธ[โ€œ(โ€œandโ€)โ€]์™€ backslash octets๋ฅผ ํ•ด๋‹น ์ฃผ์„์— ์ธ์šฉํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ๋ฅผ ์ œ์™ธํ•˜๊ณ  comment ๋‚ด์— quoted-pair๋ฅผ ์ƒ์„ฑํ•˜๋ฉด ์•ˆ ๋œ๋‹ค.(SHOULD NOT)

3.3 Message Body

HTTP ๋ฉ”์‹œ์ง€์˜ ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ(์žˆ๋Š” ๊ฒฝ์šฐ)์€ ํ•ด๋‹น ์š”์ฒญ ๋˜๋Š” ์‘๋‹ต์˜ ํŽ˜์ด๋กœ๋“œ ๋ณธ๋ฌธ์„ ์ „๋‹ฌํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋œ๋‹ค.

๋ฉ”์‹œ์ง€์—์„œ ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์ด ํ—ˆ์šฉ๋˜๋Š” ์‹œ๊ธฐ์— ๋Œ€ํ•œ ๊ทœ์น™์€ ์š”์ฒญ๊ณผ ์‘๋‹ต์— ๋”ฐ๋ผ ๋‹ค๋ฅด๋‹ค.

์š”์ฒญ์—์„œ ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์ด ์žˆ์œผ๋ฉด Content-Length ๋˜๋Š” Transfer-Encoding ํ—ค๋” ํ•„๋“œ๋กœ ํ‘œ์‹œ๋œ๋‹ค. ์‘๋‹ต์—์„œ ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์˜ ์กด์žฌ ์—ฌ๋ถ€๋Š” ์‘๋‹ตํ•˜๋Š” ์š”์ฒญ ๋ฉ”์„œ๋“œ์™€ ์‘๋‹ต ์ƒํƒœ ์ฝ”๋“œ(Section 3.1.2)์— ๋”ฐ๋ผ ๋‹ฌ๋ผ์ง„๋‹ค.

  • HEAD ์š”์ฒญ ๋ฉ”์„œ๋“œ([RFC7231]์˜ Section 4.3.2)์— ๋Œ€ํ•œ ์‘๋‹ต์€ ๊ด€๋ จ ์‘๋‹ต ํ—ค๋” ํ•„๋“œ(์˜ˆ:Transfer-Encoding, Content-Length, ๋“ฑ)๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ ์š”์ฒญ ๋ฉ”์„œ๋“œ๊ฐ€ GET([RFC7231]์˜ Section 4.3.1) ๋˜์—ˆ์„ ๋•Œ์˜ ๊ฐ’๋งŒ ๋‚˜ํƒ€๋‚ด๋ฏ€๋กœ ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์„ ํฌํ•จํ•˜์ง€ ์•Š๋Š”๋‹ค.

  • CONNECT ์š”์ฒญ ๋ฉ”์„œ๋“œ([RFC7231]์˜ Section 4.3.6)์— 2xx (Successful) ์‘๋‹ต์€ ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ ๋Œ€์‹  ํ„ฐ๋„ ๋ชจ๋“œ๋กœ ์ „ํ™˜ํ•œ๋‹ค.

  • ๋ชจ๋“  1xx (informational), 204 (No Content) ๋ฐ 304 (Not Modified) ์‘๋‹ต์—๋Š” ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์ด ํฌํ•จ๋˜์ง€ ์•Š๋Š”๋‹ค.

  • ๋‹ค๋ฅธ ๋ชจ๋“  ์‘๋‹ต์—๋Š” ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์ด ํฌํ•จ๋˜์ง€๋งŒ, ๋ณธ๋ฌธ์˜ ๊ธธ์ด๋Š” 0์ผ ์ˆ˜ ์žˆ๋‹ค.

3.3.1 Transfer-Encoding

Transfer-Encoding ํ—ค๋” ํ•„๋“œ์—๋Š” ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์„ ํ˜•์„ฑํ•˜๊ธฐ ์œ„ํ•ด ํŽ˜์ด ๋กœ๋“œ ๋ณธ๋ฌธ์— ์ ์šฉ๋œ(๋˜ ๋Š” ์ ์šฉ๋ ) ์ „์†ก ์ฝ”๋”ฉ ์ˆœ์„œ์— ํ•ด๋‹นํ•˜๋Š” ์ „์†ก ์ฝ”๋”ฉ ์ด๋ฆ„์„ ๋‚˜์—ดํ•œ๋‹ค.

Transfer-Encoding = 1#transfer-coding

HTTP์˜ ๊ฒฝ์šฐ, Transfer-Encoding์€ ์ฃผ๋กœ ๋™์ ์œผ๋กœ ์ƒ์„ฑ๋˜๋Š” ํŽ˜์ด ๋กœ๋“œ๋ฅผ ์ •ํ™•ํ•˜๊ฒŒ ์ง€์ •ํ•˜๊ณ  ์ „์†ก ํšจ์œจ์„ฑ ๋˜๋Š” ๋ณด์•ˆ์„ ์œ„ํ•ด์„œ๋งŒ ์ ์šฉ๋˜๋Š” ํŽ˜์ด ๋กœ๋“œ ์ธ์ฝ”๋”ฉ๊ณผ, ์„ ํƒ๋œ ๋ฆฌ์†Œ์Šค์˜ ํŠน์ง•์ธ ํŽ˜์ด ๋กœ๋“œ ๋กœ ๊ตฌ๋ถ„ํ•˜๊ธฐ ์œ„ํ•œ ๊ฒƒ์ด๋‹ค.

  • ํŽ˜์ด ๋กœ๋“œ ๋ณธ๋ฌธ ํฌ๊ธฐ๋ฅผ ๋ฏธ๋ฆฌ ์•Œ์ง€ ๋ชปํ•  ๋•Œ ๋ฉ”์‹œ์ง€ ํ”„๋ ˆ์ž„์— ์ค‘์š”ํ•œ ์—ญํ• ์„ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ˆ˜์‹ ์ž๋Š” ์ฒญ ์ „์†ก ์ฝ”๋”ฉ(Section 4.1)์„ ๊ตฌ๋ฌธ ๋ถ„์„ํ•  ์ˆ˜ ์žˆ์–ด์•ผ ํ•œ๋‹ค. (MUST)

  • ๋ฐœ์‹ ์ž๋Š” ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ ์— ๋‘๋ฒˆ ์ด์ƒ ์ฒญํฌ ๋ถ„ํ• ๋œ ๋ฉ”์‹œ์ง€๋ฅผ ์ ์šฉํ•ด์„œ๋Š” ์•ˆ ๋œ๋‹ค.(MUST NOT) (i.e., ์ด๋ฏธ ์ฒญํฌ ๋ถ„ํ• ๋œ ๋ฉ” ์‹œ์ง€๋Š” ํ—ˆ์šฉ๋˜์ง€ ์•Š๋Š”๋‹ค).

  • ์ฒญํฌ ๋ถ„ํ•  ์ด์™ธ์˜ ์ „์†ก ์ฝ”๋”ฉ์ด ์š”์ฒญ ํŽ˜์ด ๋กœ๋“œ ๋ณธ๋ฌธ์— ์ ์šฉ๋˜๋Š” ๊ฒฝ ์šฐ, ๋ฐœ์‹ ์ž๋Š” ๋ฉ”์‹œ์ง€๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ํ”„๋ ˆ์ž„ ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ์ตœ์ข… ์ „์†ก ์ฝ”๋”ฉ์œผ๋กœ ์ฒญํฌ ๋ถ„ ํ• ์„ ์ ์šฉํ•ด์•ผ ํ•œ๋‹ค.(MUST)

๋‹ค์Œ

Transfer-Encoding: gzip, chunked

๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์„ ๊ตฌ์„ฑํ•˜๋Š” ๋™์•ˆ ํŽ˜์ด ๋กœ๋“œ ๋ณธ๋ฌธ์ด gzip ์ฝ”๋”ฉ์„ ์‚ฌ์šฉํ•˜์—ฌ ์••์ถ•๋œ ๋‹ค์Œ chunked ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ถ„ํ• ๋œ ๊ฒƒ์„ ๋‚˜ํƒ€๋‚ธ๋‹ค.

  • HEAD ์š”์ฒญ์— ์‘๋‹ต ํ•˜๊ฑฐ๋‚˜ ๋˜๋Š” 304(Not Modified) ์‘๋‹ต ([RFC7232]์˜ Section 4.1)์„ ํ†ตํ•ด GET ์š”์ฒญ์— ์‘๋‹ต ํ•˜๊ฑฐ๋‚˜, ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์„ ํฌํ•จํ•˜๊ฑฐ๋‚˜ ์กฐ๊ฑด ์—†๋Š” GET ์š”์ฒญ์ธ ๊ฒฝ์šฐ ์›์„œ๋ฒ„๊ฐ€ ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์— ์ „์†ก ์ฝ”๋”ฉ์„ ์ ์šฉ ํ–ˆ์„๊ฑฐ๋ผ๊ณ  ํ‘œ์‹œํ•˜๊ธฐ ์œ„ํ•ด Transfer-Encoding์ด ๋ณด๋‚ด์งˆ ์ˆ˜ ์žˆ๋‹ค.(MAY)

  • ์„œ๋ฒ„๋Š” ์ƒํƒœ ์ฝ”๋“œ๊ฐ€ 1xx (Informational) ๋˜๋Š” 204 (No Content) ์‘๋‹ต์—์„œ Transfer- Encoding ํ—ค๋” ํ•„๋“œ๋ฅผ ๋ณด๋‚ด๋ฉด ์•ˆ ๋œ๋‹ค.(MUST NOT)

  • ์„œ๋ฒ„๋Š” CONNECT ์š”์ฒญ์— 2xx (Successful) ์‘๋‹ต์—์„œ Transfer-Encoding ํ—ค๋” ํ•„๋“œ๋ฅผ ๋ณด๋‚ด ๋ฉด ์•ˆ ๋œ๋‹ค.(MUST NOT) ([RFC7131]์˜ Section 4.3.6).

HTTP/1.1์— Transfer-Encoding์ด ์ถ”๊ฐ€๋˜์—ˆ๋‹ค.

  • ํด๋ผ์ด์–ธํŠธ๋Š” ์„œ๋ฒ„๊ฐ€ HTTP/1.1(์ด์ƒ)์š”์ฒญ์„ ์ฒ˜๋ฆฌ ํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ์ด๋ผ๊ณ  ์•Œ์ง€ ๋ชปํ•˜๋Š” ํ•œ Transfer-Encoding์„ ํฌํ•จํ•˜๋Š” ์š”์ฒญ์„ ๋ณด๋‚ด๋ฉด ์•ˆ ๋œ๋‹ค.(MUST NOT)

  • ํ•ด๋‹น ์š”์ฒญ์ด HTTP/1.1(๋˜๋Š” ๊ทธ ์ด์ƒ)์„ ๋‚˜ํƒ€๋‚ด์ง€ ์•Š๋Š” ํ•œ ์„œ๋ฒ„๋Š” Transfer-Encoding์„ ํฌํ•จํ•˜๋Š” ์‘๋‹ต์„ ๋ณด๋‚ด๋ฉด ์•ˆ ๋œ๋‹ค.(MUST NOT)

  • ์ดํ•ดํ•˜์ง€ ๋ชปํ•˜๋Š” ์ „์†ก ์ฝ”๋”ฉ๊ณผ ํ•จ๊ป˜ ์š”์ฒญ ๋ฉ”์‹œ์ง€๋ฅผ ๋ฐ›๋Š” ์„œ๋ฒ„๋Š” 501 (Not Implemented)๋กœ ์‘๋‹ตํ•ด์•ผ ํ•œ๋‹ค.(SHOULD)

3.3.2 Content-Length

๋ฉ”์‹œ์ง€์— Transfer-Encoding ํ—ค๋” ํ•„๋“œ๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ, Content-Length ํ—ค๋” ํ•„๋“œ๋Š” ์ž ์žฌ์  ํŽ˜์ด ๋กœ๋“œ ๋ณธ๋ฌธ์— ๋Œ€ํ•ด ์˜ˆ์ƒ๋˜๋Š” ํฌ๊ธฐ๋ฅผ 10์ง„์ˆ˜๋กœ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ๋‹ค.

Content-Length = 1*DIGIT

  • ๋ฐœ์‹ ์ž๋Š” Transfer-Encoding ํ—ค๋” ํ•„๋“œ๋ฅผ ํฌํ•จํ•˜๋Š” ๋ฉ”์‹œ์ง€์—์„œ Content-Length ํ—ค๋” ํ•„๋“œ๋ฅผ ๋ณด๋‚ด๋ฉด ์•ˆ ๋œ๋‹ค.(MUST NOT)

  • Transfer-Encoding ์—†์ด ์ „์†กํ•˜๊ณ  ์š”์ฒญ ๋ฉ”์„œ๋“œ๊ฐ€ ๋™๋ด‰๋œ ํŽ˜์ด ๋กœ๋“œ ๋ณธ๋ฌธ์— ๋Œ€ํ•œ ์˜๋ฏธ๋ฅผ ์ •์˜ ํ•  ๋•Œ ์‚ฌ์šฉ์ž ์—์ด์ „ํŠธ๋Š” ์š”์ฒญ ๋ฉ”์‹œ์ง€์— Content-Length๋ฅผ ๋ณด๋‚ด์•ผ ํ•œ๋‹ค.(SHOULD)

  • ์š”์ฒญ ๋ฉ”์‹œ์ง€์— ํŽ˜์ด ๋กœ๋“œ ๋ณธ๋ฌธ์ด ํฌํ•จ๋˜์–ด ์žˆ์ง€ ์•Š๊ณ  ๋ฉ”์„œ๋“œ ์˜๋ฏธ๋ก ์ด ์ด๋Ÿฌํ•œ ๋ณธ๋ฌธ์„ ์˜ˆ์ƒํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ ์‚ฌ์šฉ์ž ์—์ด์ „ํŠธ๋Š” Content-length ํ—ค๋” ํ•„๋“œ๋ฅผ ๋ฐœ์†กํ•ด๋Š” ์•ˆ ๋œ๋‹ค.(SHOULD NOT)

  • ์„œ๋ฒ„๋Š” HEAD ์š”์ฒญ์— ๋Œ€ํ•œ ์‘๋‹ต์œผ๋กœ Content-Length ํ—ค๋” ํ•„๋“œ๋ฅผ ์ „์†กํ•  ์ˆ˜ ์žˆ๋‹ค. (MAY)

  • ์„œ๋ฒ„๋Š” ๋™์ผํ•œ ์š”์ฒญ์—์„œ GET ๋ฉ”์†Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•œ ๊ฒฝ์šฐ ์‘๋‹ต์˜ ํŽ˜์ด๋กœ๋“œ ๋ณธ๋ฌธ์— ์ „์†ก ๋œ 10์ง„์ˆ˜์™€ Content-Length์˜ field-value๊ฐ€ ๊ฐ™์ง€ ์•Š๋Š” ํ•œ, ์„œ๋ฒ„๋Š” ์‘๋‹ต์œผ๋กœ Content-Length๋ฅผ ๋ณด๋‚ด์„œ๋Š” ์•ˆ ๋œ๋‹ค.(MUST NOT)

์„œ๋ฒ„๋Š” ์กฐ๊ฑด๋ถ€ GET ์š”์ฒญ์— ๋Œ€ํ•ด 304 (Not Modified) ์‘๋‹ต์˜ Content-Length ํ—ค๋” ํ•„๋“œ๋ฅผ ๋ณด๋‚ผ ์ˆ˜ ์žˆ๋‹ค.

  • ํ•„๋“œ ๊ฐ’์ด ๋™์ผํ•œ ์š”์ฒญ์— ๋Œ€ํ•œ 200 (OK) ์‘๋‹ต์˜ ํŽ˜์ด๋กœ๋“œ ๋ณธ๋ฌธ์—์„œ ์ „์†ก๋œ 10์ง„์ˆ˜์™€ Content-Length์˜ field-value๊ฐ€ ๊ฐ™์ง€ ์•Š๋Š” ํ•œ, ์„œ๋ฒ„๋Š” ์‘๋‹ต์œผ๋กœ Content-Length๋ฅผ ๋ณด๋‚ด์„œ๋Š” ์•ˆ ๋œ๋‹ค.(MUST NOT)

  • ์„œ๋ฒ„๋Š” ์ƒํƒœ ์ฝ”๋“œ๊ฐ€ 1xx (Informational) ๋˜๋Š” 204 (No Content)์ธ ์‘๋‹ต์—์„œ Content- Lengthํ—ค๋” ํ•„๋“œ๋ฅผ ๋ณด๋‚ด๋ฉด ์•ˆ ๋œ๋‹ค.(MUST NOT)

  • ์„œ๋ฒ„๋Š” CONNECT ์š”์ฒญ์— ๋Œ€ํ•œ 2xx (Successful) ์‘๋‹ต์—์„œ Content-Length ํ—ค๋” ํ•„๋“œ๋ฅผ ๋ณด ๋‚ด์„œ๋Š” ์•ˆ ๋œ๋‹ค.(MUST NOT) ([RFC7231]์˜ Section 4.3.6)

  • ์œ„์— ์ •์˜๋œ ๊ฒฝ์šฐ์™€ ๋ณ„๋„๋กœ, Transfer-Encoding์ด ์—†๋Š” ๊ฒฝ์šฐ, ์ „์ฒด ํ—ค๋” ๋ถ€๋ฌธ์„ ๋ณด๋‚ด๊ธฐ ์ „์— ํŽ˜์ด ๋กœ๋“œ ๋ณธ๋ฌธ ํฌ๊ธฐ๋ฅผ ์•Œ๊ณ  ์žˆ๋Š” ์›์„œ๋ฒ„๋Š” Content-Length ํ—ค๋” ํ•„๋“œ๋ฅผ ๋ณด๋‚ด์•ผ ํ•œ๋‹ค. (SHOULD)

Content-Length ํ•„๋“œ ๊ฐ’์ด 0๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™์œผ๋ฉด ์œ ํšจํ•˜๋‹ค.

  • ํŽ˜์ด ๋กœ๋“œ ๊ธธ์ด์— ๋Œ€ํ•œ ์‚ฌ์ „ ์ •์˜ ๋œ ์ œํ•œ์ด ์—†์œผ๋ฏ€๋กœ ์ˆ˜์‹ ์ž๋Š” ์ž ์žฌ์ ์œผ๋กœ ํฐ 10์ง„์ˆ˜ ์ˆซ์ž๋ฅผ ์˜ˆ์ธกํ•˜๊ณ  ์ •์ˆ˜ ๋ณ€ํ™˜ ์˜ค๋ฒ„ ํ”Œ๋กœ์šฐ ๋กœ ์ธํ•œ ๊ตฌ๋ฌธ ๋ถ„์„ ์˜ค๋ฅ˜๋ฅผ ๋ฐฉ์ง€ํ•ด์•ผ ํ•œ๋‹ค.(MUST)

  • ์—ฌ๋Ÿฌ Content-Length ํ—ค๋” ํ•„๋“œ์™€ ํ•จ๊ป˜ ๋™์ผํ•œ 10์ง„์ˆ˜๋กœ ๊ตฌ์„ฑํ•˜๋Š” field-value๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๊ฑฐ๋‚˜, ๋˜๋Š” ๋‹จ๋… Content-Length ํ—ค๋” ํ•„๋“œ์™€ ํ•จ๊ป˜ ๋™์ผํ•œ 10์ง„์ˆ˜์˜ ๋ฆฌ์ŠคํŠธ๋กœ ๊ตฌ์„ฑํ•˜๋Š” field-value๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๊ฑฐ๋‚˜(์˜ˆ: โ€œContent-length:42, 42โ€), ์ค‘๋ณต๋œ Content-Length ํ—ค๋” ํ•„๋“œ๊ฐ€ ์ƒ์„ฑ๋˜๊ฑฐ๋‚˜ ์—…์ŠคํŠธ๋ฆผ ๋ฉ”์‹œ์ง€ ์ฒ˜๋ฆฌ๊ธฐ์— ์˜ํ•ด ๊ฒฐํ•ฉ๋œ ๊ฒƒ์œผ๋กœ ๋‚˜ํƒ€๋‚˜๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ๋ฐ›์€ ๊ฒฝ์šฐ, ๊ทธ๋•Œ ์ˆ˜์‹ ์ž๋Š” ์œ ํšจํ•˜์ง€ ์•Š์€ ๋ฉ”์‹œ์ง€๋ฅผ ๊ฑฐ๋ถ€ํ•˜๊ฑฐ๋‚˜, ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ ๊ธธ์ด๋ฅผ ๊ฒฐ์ •ํ•˜๋Š”๊ฒƒ ๋˜๋Š” ์ „์†ก๋˜๊ธฐ ์ „์— 10์ง„์ˆ˜๋ฅผ ํฌํ•จํ•˜๋Š” ์œ ํšจํ•œ ๋‹จ๋… Content-Length์™€ ํ•จ๊ป˜ ์ค‘๋ณต๋œ field-value ๋ฅผ ๋Œ€์ฒดํ•ด์•ผ ํ•œ๋‹ค.(MUST)

3.3.3 Message Body Length

๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์˜ ๊ธธ์ด๋Š” ๋‹ค์Œ ์ค‘ ํ•˜๋‚˜์— ์˜ํ•ด ๊ฒฐ์ •๋œ๋‹ค(์šฐ์„  ์ˆœ์œ„ ์ˆœ์„œ๋Œ€๋กœ):

๋ณธ๋ฌธ ์ฐธ์กฐ.

3.4 Handling Imcomplete Messages

์ผ๋ฐ˜์ ์œผ๋กœ ์ทจ์†Œ๋œ ์š”์ฒญ ๋˜๋Š” ํŠธ๋ฆฌ๊ฑฐ ๋œ ์‹œ๊ฐ„ ์ดˆ๊ณผ ์˜ˆ์™ธ ๋•Œ๋ฌธ์— ๋ฐœ์ƒํ•˜๋Š” ๋ถˆ์™„์ „ํ•œ ์š”์ฒญ ๋ฉ”์‹œ์ง€๋ฅผ ์ˆ˜์‹ ํ•˜๋Š” ์„œ๋ฒ„๋Š” ์ปค๋„ฅ์…˜์„ ๋‹ซ๊ธฐ ์ „์— ์˜ค๋ฅ˜ ์‘๋‹ต์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ๋‹ค.(MAY)

์ปค๋„ฅ์…˜์ด ์กฐ๊ธฐ์— ๋‹ซํžˆ๊ฑฐ๋‚˜ ์ฒญํฌ ๋ถ„ํ• ๋œ ์ „์†ก ์ฝ”๋”ฉ์„ ๋””์ฝ”๋”ฉ ํ•˜๋Š” ๋ฐ ์‹คํŒจํ•  ๋•Œ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ๋ถˆ์™„์ „ํ•œ ์‘๋‹ต ๋ฉ”์‹œ์ง€๋ฅผ ์ˆ˜์‹ ํ•˜๋Š” ํด๋ผ์ด์–ธํŠธ๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ๋ฐ˜๋“œ์‹œ ๋ถˆ์™„์ „ํ•œ ๋ฉ”์‹œ์ง€๋กœ ๊ธฐ๋กํ•ด์•ผ ํ•œ๋‹ค.(MUST)

RFC 7230 แ„‡แ…ฅแ†ซแ„‹แ…งแ†จ pdf

์ธ์ฝ”๋”ฉ์„ ์ข…๋ฃŒํ•˜๋Š” zero-sized(0)์˜ ์ฒญํฌ๊ฐ€ ์ˆ˜์‹ ๋˜์ง€ ์•Š์œผ๋ฉด ์ฒญํฌ ์ „์†ก ์ฝ”๋”ฉ์„ ์‚ฌ์šฉํ•˜๋Š” ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์€ ๋ถˆ์™„์ „ํ•˜๋‹ค.

์ˆ˜์‹ ๋œ ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์˜ ํฌ๊ธฐ(in octets)๊ฐ€ Content-Length์—์„œ ์ง€์ •ํ•œ ๊ฐ’๋ณด๋‹ค ์ž‘์€ ๊ฒฝ์šฐ ์œ ํšจํ•œ Content-Length๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฉ”์‹œ์ง€๋Š” ๋ถˆ์™„์ „ํ•˜๋‹ค.

3.5 Message Parsing Robustness

  • HTTP/1.1 ์‚ฌ์šฉ์ž ์—์ด์ „ํŠธ๋Š” ์ถ”๊ฐ€ CRLF๋กœ ์‹œ์ž‘ํ•˜๊ฑฐ๋‚˜ ์š”์ฒญ์„ ๋ฐ˜๋“œ์‹œ ๋”ฐ๋ฅด๋ฉด ์•ˆ ๋œ๋‹ค.(MUST NOT)

  • line-ending์œผ๋กœ ์š”์ฒญ ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ์„ ์ข…๋ฃŒํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ, ์‚ฌ์šฉ์ž ์—์ด์ „ํŠธ๋Š” ๋ฉ”์‹œ์ง€ ๋ณธ๋ฌธ ๊ธธ์ด์˜ ๋ถ€๋ถ„์œผ๋กœ์„œ ์ข…๋ฃŒ CRLF octet์„ ์„ธ์–ด์•ผ ํ•œ๋‹ค.(MUST)

  • HTTP ์š”์ฒญ ๋ฉ”์‹œ์ง€๋งŒ ์ฒญ์ทจํ•˜๊ฑฐ๋‚˜, HTTP ์š”์ฒญ ๋ฉ”์‹œ์ง€์ด๊ธฐ ์œ„ํ•ด start-line์—์„œ ๋‚˜ํƒ€๋‚˜๋Š” ๋‚ด์šฉ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ์„œ๋ฒ„๊ฐ€ ์œ„์— ๋‚˜์—ด๋œ ์—„๊ฒฉํ•จ ์˜ˆ์™ธ ์™ธ์—๋„ HTTP-message ๋ฌธ๋ฒ•๊ณผ ์ผ์น˜ํ•˜์ง€ ์•Š๋Š” octets์˜ ์‹œํ€ธ์Šค๋ฅผ ์ˆ˜์‹ ํ•˜๋Š” ๊ฒฝ์šฐ, ์„œ๋ฒ„๋Š” 400 (Bad Request)์‘๋‹ต์œผ๋กœ ์‘๋‹ตํ•ด์•ผ ํ•œ๋‹ค. (SHOULD)

Last updated