| 1 |
Transfer-Encoding header |
| 2 |
======================== |
| 3 |
|
| 4 |
## Trailing space on chunked body |
| 5 |
|
| 6 |
<!-- meta={"type": "response"} --> |
| 7 |
```http |
| 8 |
HTTP/1.1 200 OK |
| 9 |
Content-Type: text/plain |
| 10 |
Transfer-Encoding: chunked |
| 11 |
|
| 12 |
25 \r\n\ |
| 13 |
This is the data in the first chunk |
| 14 |
|
| 15 |
1C |
| 16 |
and this is the second one |
| 17 |
|
| 18 |
0 \r\n\ |
| 19 |
|
| 20 |
|
| 21 |
``` |
| 22 |
|
| 23 |
```log |
| 24 |
off=0 message begin |
| 25 |
off=5 len=3 span[version]="1.1" |
| 26 |
off=8 version complete |
| 27 |
off=13 len=2 span[status]="OK" |
| 28 |
off=17 status complete |
| 29 |
off=17 len=12 span[header_field]="Content-Type" |
| 30 |
off=30 header_field complete |
| 31 |
off=31 len=10 span[header_value]="text/plain" |
| 32 |
off=43 header_value complete |
| 33 |
off=43 len=17 span[header_field]="Transfer-Encoding" |
| 34 |
off=61 header_field complete |
| 35 |
off=62 len=7 span[header_value]="chunked" |
| 36 |
off=71 header_value complete |
| 37 |
off=73 headers complete status=200 v=1/1 flags=208 content_length=0 |
| 38 |
off=76 error code=12 reason="Invalid character in chunk size" |
| 39 |
``` |
| 40 |
|
| 41 |
## `chunked` before other transfer-encoding |
| 42 |
|
| 43 |
<!-- meta={"type": "response"} --> |
| 44 |
```http |
| 45 |
HTTP/1.1 200 OK |
| 46 |
Accept: */* |
| 47 |
Transfer-Encoding: chunked, deflate |
| 48 |
|
| 49 |
World |
| 50 |
``` |
| 51 |
|
| 52 |
```log |
| 53 |
off=0 message begin |
| 54 |
off=5 len=3 span[version]="1.1" |
| 55 |
off=8 version complete |
| 56 |
off=13 len=2 span[status]="OK" |
| 57 |
off=17 status complete |
| 58 |
off=17 len=6 span[header_field]="Accept" |
| 59 |
off=24 header_field complete |
| 60 |
off=25 len=3 span[header_value]="*/*" |
| 61 |
off=30 header_value complete |
| 62 |
off=30 len=17 span[header_field]="Transfer-Encoding" |
| 63 |
off=48 header_field complete |
| 64 |
off=49 len=16 span[header_value]="chunked, deflate" |
| 65 |
off=67 header_value complete |
| 66 |
off=69 headers complete status=200 v=1/1 flags=200 content_length=0 |
| 67 |
off=69 len=5 span[body]="World" |
| 68 |
``` |
| 69 |
|
| 70 |
## multiple transfer-encoding where chunked is not the last one |
| 71 |
|
| 72 |
<!-- meta={"type": "response"} --> |
| 73 |
```http |
| 74 |
HTTP/1.1 200 OK |
| 75 |
Accept: */* |
| 76 |
Transfer-Encoding: chunked |
| 77 |
Transfer-Encoding: identity |
| 78 |
|
| 79 |
World |
| 80 |
``` |
| 81 |
|
| 82 |
```log |
| 83 |
off=0 message begin |
| 84 |
off=5 len=3 span[version]="1.1" |
| 85 |
off=8 version complete |
| 86 |
off=13 len=2 span[status]="OK" |
| 87 |
off=17 status complete |
| 88 |
off=17 len=6 span[header_field]="Accept" |
| 89 |
off=24 header_field complete |
| 90 |
off=25 len=3 span[header_value]="*/*" |
| 91 |
off=30 header_value complete |
| 92 |
off=30 len=17 span[header_field]="Transfer-Encoding" |
| 93 |
off=48 header_field complete |
| 94 |
off=49 len=7 span[header_value]="chunked" |
| 95 |
off=58 header_value complete |
| 96 |
off=58 len=17 span[header_field]="Transfer-Encoding" |
| 97 |
off=76 header_field complete |
| 98 |
off=77 len=8 span[header_value]="identity" |
| 99 |
off=87 header_value complete |
| 100 |
off=89 headers complete status=200 v=1/1 flags=200 content_length=0 |
| 101 |
off=89 len=5 span[body]="World" |
| 102 |
``` |
| 103 |
|
| 104 |
## `chunkedchunked` transfer-encoding does not enable chunked enconding |
| 105 |
|
| 106 |
This check that the word `chunked` repeat more than once (with or without spaces) does not mistakenly enables chunked encoding. |
| 107 |
|
| 108 |
<!-- meta={"type": "response"} --> |
| 109 |
```http |
| 110 |
HTTP/1.1 200 OK |
| 111 |
Accept: */* |
| 112 |
Transfer-Encoding: chunkedchunked |
| 113 |
|
| 114 |
2 |
| 115 |
OK |
| 116 |
0 |
| 117 |
|
| 118 |
|
| 119 |
``` |
| 120 |
|
| 121 |
```log |
| 122 |
off=0 message begin |
| 123 |
off=5 len=3 span[version]="1.1" |
| 124 |
off=8 version complete |
| 125 |
off=13 len=2 span[status]="OK" |
| 126 |
off=17 status complete |
| 127 |
off=17 len=6 span[header_field]="Accept" |
| 128 |
off=24 header_field complete |
| 129 |
off=25 len=3 span[header_value]="*/*" |
| 130 |
off=30 header_value complete |
| 131 |
off=30 len=17 span[header_field]="Transfer-Encoding" |
| 132 |
off=48 header_field complete |
| 133 |
off=49 len=14 span[header_value]="chunkedchunked" |
| 134 |
off=65 header_value complete |
| 135 |
off=67 headers complete status=200 v=1/1 flags=200 content_length=0 |
| 136 |
off=67 len=1 span[body]="2" |
| 137 |
off=68 len=1 span[body]=cr |
| 138 |
off=69 len=1 span[body]=lf |
| 139 |
off=70 len=2 span[body]="OK" |
| 140 |
off=72 len=1 span[body]=cr |
| 141 |
off=73 len=1 span[body]=lf |
| 142 |
off=74 len=1 span[body]="0" |
| 143 |
off=75 len=1 span[body]=cr |
| 144 |
off=76 len=1 span[body]=lf |
| 145 |
off=77 len=1 span[body]=cr |
| 146 |
off=78 len=1 span[body]=lf |
| 147 |
``` |
| 148 |
|
| 149 |
## Chunk extensions |
| 150 |
|
| 151 |
<!-- meta={"type": "response"} --> |
| 152 |
```http |
| 153 |
HTTP/1.1 200 OK |
| 154 |
Host: localhost |
| 155 |
Transfer-encoding: chunked |
| 156 |
|
| 157 |
5;ilovew3;somuchlove=aretheseparametersfor |
| 158 |
hello |
| 159 |
6;blahblah;blah |
| 160 |
world |
| 161 |
0 |
| 162 |
|
| 163 |
|
| 164 |
``` |
| 165 |
|
| 166 |
```log |
| 167 |
off=0 message begin |
| 168 |
off=5 len=3 span[version]="1.1" |
| 169 |
off=8 version complete |
| 170 |
off=13 len=2 span[status]="OK" |
| 171 |
off=17 status complete |
| 172 |
off=17 len=4 span[header_field]="Host" |
| 173 |
off=22 header_field complete |
| 174 |
off=23 len=9 span[header_value]="localhost" |
| 175 |
off=34 header_value complete |
| 176 |
off=34 len=17 span[header_field]="Transfer-encoding" |
| 177 |
off=52 header_field complete |
| 178 |
off=53 len=7 span[header_value]="chunked" |
| 179 |
off=62 header_value complete |
| 180 |
off=64 headers complete status=200 v=1/1 flags=208 content_length=0 |
| 181 |
off=66 len=7 span[chunk_extension_name]="ilovew3" |
| 182 |
off=74 chunk_extension_name complete |
| 183 |
off=74 len=10 span[chunk_extension_name]="somuchlove" |
| 184 |
off=85 chunk_extension_name complete |
| 185 |
off=85 len=21 span[chunk_extension_value]="aretheseparametersfor" |
| 186 |
off=107 chunk_extension_value complete |
| 187 |
off=108 chunk header len=5 |
| 188 |
off=108 len=5 span[body]="hello" |
| 189 |
off=115 chunk complete |
| 190 |
off=117 len=8 span[chunk_extension_name]="blahblah" |
| 191 |
off=126 chunk_extension_name complete |
| 192 |
off=126 len=4 span[chunk_extension_name]="blah" |
| 193 |
off=131 chunk_extension_name complete |
| 194 |
off=132 chunk header len=6 |
| 195 |
off=132 len=6 span[body]=" world" |
| 196 |
off=140 chunk complete |
| 197 |
off=143 chunk header len=0 |
| 198 |
off=145 chunk complete |
| 199 |
off=145 message complete |
| 200 |
``` |
| 201 |
|
| 202 |
## No semicolon before chunk extensions |
| 203 |
|
| 204 |
<!-- meta={"type": "response"} --> |
| 205 |
```http |
| 206 |
HTTP/1.1 200 OK |
| 207 |
Host: localhost |
| 208 |
Transfer-encoding: chunked |
| 209 |
|
| 210 |
2 erfrferferf |
| 211 |
aa |
| 212 |
0 rrrr |
| 213 |
|
| 214 |
|
| 215 |
``` |
| 216 |
|
| 217 |
```log |
| 218 |
off=0 message begin |
| 219 |
off=5 len=3 span[version]="1.1" |
| 220 |
off=8 version complete |
| 221 |
off=13 len=2 span[status]="OK" |
| 222 |
off=17 status complete |
| 223 |
off=17 len=4 span[header_field]="Host" |
| 224 |
off=22 header_field complete |
| 225 |
off=23 len=9 span[header_value]="localhost" |
| 226 |
off=34 header_value complete |
| 227 |
off=34 len=17 span[header_field]="Transfer-encoding" |
| 228 |
off=52 header_field complete |
| 229 |
off=53 len=7 span[header_value]="chunked" |
| 230 |
off=62 header_value complete |
| 231 |
off=64 headers complete status=200 v=1/1 flags=208 content_length=0 |
| 232 |
off=66 error code=12 reason="Invalid character in chunk size" |
| 233 |
``` |
| 234 |
|
| 235 |
|
| 236 |
## No extension after semicolon |
| 237 |
|
| 238 |
<!-- meta={"type": "response"} --> |
| 239 |
```http |
| 240 |
HTTP/1.1 200 OK |
| 241 |
Host: localhost |
| 242 |
Transfer-encoding: chunked |
| 243 |
|
| 244 |
2; |
| 245 |
aa |
| 246 |
0 |
| 247 |
|
| 248 |
|
| 249 |
``` |
| 250 |
|
| 251 |
```log |
| 252 |
off=0 message begin |
| 253 |
off=5 len=3 span[version]="1.1" |
| 254 |
off=8 version complete |
| 255 |
off=13 len=2 span[status]="OK" |
| 256 |
off=17 status complete |
| 257 |
off=17 len=4 span[header_field]="Host" |
| 258 |
off=22 header_field complete |
| 259 |
off=23 len=9 span[header_value]="localhost" |
| 260 |
off=34 header_value complete |
| 261 |
off=34 len=17 span[header_field]="Transfer-encoding" |
| 262 |
off=52 header_field complete |
| 263 |
off=53 len=7 span[header_value]="chunked" |
| 264 |
off=62 header_value complete |
| 265 |
off=64 headers complete status=200 v=1/1 flags=208 content_length=0 |
| 266 |
off=67 error code=2 reason="Invalid character in chunk extensions" |
| 267 |
``` |
| 268 |
|
| 269 |
|
| 270 |
## Chunk extensions quoting |
| 271 |
|
| 272 |
<!-- meta={"type": "response"} --> |
| 273 |
```http |
| 274 |
HTTP/1.1 200 OK |
| 275 |
Host: localhost |
| 276 |
Transfer-Encoding: chunked |
| 277 |
|
| 278 |
5;ilovew3="I love; extensions";somuchlove="aretheseparametersfor";blah;foo=bar |
| 279 |
hello |
| 280 |
6;blahblah;blah |
| 281 |
world |
| 282 |
0 |
| 283 |
|
| 284 |
``` |
| 285 |
|
| 286 |
```log |
| 287 |
off=0 message begin |
| 288 |
off=5 len=3 span[version]="1.1" |
| 289 |
off=8 version complete |
| 290 |
off=13 len=2 span[status]="OK" |
| 291 |
off=17 status complete |
| 292 |
off=17 len=4 span[header_field]="Host" |
| 293 |
off=22 header_field complete |
| 294 |
off=23 len=9 span[header_value]="localhost" |
| 295 |
off=34 header_value complete |
| 296 |
off=34 len=17 span[header_field]="Transfer-Encoding" |
| 297 |
off=52 header_field complete |
| 298 |
off=53 len=7 span[header_value]="chunked" |
| 299 |
off=62 header_value complete |
| 300 |
off=64 headers complete status=200 v=1/1 flags=208 content_length=0 |
| 301 |
off=66 len=7 span[chunk_extension_name]="ilovew3" |
| 302 |
off=74 chunk_extension_name complete |
| 303 |
off=74 len=20 span[chunk_extension_value]=""I love; extensions"" |
| 304 |
off=94 chunk_extension_value complete |
| 305 |
off=95 len=10 span[chunk_extension_name]="somuchlove" |
| 306 |
off=106 chunk_extension_name complete |
| 307 |
off=106 len=23 span[chunk_extension_value]=""aretheseparametersfor"" |
| 308 |
off=129 chunk_extension_value complete |
| 309 |
off=130 len=4 span[chunk_extension_name]="blah" |
| 310 |
off=135 chunk_extension_name complete |
| 311 |
off=135 len=3 span[chunk_extension_name]="foo" |
| 312 |
off=139 chunk_extension_name complete |
| 313 |
off=139 len=3 span[chunk_extension_value]="bar" |
| 314 |
off=143 chunk_extension_value complete |
| 315 |
off=144 chunk header len=5 |
| 316 |
off=144 len=5 span[body]="hello" |
| 317 |
off=151 chunk complete |
| 318 |
off=153 len=8 span[chunk_extension_name]="blahblah" |
| 319 |
off=162 chunk_extension_name complete |
| 320 |
off=162 len=4 span[chunk_extension_name]="blah" |
| 321 |
off=167 chunk_extension_name complete |
| 322 |
off=168 chunk header len=6 |
| 323 |
off=168 len=6 span[body]=" world" |
| 324 |
off=176 chunk complete |
| 325 |
off=179 chunk header len=0 |
| 326 |
``` |
| 327 |
|
| 328 |
|
| 329 |
## Unbalanced chunk extensions quoting |
| 330 |
|
| 331 |
<!-- meta={"type": "response"} --> |
| 332 |
```http |
| 333 |
HTTP/1.1 200 OK |
| 334 |
Host: localhost |
| 335 |
Transfer-Encoding: chunked |
| 336 |
|
| 337 |
5;ilovew3="abc";somuchlove="def; ghi |
| 338 |
hello |
| 339 |
6;blahblah;blah |
| 340 |
world |
| 341 |
0 |
| 342 |
|
| 343 |
``` |
| 344 |
|
| 345 |
```log |
| 346 |
off=0 message begin |
| 347 |
off=5 len=3 span[version]="1.1" |
| 348 |
off=8 version complete |
| 349 |
off=13 len=2 span[status]="OK" |
| 350 |
off=17 status complete |
| 351 |
off=17 len=4 span[header_field]="Host" |
| 352 |
off=22 header_field complete |
| 353 |
off=23 len=9 span[header_value]="localhost" |
| 354 |
off=34 header_value complete |
| 355 |
off=34 len=17 span[header_field]="Transfer-Encoding" |
| 356 |
off=52 header_field complete |
| 357 |
off=53 len=7 span[header_value]="chunked" |
| 358 |
off=62 header_value complete |
| 359 |
off=64 headers complete status=200 v=1/1 flags=208 content_length=0 |
| 360 |
off=66 len=7 span[chunk_extension_name]="ilovew3" |
| 361 |
off=74 chunk_extension_name complete |
| 362 |
off=74 len=5 span[chunk_extension_value]=""abc"" |
| 363 |
off=79 chunk_extension_value complete |
| 364 |
off=80 len=10 span[chunk_extension_name]="somuchlove" |
| 365 |
off=91 chunk_extension_name complete |
| 366 |
off=91 len=9 span[chunk_extension_value]=""def; ghi" |
| 367 |
off=101 error code=2 reason="Invalid character in chunk extensions quoted value" |
| 368 |
``` |
| 369 |
|
| 370 |
|
| 371 |
## Invalid OBS fold after chunked value |
| 372 |
|
| 373 |
<!-- meta={"type": "response-lenient-headers" } --> |
| 374 |
```http |
| 375 |
HTTP/1.1 200 OK |
| 376 |
Transfer-Encoding: chunked |
| 377 |
abc |
| 378 |
|
| 379 |
5 |
| 380 |
World |
| 381 |
0 |
| 382 |
|
| 383 |
|
| 384 |
``` |
| 385 |
|
| 386 |
```log |
| 387 |
off=0 message begin |
| 388 |
off=5 len=3 span[version]="1.1" |
| 389 |
off=8 version complete |
| 390 |
off=13 len=2 span[status]="OK" |
| 391 |
off=17 status complete |
| 392 |
off=17 len=17 span[header_field]="Transfer-Encoding" |
| 393 |
off=35 header_field complete |
| 394 |
off=36 len=7 span[header_value]="chunked" |
| 395 |
off=45 len=5 span[header_value]=" abc" |
| 396 |
off=52 header_value complete |
| 397 |
off=54 headers complete status=200 v=1/1 flags=200 content_length=0 |
| 398 |
off=54 len=1 span[body]="5" |
| 399 |
off=55 len=1 span[body]=cr |
| 400 |
off=56 len=1 span[body]=lf |
| 401 |
off=57 len=5 span[body]="World" |
| 402 |
off=62 len=1 span[body]=cr |
| 403 |
off=63 len=1 span[body]=lf |
| 404 |
off=64 len=1 span[body]="0" |
| 405 |
off=65 len=1 span[body]=cr |
| 406 |
off=66 len=1 span[body]=lf |
| 407 |
off=67 len=1 span[body]=cr |
| 408 |
off=68 len=1 span[body]=lf |
| 409 |
``` |
| 410 |
|