OLD | NEW |
---|---|
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include "base/format_macros.h" | |
7 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
8 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
9 #include "base/field_trial.h" | 10 #include "base/field_trial.h" |
10 #include "base/histogram.h" | 11 #include "base/histogram.h" |
11 #include "base/string_util.h" | 12 #include "base/string_util.h" |
12 #include "base/trace_event.h" | 13 #include "base/trace_event.h" |
13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
14 #include "net/base/connection_type_histograms.h" | 15 #include "net/base/connection_type_histograms.h" |
15 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
16 #include "net/base/load_flags.h" | 17 #include "net/base/load_flags.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 } | 63 } |
63 | 64 |
64 // Our consumer should have made sure that this is a safe referrer. See for | 65 // Our consumer should have made sure that this is a safe referrer. See for |
65 // instance WebCore::FrameLoader::HideReferrer. | 66 // instance WebCore::FrameLoader::HideReferrer. |
66 if (request_info->referrer.is_valid()) | 67 if (request_info->referrer.is_valid()) |
67 StringAppendF(request_headers, "Referer: %s\r\n", | 68 StringAppendF(request_headers, "Referer: %s\r\n", |
68 request_info->referrer.spec().c_str()); | 69 request_info->referrer.spec().c_str()); |
69 | 70 |
70 // Add a content length header? | 71 // Add a content length header? |
71 if (upload_data_stream) { | 72 if (upload_data_stream) { |
72 StringAppendF(request_headers, "Content-Length: %llu\r\n", | 73 StringAppendF(request_headers, "Content-Length: %"PRIu64"\r\n", |
Mark Mentovai
2009/11/18 20:55:27
Spaces.
| |
73 upload_data_stream->size()); | 74 upload_data_stream->size()); |
74 } else if (request_info->method == "POST" || request_info->method == "PUT" || | 75 } else if (request_info->method == "POST" || request_info->method == "PUT" || |
75 request_info->method == "HEAD") { | 76 request_info->method == "HEAD") { |
76 // An empty POST/PUT request still needs a content length. As for HEAD, | 77 // An empty POST/PUT request still needs a content length. As for HEAD, |
77 // IE and Safari also add a content length header. Presumably it is to | 78 // IE and Safari also add a content length header. Presumably it is to |
78 // support sending a HEAD request to an URL that only expects to be sent a | 79 // support sending a HEAD request to an URL that only expects to be sent a |
79 // POST or some other method that normally would have a message body. | 80 // POST or some other method that normally would have a message body. |
80 *request_headers += "Content-Length: 0\r\n"; | 81 *request_headers += "Content-Length: 0\r\n"; |
81 } | 82 } |
82 | 83 |
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1683 AuthChallengeInfo* auth_info = new AuthChallengeInfo; | 1684 AuthChallengeInfo* auth_info = new AuthChallengeInfo; |
1684 auth_info->is_proxy = target == HttpAuth::AUTH_PROXY; | 1685 auth_info->is_proxy = target == HttpAuth::AUTH_PROXY; |
1685 auth_info->host_and_port = ASCIIToWide(GetHostAndPort(auth_origin)); | 1686 auth_info->host_and_port = ASCIIToWide(GetHostAndPort(auth_origin)); |
1686 auth_info->scheme = ASCIIToWide(auth_handler_[target]->scheme()); | 1687 auth_info->scheme = ASCIIToWide(auth_handler_[target]->scheme()); |
1687 // TODO(eroman): decode realm according to RFC 2047. | 1688 // TODO(eroman): decode realm according to RFC 2047. |
1688 auth_info->realm = ASCIIToWide(auth_handler_[target]->realm()); | 1689 auth_info->realm = ASCIIToWide(auth_handler_[target]->realm()); |
1689 http_stream_->GetResponseInfo()->auth_challenge = auth_info; | 1690 http_stream_->GetResponseInfo()->auth_challenge = auth_info; |
1690 } | 1691 } |
1691 | 1692 |
1692 } // namespace net | 1693 } // namespace net |
OLD | NEW |