| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_stream_parser.h" | 5 #include "net/http/http_stream_parser.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // There's at least one |field_name| header. Check if there are any more | 67 // There's at least one |field_name| header. Check if there are any more |
| 68 // such headers, and if so, return true if they have different values. | 68 // such headers, and if so, return true if they have different values. |
| 69 std::string field_value2; | 69 std::string field_value2; |
| 70 while (headers.EnumerateHeader(&it, field_name, &field_value2)) { | 70 while (headers.EnumerateHeader(&it, field_name, &field_value2)) { |
| 71 if (field_value != field_value2) | 71 if (field_value != field_value2) |
| 72 return true; | 72 return true; |
| 73 } | 73 } |
| 74 return false; | 74 return false; |
| 75 } | 75 } |
| 76 | 76 |
| 77 base::Value* NetLogSendRequestBodyCallback( | 77 scoped_ptr<base::Value> NetLogSendRequestBodyCallback( |
| 78 uint64 length, | 78 uint64 length, |
| 79 bool is_chunked, | 79 bool is_chunked, |
| 80 bool did_merge, | 80 bool did_merge, |
| 81 NetLogCaptureMode /* capture_mode */) { | 81 NetLogCaptureMode /* capture_mode */) { |
| 82 base::DictionaryValue* dict = new base::DictionaryValue(); | 82 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 83 dict->SetInteger("length", static_cast<int>(length)); | 83 dict->SetInteger("length", static_cast<int>(length)); |
| 84 dict->SetBoolean("is_chunked", is_chunked); | 84 dict->SetBoolean("is_chunked", is_chunked); |
| 85 dict->SetBoolean("did_merge", did_merge); | 85 dict->SetBoolean("did_merge", did_merge); |
| 86 return dict; | 86 return dict.Pass(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // Returns true if |error_code| is an error for which we give the server a | 89 // Returns true if |error_code| is an error for which we give the server a |
| 90 // chance to send a body containing error information, if the error was received | 90 // chance to send a body containing error information, if the error was received |
| 91 // while trying to upload a request body. | 91 // while trying to upload a request body. |
| 92 bool ShouldTryReadingOnUploadError(int error_code) { | 92 bool ShouldTryReadingOnUploadError(int error_code) { |
| 93 return (error_code == ERR_CONNECTION_RESET); | 93 return (error_code == ERR_CONNECTION_RESET); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace | 96 } // namespace |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 request_body->IsInMemory() && | 1088 request_body->IsInMemory() && |
| 1089 request_body->size() > 0) { | 1089 request_body->size() > 0) { |
| 1090 uint64 merged_size = request_headers.size() + request_body->size(); | 1090 uint64 merged_size = request_headers.size() + request_body->size(); |
| 1091 if (merged_size <= kMaxMergedHeaderAndBodySize) | 1091 if (merged_size <= kMaxMergedHeaderAndBodySize) |
| 1092 return true; | 1092 return true; |
| 1093 } | 1093 } |
| 1094 return false; | 1094 return false; |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 } // namespace net | 1097 } // namespace net |
| OLD | NEW |