Commit ec79d70b authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Code cleanup

parent 551ae72f
...@@ -586,8 +586,6 @@ struct HttpClient { ...@@ -586,8 +586,6 @@ struct HttpClient {
} }
}; };
extern bool ssl_debug;
namespace { namespace {
void submit_request(HttpClient *client, void submit_request(HttpClient *client,
const std::map<std::string, std::string>& headers, const std::map<std::string, std::string>& headers,
...@@ -861,13 +859,13 @@ int client_select_next_proto_cb(SSL* ssl, ...@@ -861,13 +859,13 @@ int client_select_next_proto_cb(SSL* ssl,
const unsigned char *in, unsigned int inlen, const unsigned char *in, unsigned int inlen,
void *arg) void *arg)
{ {
if(ssl_debug) { if(config.verbose) {
print_timer(); print_timer();
std::cout << " NPN select next protocol: the remote server offers:" std::cout << " NPN select next protocol: the remote server offers:"
<< std::endl; << std::endl;
} }
for(unsigned int i = 0; i < inlen; i += in[i]+1) { for(unsigned int i = 0; i < inlen; i += in[i]+1) {
if(ssl_debug) { if(config.verbose) {
std::cout << " * "; std::cout << " * ";
std::cout.write(reinterpret_cast<const char*>(&in[i+1]), in[i]); std::cout.write(reinterpret_cast<const char*>(&in[i+1]), in[i]);
std::cout << std::endl; std::cout << std::endl;
...@@ -877,7 +875,7 @@ int client_select_next_proto_cb(SSL* ssl, ...@@ -877,7 +875,7 @@ int client_select_next_proto_cb(SSL* ssl,
std::cerr << "Server did not advertise HTTP/2.0 protocol." std::cerr << "Server did not advertise HTTP/2.0 protocol."
<< std::endl; << std::endl;
} else { } else {
if(ssl_debug) { if(config.verbose) {
std::cout << " NPN selected the protocol: " std::cout << " NPN selected the protocol: "
<< std::string((const char*)*out, (size_t)*outlen) << std::string((const char*)*out, (size_t)*outlen)
<< std::endl; << std::endl;
...@@ -1088,7 +1086,6 @@ int run(char **uris, int n) ...@@ -1088,7 +1086,6 @@ int run(char **uris, int n)
callbacks.on_unknown_frame_recv_callback = on_unknown_frame_recv_callback; callbacks.on_unknown_frame_recv_callback = on_unknown_frame_recv_callback;
} }
callbacks.on_data_chunk_recv_callback = on_data_chunk_recv_callback; callbacks.on_data_chunk_recv_callback = on_data_chunk_recv_callback;
ssl_debug = config.verbose;
std::string prev_host; std::string prev_host;
uint16_t prev_port = 0; uint16_t prev_port = 0;
int failures = 0; int failures = 0;
......
...@@ -48,37 +48,6 @@ ...@@ -48,37 +48,6 @@
namespace nghttp2 { namespace nghttp2 {
bool ssl_debug = false;
int select_next_proto_cb(SSL* ssl,
unsigned char **out, unsigned char *outlen,
const unsigned char *in, unsigned int inlen,
void *arg)
{
if(ssl_debug) {
print_timer();
std::cout << " NPN select next protocol: the remote server offers:"
<< std::endl;
}
for(unsigned int i = 0; i < inlen; i += in[i]+1) {
if(ssl_debug) {
std::cout << " * ";
std::cout.write(reinterpret_cast<const char*>(&in[i+1]), in[i]);
std::cout << std::endl;
}
}
if(nghttp2_select_next_protocol(out, outlen, in, inlen) <= 0) {
std::cerr << "Server did not advertise HTTP/2.0 protocol."
<< std::endl;
abort();
}
if(ssl_debug) {
std::cout << " NPN selected the protocol: "
<< std::string((const char*)*out, (size_t)*outlen) << std::endl;
}
return SSL_TLSEXT_ERR_OK;
}
namespace { namespace {
const char* strstatus(nghttp2_error_code error_code) const char* strstatus(nghttp2_error_code error_code)
{ {
......
...@@ -39,13 +39,6 @@ ...@@ -39,13 +39,6 @@
namespace nghttp2 { namespace nghttp2 {
extern bool ssl_debug;
int select_next_proto_cb(SSL* ssl,
unsigned char **out, unsigned char *outlen,
const unsigned char *in, unsigned int inlen,
void *arg);
void print_nv(char **nv); void print_nv(char **nv);
void on_frame_recv_callback void on_frame_recv_callback
......
...@@ -42,8 +42,6 @@ ...@@ -42,8 +42,6 @@
namespace nghttp2 { namespace nghttp2 {
extern bool ssl_debug;
namespace { namespace {
void print_usage(std::ostream& out) void print_usage(std::ostream& out)
{ {
...@@ -168,7 +166,6 @@ int main(int argc, char **argv) ...@@ -168,7 +166,6 @@ int main(int argc, char **argv)
SSL_library_init(); SSL_library_init();
reset_timer(); reset_timer();
config.on_request_recv_callback = htdocs_on_request_recv_callback; config.on_request_recv_callback = htdocs_on_request_recv_callback;
ssl_debug = config.verbose;
HttpServer server(&config); HttpServer server(&config);
server.run(); server.run();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment