Code cleanup

This commit is contained in:
Tatsuhiro Tsujikawa 2013-07-22 22:08:52 +09:00
parent 551ae72f3a
commit ec79d70bd0
4 changed files with 3 additions and 47 deletions

View File

@ -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;

View File

@ -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)
{

View File

@ -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

View File

@ -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();