Commit ec79d70b authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Code cleanup

parent 551ae72f
......@@ -586,8 +586,6 @@ struct HttpClient {
}
};
extern bool ssl_debug;
namespace {
void submit_request(HttpClient *client,
const std::map<std::string, std::string>& headers,
......@@ -861,13 +859,13 @@ int client_select_next_proto_cb(SSL* ssl,
const unsigned char *in, unsigned int inlen,
void *arg)
{
if(ssl_debug) {
if(config.verbose) {
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) {
if(config.verbose) {
std::cout << " * ";
std::cout.write(reinterpret_cast<const char*>(&in[i+1]), in[i]);
std::cout << std::endl;
......@@ -877,7 +875,7 @@ int client_select_next_proto_cb(SSL* ssl,
std::cerr << "Server did not advertise HTTP/2.0 protocol."
<< std::endl;
} else {
if(ssl_debug) {
if(config.verbose) {
std::cout << " NPN selected the protocol: "
<< std::string((const char*)*out, (size_t)*outlen)
<< std::endl;
......@@ -1088,7 +1086,6 @@ int run(char **uris, int n)
callbacks.on_unknown_frame_recv_callback = on_unknown_frame_recv_callback;
}
callbacks.on_data_chunk_recv_callback = on_data_chunk_recv_callback;
ssl_debug = config.verbose;
std::string prev_host;
uint16_t prev_port = 0;
int failures = 0;
......
......@@ -48,37 +48,6 @@
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 {
const char* strstatus(nghttp2_error_code error_code)
{
......
......@@ -39,13 +39,6 @@
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 on_frame_recv_callback
......
......@@ -42,8 +42,6 @@
namespace nghttp2 {
extern bool ssl_debug;
namespace {
void print_usage(std::ostream& out)
{
......@@ -168,7 +166,6 @@ int main(int argc, char **argv)
SSL_library_init();
reset_timer();
config.on_request_recv_callback = htdocs_on_request_recv_callback;
ssl_debug = config.verbose;
HttpServer server(&config);
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