| Index: net/tools/quic/quic_simple_client_bin.cc
|
| diff --git a/net/tools/quic/quic_simple_client_bin.cc b/net/tools/quic/quic_simple_client_bin.cc
|
| index 33f3e997d52ddcccbaa5e1a55dbb0008b3055917..259111f8782dd6e2e94c74c3c35d5238c24fe0cb 100644
|
| --- a/net/tools/quic/quic_simple_client_bin.cc
|
| +++ b/net/tools/quic/quic_simple_client_bin.cc
|
| @@ -49,14 +49,14 @@
|
| #include "net/base/ip_endpoint.h"
|
| #include "net/base/privacy_mode.h"
|
| #include "net/cert/cert_verifier.h"
|
| -#include "net/http/http_request_info.h"
|
| #include "net/http/transport_security_state.h"
|
| #include "net/quic/crypto/proof_verifier_chromium.h"
|
| #include "net/quic/quic_protocol.h"
|
| #include "net/quic/quic_server_id.h"
|
| #include "net/quic/quic_utils.h"
|
| -#include "net/spdy/spdy_http_utils.h"
|
| -#include "net/tools/quic/quic_simple_client.h"
|
| +#include "net/tools/epoll_server/epoll_server.h"
|
| +#include "net/tools/quic/quic_client.h"
|
| +#include "net/tools/quic/spdy_utils.h"
|
| #include "url/gurl.h"
|
|
|
| using base::StringPiece;
|
| @@ -161,7 +161,6 @@
|
| << " redirect_is_success: " << FLAGS_redirect_is_success;
|
|
|
| base::AtExitManager exit_manager;
|
| - base::MessageLoopForIO message_loop;
|
|
|
| // Determine IP address to connect to from supplied hostname.
|
| net::IPAddressNumber ip_addr;
|
| @@ -185,6 +184,7 @@
|
|
|
| // Build the client, and try to connect.
|
| bool is_https = (FLAGS_port == 443);
|
| + net::EpollServer epoll_server;
|
| net::QuicServerId server_id(host, FLAGS_port, is_https,
|
| net::PRIVACY_MODE_DISABLED);
|
| net::QuicVersionVector versions = net::QuicSupportedVersions();
|
| @@ -192,8 +192,8 @@
|
| versions.clear();
|
| versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version));
|
| }
|
| - net::tools::QuicSimpleClient client(net::IPEndPoint(ip_addr, FLAGS_port),
|
| - server_id, versions);
|
| + net::tools::QuicClient client(net::IPEndPoint(ip_addr, FLAGS_port), server_id,
|
| + versions, &epoll_server);
|
| scoped_ptr<CertVerifier> cert_verifier;
|
| scoped_ptr<TransportSecurityState> transport_security_state;
|
| if (is_https) {
|
| @@ -223,9 +223,9 @@
|
| cout << "Connected to " << host_port << endl;
|
|
|
| // Construct a GET or POST request for supplied URL.
|
| - net::HttpRequestInfo request;
|
| - request.method = FLAGS_body.empty() ? "GET" : "POST";
|
| - request.url = url;
|
| + net::BalsaHeaders headers;
|
| + headers.SetRequestFirstlineFromStringPieces(
|
| + FLAGS_body.empty() ? "GET" : "POST", url.spec(), "HTTP/1.1");
|
|
|
| // Append any additional headers supplied on the command line.
|
| vector<string> headers_tokenized;
|
| @@ -243,18 +243,16 @@
|
| base::TrimWhitespaceASCII(kv[0], base::TRIM_ALL, &key);
|
| string value;
|
| base::TrimWhitespaceASCII(kv[1], base::TRIM_ALL, &value);
|
| - request.extra_headers.SetHeader(key, value);
|
| + headers.AppendHeader(key, value);
|
| }
|
|
|
| // Make sure to store the response, for later output.
|
| client.set_store_response(true);
|
|
|
| // Send the request.
|
| - net::SpdyHeaderBlock header_block;
|
| - net::CreateSpdyHeadersFromHttpRequest(request, request.extra_headers,
|
| - net::SPDY3, /*direct=*/ true,
|
| - &header_block);
|
| - client.SendRequestAndWaitForResponse(request, FLAGS_body, /*fin=*/true);
|
| + map<string, string> header_block =
|
| + net::tools::SpdyUtils::RequestHeadersToSpdy4Headers(headers);
|
| + client.SendRequestAndWaitForResponse(headers, FLAGS_body, /*fin=*/true);
|
|
|
| // Print request and response details.
|
| if (!FLAGS_quiet) {
|
| @@ -264,8 +262,7 @@
|
| cout << " " << kv.first << ": " << kv.second << endl;
|
| }
|
| cout << "body: " << FLAGS_body << endl;
|
| - cout << endl;
|
| - cout << "Response:" << endl;
|
| + cout << endl << "Response:";
|
| cout << "headers: " << client.latest_response_headers() << endl;
|
| cout << "body: " << client.latest_response_body() << endl;
|
| }
|
|
|