| OLD | NEW |
| 1 /* ***** BEGIN LICENSE BLOCK ***** | 1 /* ***** BEGIN LICENSE BLOCK ***** |
| 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 3 * | 3 * |
| 4 * The contents of this file are subject to the Mozilla Public License Version | 4 * The contents of this file are subject to the Mozilla Public License Version |
| 5 * 1.1 (the "License"); you may not use this file except in compliance with | 5 * 1.1 (the "License"); you may not use this file except in compliance with |
| 6 * the License. You may obtain a copy of the License at | 6 * the License. You may obtain a copy of the License at |
| 7 * http://www.mozilla.org/MPL/ | 7 * http://www.mozilla.org/MPL/ |
| 8 * | 8 * |
| 9 * Software distributed under the License is distributed on an "AS IS" basis, | 9 * Software distributed under the License is distributed on an "AS IS" basis, |
| 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 buf_len = static_cast<int>(line_buf_.size()); | 109 buf_len = static_cast<int>(line_buf_.size()); |
| 110 } | 110 } |
| 111 | 111 |
| 112 if (reached_last_chunk_) { | 112 if (reached_last_chunk_) { |
| 113 if (buf_len) { | 113 if (buf_len) { |
| 114 DLOG(INFO) << "ignoring http trailer"; | 114 DLOG(INFO) << "ignoring http trailer"; |
| 115 } else { | 115 } else { |
| 116 reached_eof_ = true; | 116 reached_eof_ = true; |
| 117 } | 117 } |
| 118 } else if (chunk_terminator_remaining_) { | 118 } else if (chunk_terminator_remaining_) { |
| 119 if (buf_len) { | 119 if (buf_len) { |
| 120 DLOG(ERROR) << "chunk data not terminated properly"; | 120 DLOG(ERROR) << "chunk data not terminated properly"; |
| 121 return ERR_INVALID_CHUNKED_ENCODING; | 121 return ERR_INVALID_CHUNKED_ENCODING; |
| 122 } | 122 } |
| 123 chunk_terminator_remaining_ = false; | 123 chunk_terminator_remaining_ = false; |
| 124 } else if (buf_len) { | 124 } else if (buf_len) { |
| 125 // Ignore any chunk-extensions. | 125 // Ignore any chunk-extensions. |
| 126 size_t index_of_semicolon = base::StringPiece(buf, buf_len).find(';'); | 126 size_t index_of_semicolon = base::StringPiece(buf, buf_len).find(';'); |
| 127 if (index_of_semicolon != base::StringPiece::npos) | 127 if (index_of_semicolon != base::StringPiece::npos) |
| 128 buf_len = static_cast<int>(index_of_semicolon); | 128 buf_len = static_cast<int>(index_of_semicolon); |
| 129 | 129 |
| 130 if (!ParseChunkSize(buf, buf_len, &chunk_remaining_)) { | 130 if (!ParseChunkSize(buf, buf_len, &chunk_remaining_)) { |
| 131 DLOG(ERROR) << "Failed parsing HEX from: " << | 131 DLOG(ERROR) << "Failed parsing HEX from: " << |
| 132 std::string(buf, buf_len); | 132 std::string(buf, buf_len); |
| 133 return ERR_INVALID_CHUNKED_ENCODING; | 133 return ERR_INVALID_CHUNKED_ENCODING; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 int parsed_number; | 190 int parsed_number; |
| 191 bool ok = HexStringToInt(std::string(start, len), &parsed_number); | 191 bool ok = HexStringToInt(std::string(start, len), &parsed_number); |
| 192 if (ok && parsed_number >= 0) { | 192 if (ok && parsed_number >= 0) { |
| 193 *out = parsed_number; | 193 *out = parsed_number; |
| 194 return true; | 194 return true; |
| 195 } | 195 } |
| 196 return false; | 196 return false; |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace net | 199 } // namespace net |
| OLD | NEW |