| 116 | } |
| 117 | |
| 118 | bool THttpParser::ContentParser() { |
| 119 | DBGOUT("Content parsing()"); |
| 120 | if (HasContentLength_ && !BodyNotExpected_) { |
| 121 | size_t rd = Min<size_t>(DataEnd_ - Data_, ContentLength_ - Content_.size()); |
| 122 | Content_.append(Data_, rd); |
| 123 | Data_ += rd; |
| 124 | DBGOUT("Content parsing: " << Content_.Size() << " from " << ContentLength_); |
| 125 | if (Content_.size() == ContentLength_) { |
| 126 | return OnEndParsing(); |
| 127 | } |
| 128 | } else { |
| 129 | if (MessageType_ == Request) { |
| 130 | return OnEndParsing(); //RFC2616 4.4-5 |
| 131 | } else if (Y_UNLIKELY(BodyNotExpected_)) { |
| 132 | return OnEndParsing(); //RFC2616 4.4-1 |
| 133 | } |
| 134 | |
| 135 | Content_.append(Data_, DataEnd_); |
| 136 | Data_ = DataEnd_; |
| 137 | } |
| 138 | Parser_ = &THttpParser::ContentParser; |
| 139 | return false; |
| 140 | } |
| 141 | |
| 142 | bool THttpParser::ChunkedContentParser() { |
| 143 | if (BodyNotExpected_) { |