| 280 | } |
| 281 | |
| 282 | inline void BuildInputChain() { |
| 283 | TParsedHeaders p; |
| 284 | |
| 285 | size_t pos = FirstLine_.rfind(' '); |
| 286 | // In HTTP/1.1 Keep-Alive is turned on by default |
| 287 | if (pos != TString::npos && strcmp(FirstLine_.c_str() + pos + 1, "HTTP/1.1") == 0) { |
| 288 | p.KeepAlive = true; //request |
| 289 | } else if (strnicmp(FirstLine_.data(), "HTTP/1.1", 8) == 0) { |
| 290 | p.KeepAlive = true; //reply |
| 291 | } |
| 292 | |
| 293 | for (THttpHeaders::TConstIterator h = Headers_.Begin(); h != Headers_.End(); ++h) { |
| 294 | const THttpInputHeader& header = *h; |
| 295 | switch (header.Name().size()) { |
| 296 | HEADERCMP(header, "transfer-encoding") { |
| 297 | TTrEnc f = {&p}; |
| 298 | ForEach(header.Value(), f); |
| 299 | } |
| 300 | break; |
| 301 | HEADERCMP(header, "content-encoding") { |
| 302 | p.LZipped = header.Value(); |
| 303 | } |
| 304 | break; |
| 305 | HEADERCMP(header, "accept-encoding") { |
| 306 | TAccCoding f = {&Codings_}; |
| 307 | ForEach(header.Value(), f); |
| 308 | } |
| 309 | break; |
| 310 | HEADERCMP(header, "content-length") { |
| 311 | HasContentLength_ = true; |
| 312 | ContentLength_ = FromString(header.Value()); |
| 313 | } |
| 314 | break; |
| 315 | HEADERCMP(header, "connection") { |
| 316 | // accept header "Connection: Keep-Alive, TE" |
| 317 | if (strnicmp(header.Value().data(), "keep-alive", 10) == 0) { |
| 318 | p.KeepAlive = true; |
| 319 | } else if (stricmp(header.Value().data(), "close") == 0) { |
| 320 | p.KeepAlive = false; |
| 321 | } |
| 322 | } |
| 323 | break; |
| 324 | HEADERCMP(header, "expect") { |
| 325 | auto findContinue = [&](const TStringBuf& s) { |
| 326 | if (strnicmp(s.data(), "100-continue", 13) == 0) { |
| 327 | Expect100Continue_ = true; |
| 328 | } |
| 329 | }; |
| 330 | ForEach(header.Value(), findContinue); |
| 331 | } |
| 332 | break; |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | if (p.Chunked) { |
| 337 | ChunkedInput_ = Streams_.Add(new TChunkedInput(&Buffered_, &Trailers_)); |
| 338 | Input_ = ChunkedInput_; |
| 339 | } else { |
nothing calls this directly
no test coverage detected