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

Side by Side Diff: net/tools/quic/quic_client_bin.cc

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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/tools/quic/quic_client_base.h ('k') | net/tools/quic/quic_client_session.h » ('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) 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 // A binary wrapper for QuicClient. 5 // A binary wrapper for QuicClient.
6 // Connects to a host using QUIC, sends a request to the provided URL, and 6 // Connects to a host using QUIC, sends a request to the provided URL, and
7 // displays the response. 7 // displays the response.
8 // 8 //
9 // Some usage examples: 9 // Some usage examples:
10 // 10 //
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 using net::TransportSecurityState; 74 using net::TransportSecurityState;
75 using std::cout; 75 using std::cout;
76 using std::cerr; 76 using std::cerr;
77 using std::string; 77 using std::string;
78 using std::vector; 78 using std::vector;
79 using std::endl; 79 using std::endl;
80 80
81 // The IP or hostname the quic client will connect to. 81 // The IP or hostname the quic client will connect to.
82 string FLAGS_host = ""; 82 string FLAGS_host = "";
83 // The port to connect to. 83 // The port to connect to.
84 int32 FLAGS_port = 0; 84 int32_t FLAGS_port = 0;
85 // If set, send a POST with this body. 85 // If set, send a POST with this body.
86 string FLAGS_body = ""; 86 string FLAGS_body = "";
87 // If set, contents are converted from hex to ascii, before sending as body of 87 // If set, contents are converted from hex to ascii, before sending as body of
88 // a POST. e.g. --body_hex=\"68656c6c6f\" 88 // a POST. e.g. --body_hex=\"68656c6c6f\"
89 string FLAGS_body_hex = ""; 89 string FLAGS_body_hex = "";
90 // A semicolon separated list of key:value pairs to add to request headers. 90 // A semicolon separated list of key:value pairs to add to request headers.
91 string FLAGS_headers = ""; 91 string FLAGS_headers = "";
92 // Set to true for a quieter output experience. 92 // Set to true for a quieter output experience.
93 bool FLAGS_quiet = false; 93 bool FLAGS_quiet = false;
94 // QUIC version to speak, e.g. 21. If not set, then all available versions are 94 // QUIC version to speak, e.g. 21. If not set, then all available versions are
95 // offered in the handshake. 95 // offered in the handshake.
96 int32 FLAGS_quic_version = -1; 96 int32_t FLAGS_quic_version = -1;
97 // If true, a version mismatch in the handshake is not considered a failure. 97 // If true, a version mismatch in the handshake is not considered a failure.
98 // Useful for probing a server to determine if it speaks any version of QUIC. 98 // Useful for probing a server to determine if it speaks any version of QUIC.
99 bool FLAGS_version_mismatch_ok = false; 99 bool FLAGS_version_mismatch_ok = false;
100 // If true, an HTTP response code of 3xx is considered to be a successful 100 // If true, an HTTP response code of 3xx is considered to be a successful
101 // response, otherwise a failure. 101 // response, otherwise a failure.
102 bool FLAGS_redirect_is_success = true; 102 bool FLAGS_redirect_is_success = true;
103 // Initial MTU of the connection. 103 // Initial MTU of the connection.
104 int32 FLAGS_initial_mtu = 0; 104 int32_t FLAGS_initial_mtu = 0;
105 105
106 class FakeCertVerifier : public net::CertVerifier { 106 class FakeCertVerifier : public net::CertVerifier {
107 public: 107 public:
108 int Verify(net::X509Certificate* cert, 108 int Verify(net::X509Certificate* cert,
109 const std::string& hostname, 109 const std::string& hostname,
110 const std::string& ocsp_response, 110 const std::string& ocsp_response,
111 int flags, 111 int flags,
112 net::CRLSet* crl_set, 112 net::CRLSet* crl_set,
113 net::CertVerifyResult* verify_result, 113 net::CertVerifyResult* verify_result,
114 const net::CompletionCallback& callback, 114 const net::CompletionCallback& callback,
115 scoped_ptr<net::CertVerifier::Request>* out_req, 115 scoped_ptr<net::CertVerifier::Request>* out_req,
116 const net::BoundNetLog& net_log) override { 116 const net::BoundNetLog& net_log) override {
117 return net::OK; 117 return net::OK;
118 } 118 }
119 119
120 // Returns true if this CertVerifier supports stapled OCSP responses. 120 // Returns true if this CertVerifier supports stapled OCSP responses.
121 bool SupportsOCSPStapling() override { return false; } 121 bool SupportsOCSPStapling() override { return false; }
122 }; 122 };
123 123
124 static bool DecodeHexString(const base::StringPiece& hex, std::string* bytes) { 124 static bool DecodeHexString(const base::StringPiece& hex, std::string* bytes) {
125 bytes->clear(); 125 bytes->clear();
126 if (hex.empty()) 126 if (hex.empty())
127 return true; 127 return true;
128 std::vector<uint8> v; 128 std::vector<uint8_t> v;
129 if (!base::HexStringToBytes(hex.as_string(), &v)) 129 if (!base::HexStringToBytes(hex.as_string(), &v))
130 return false; 130 return false;
131 if (!v.empty()) 131 if (!v.empty())
132 bytes->assign(reinterpret_cast<const char*>(&v[0]), v.size()); 132 bytes->assign(reinterpret_cast<const char*>(&v[0]), v.size());
133 return true; 133 return true;
134 }; 134 };
135 135
136 int main(int argc, char* argv[]) { 136 int main(int argc, char* argv[]) {
137 base::CommandLine::Init(argc, argv); 137 base::CommandLine::Init(argc, argv);
138 base::CommandLine* line = base::CommandLine::ForCurrentProcess(); 138 base::CommandLine* line = base::CommandLine::ForCurrentProcess();
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 return 0; 353 return 0;
354 } else { 354 } else {
355 cout << "Request failed (redirect " << response_code << ")." << endl; 355 cout << "Request failed (redirect " << response_code << ")." << endl;
356 return 1; 356 return 1;
357 } 357 }
358 } else { 358 } else {
359 cerr << "Request failed (" << response_code << ")." << endl; 359 cerr << "Request failed (" << response_code << ")." << endl;
360 return 1; 360 return 1;
361 } 361 }
362 } 362 }
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client_base.h ('k') | net/tools/quic/quic_client_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698