Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: net/http/http_network_transaction.cc

Issue 3390026: net: Append base:: in the StringPrintf calls. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: fix include order Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_net_log_params.h ('k') | net/http/http_proxy_client_socket.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/field_trial.h" 11 #include "base/field_trial.h"
12 #include "base/format_macros.h" 12 #include "base/format_macros.h"
13 #include "base/histogram.h" 13 #include "base/histogram.h"
14 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
15 #include "base/stats_counters.h" 15 #include "base/stats_counters.h"
16 #include "base/stl_util-inl.h" 16 #include "base/stl_util-inl.h"
17 #include "base/string_number_conversions.h"
17 #include "base/string_util.h" 18 #include "base/string_util.h"
18 #include "base/string_number_conversions.h" 19 #include "base/stringprintf.h"
19 #include "build/build_config.h" 20 #include "build/build_config.h"
20 #include "googleurl/src/gurl.h" 21 #include "googleurl/src/gurl.h"
21 #include "net/base/auth.h" 22 #include "net/base/auth.h"
22 #include "net/base/io_buffer.h" 23 #include "net/base/io_buffer.h"
23 #include "net/base/load_flags.h" 24 #include "net/base/load_flags.h"
24 #include "net/base/net_errors.h" 25 #include "net/base/net_errors.h"
25 #include "net/base/net_util.h" 26 #include "net/base/net_util.h"
26 #include "net/base/ssl_cert_request_info.h" 27 #include "net/base/ssl_cert_request_info.h"
27 #include "net/base/ssl_connection_status_flags.h" 28 #include "net/base/ssl_connection_status_flags.h"
28 #include "net/base/upload_data_stream.h" 29 #include "net/base/upload_data_stream.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 61
61 void BuildRequestHeaders(const HttpRequestInfo* request_info, 62 void BuildRequestHeaders(const HttpRequestInfo* request_info,
62 const HttpRequestHeaders& authorization_headers, 63 const HttpRequestHeaders& authorization_headers,
63 const UploadDataStream* upload_data_stream, 64 const UploadDataStream* upload_data_stream,
64 bool using_proxy, 65 bool using_proxy,
65 std::string* request_line, 66 std::string* request_line,
66 HttpRequestHeaders* request_headers) { 67 HttpRequestHeaders* request_headers) {
67 const std::string path = using_proxy ? 68 const std::string path = using_proxy ?
68 HttpUtil::SpecForRequest(request_info->url) : 69 HttpUtil::SpecForRequest(request_info->url) :
69 HttpUtil::PathForRequest(request_info->url); 70 HttpUtil::PathForRequest(request_info->url);
70 *request_line = StringPrintf( 71 *request_line = base::StringPrintf(
71 "%s %s HTTP/1.1\r\n", request_info->method.c_str(), path.c_str()); 72 "%s %s HTTP/1.1\r\n", request_info->method.c_str(), path.c_str());
72 request_headers->SetHeader(HttpRequestHeaders::kHost, 73 request_headers->SetHeader(HttpRequestHeaders::kHost,
73 GetHostAndOptionalPort(request_info->url)); 74 GetHostAndOptionalPort(request_info->url));
74 75
75 // For compat with HTTP/1.0 servers and proxies: 76 // For compat with HTTP/1.0 servers and proxies:
76 if (using_proxy) { 77 if (using_proxy) {
77 request_headers->SetHeader(HttpRequestHeaders::kProxyConnection, 78 request_headers->SetHeader(HttpRequestHeaders::kProxyConnection,
78 "keep-alive"); 79 "keep-alive");
79 } else { 80 } else {
80 request_headers->SetHeader(HttpRequestHeaders::kConnection, "keep-alive"); 81 request_headers->SetHeader(HttpRequestHeaders::kConnection, "keep-alive");
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 return GURL(scheme + 1204 return GURL(scheme +
1204 proxy_info_.proxy_server().host_port_pair().ToString()); 1205 proxy_info_.proxy_server().host_port_pair().ToString());
1205 } 1206 }
1206 case HttpAuth::AUTH_SERVER: 1207 case HttpAuth::AUTH_SERVER:
1207 return request_->url; 1208 return request_->url;
1208 default: 1209 default:
1209 return GURL(); 1210 return GURL();
1210 } 1211 }
1211 } 1212 }
1212 1213
1213 #define STATE_CASE(s) case s: \ 1214 #define STATE_CASE(s) \
1214 description = StringPrintf("%s (0x%08X)", #s, s); \ 1215 case s: \
1215 break 1216 description = base::StringPrintf("%s (0x%08X)", #s, s); \
1217 break
1216 1218
1217 std::string HttpNetworkTransaction::DescribeState(State state) { 1219 std::string HttpNetworkTransaction::DescribeState(State state) {
1218 std::string description; 1220 std::string description;
1219 switch (state) { 1221 switch (state) {
1220 STATE_CASE(STATE_CREATE_STREAM); 1222 STATE_CASE(STATE_CREATE_STREAM);
1221 STATE_CASE(STATE_CREATE_STREAM_COMPLETE); 1223 STATE_CASE(STATE_CREATE_STREAM_COMPLETE);
1222 STATE_CASE(STATE_SEND_REQUEST); 1224 STATE_CASE(STATE_SEND_REQUEST);
1223 STATE_CASE(STATE_SEND_REQUEST_COMPLETE); 1225 STATE_CASE(STATE_SEND_REQUEST_COMPLETE);
1224 STATE_CASE(STATE_READ_HEADERS); 1226 STATE_CASE(STATE_READ_HEADERS);
1225 STATE_CASE(STATE_READ_HEADERS_COMPLETE); 1227 STATE_CASE(STATE_READ_HEADERS_COMPLETE);
1226 STATE_CASE(STATE_READ_BODY); 1228 STATE_CASE(STATE_READ_BODY);
1227 STATE_CASE(STATE_READ_BODY_COMPLETE); 1229 STATE_CASE(STATE_READ_BODY_COMPLETE);
1228 STATE_CASE(STATE_DRAIN_BODY_FOR_AUTH_RESTART); 1230 STATE_CASE(STATE_DRAIN_BODY_FOR_AUTH_RESTART);
1229 STATE_CASE(STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE); 1231 STATE_CASE(STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE);
1230 STATE_CASE(STATE_NONE); 1232 STATE_CASE(STATE_NONE);
1231 default: 1233 default:
1232 description = StringPrintf("Unknown state 0x%08X (%u)", state, state); 1234 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
1235 state);
1233 break; 1236 break;
1234 } 1237 }
1235 return description; 1238 return description;
1236 } 1239 }
1237 1240
1238 // TODO(gavinp): re-adjust this once SPDY v3 has three priority bits, 1241 // TODO(gavinp): re-adjust this once SPDY v3 has three priority bits,
1239 // eliminating the need for this folding. 1242 // eliminating the need for this folding.
1240 int ConvertRequestPriorityToSpdyPriority(const RequestPriority priority) { 1243 int ConvertRequestPriorityToSpdyPriority(const RequestPriority priority) {
1241 DCHECK(HIGHEST <= priority && priority < NUM_PRIORITIES); 1244 DCHECK(HIGHEST <= priority && priority < NUM_PRIORITIES);
1242 switch (priority) { 1245 switch (priority) {
1243 case LOWEST: 1246 case LOWEST:
1244 return SPDY_PRIORITY_LOWEST-1; 1247 return SPDY_PRIORITY_LOWEST-1;
1245 case IDLE: 1248 case IDLE:
1246 return SPDY_PRIORITY_LOWEST; 1249 return SPDY_PRIORITY_LOWEST;
1247 default: 1250 default:
1248 return priority; 1251 return priority;
1249 } 1252 }
1250 } 1253 }
1251 1254
1252 1255
1253 1256
1254 #undef STATE_CASE 1257 #undef STATE_CASE
1255 1258
1256 } // namespace net 1259 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_net_log_params.h ('k') | net/http/http_proxy_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698