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

Unified Diff: net/tools/quic/quic_client.cc

Issue 25043005: Add better help information to quic_client and quic_server. Also, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/quic_client.h ('k') | net/tools/quic/quic_client_bin.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_client.cc
diff --git a/net/tools/quic/quic_client.cc b/net/tools/quic/quic_client.cc
index 741d24b9b074ceddcdd4b6ae11e75997aee7af4d..68cdf001796ed525cfe47651fde4dca293bbcef0 100644
--- a/net/tools/quic/quic_client.cc
+++ b/net/tools/quic/quic_client.cc
@@ -32,7 +32,8 @@ const int kEpollFlags = EPOLLIN | EPOLLOUT | EPOLLET;
QuicClient::QuicClient(IPEndPoint server_address,
const string& server_hostname,
- const QuicVersion version)
+ const QuicVersion version,
+ bool print_response)
: server_address_(server_address),
server_hostname_(server_hostname),
local_port_(0),
@@ -40,7 +41,8 @@ QuicClient::QuicClient(IPEndPoint server_address,
initialized_(false),
packets_dropped_(0),
overflow_supported_(false),
- version_(version) {
+ version_(version),
+ print_response_(print_response) {
config_.SetDefaults();
}
@@ -56,7 +58,8 @@ QuicClient::QuicClient(IPEndPoint server_address,
initialized_(false),
packets_dropped_(0),
overflow_supported_(false),
- version_(version) {
+ version_(version),
+ print_response_(false) {
}
QuicClient::~QuicClient() {
@@ -178,10 +181,12 @@ void QuicClient::Disconnect() {
void QuicClient::SendRequestsAndWaitForResponse(
const CommandLine::StringVector& args) {
- for (uint32_t i = 0; i < args.size(); i++) {
+ for (size_t i = 0; i < args.size(); i++) {
BalsaHeaders headers;
headers.SetRequestFirstlineFromStringPieces("GET", args[i], "HTTP/1.1");
- CreateReliableClientStream()->SendRequest(headers, "", true);
+ QuicReliableClientStream* stream = CreateReliableClientStream();
+ stream->SendRequest(headers, "", true);
+ stream->set_visitor(this);
}
while (WaitForEvents()) { }
@@ -233,6 +238,24 @@ void QuicClient::OnEvent(int fd, EpollEvent* event) {
}
}
+void QuicClient::OnClose(ReliableQuicStream* stream) {
+ if (!print_response_) {
+ return;
+ }
+
+ QuicReliableClientStream* client_stream =
+ static_cast<QuicReliableClientStream*>(stream);
+ const BalsaHeaders& headers = client_stream->headers();
+ printf("%s\n", headers.first_line().as_string().c_str());
+ for (BalsaHeaders::const_header_lines_iterator i =
+ headers.header_lines_begin();
+ i != headers.header_lines_end(); ++i) {
+ printf("%s: %s\n", i->first.as_string().c_str(),
+ i->second.as_string().c_str());
+ }
+ printf("%s\n", client_stream->data().c_str());
+}
+
QuicPacketCreator::Options* QuicClient::options() {
if (session() == NULL) {
return NULL;
« no previous file with comments | « net/tools/quic/quic_client.h ('k') | net/tools/quic/quic_client_bin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698