shrpx: Code cleanup
This commit is contained in:
parent
4349d42988
commit
9c70c1b867
30
src/shrpx.cc
30
src/shrpx.cc
|
@ -497,15 +497,16 @@ int main(int argc, char **argv)
|
||||||
while(1) {
|
while(1) {
|
||||||
int flag;
|
int flag;
|
||||||
static option long_options[] = {
|
static option long_options[] = {
|
||||||
|
{"daemon", no_argument, 0, 'D' },
|
||||||
|
{"log-level", required_argument, 0, 'L' },
|
||||||
{"backend", required_argument, 0, 'b' },
|
{"backend", required_argument, 0, 'b' },
|
||||||
|
{"spdy-max-concurrent-streams", required_argument, 0, 'c' },
|
||||||
{"frontend", required_argument, 0, 'f' },
|
{"frontend", required_argument, 0, 'f' },
|
||||||
|
{"help", no_argument, 0, 'h' },
|
||||||
{"insecure", no_argument, 0, 'k' },
|
{"insecure", no_argument, 0, 'k' },
|
||||||
{"workers", required_argument, 0, 'n' },
|
{"workers", required_argument, 0, 'n' },
|
||||||
{"spdy-max-concurrent-streams", required_argument, 0, 'c' },
|
|
||||||
{"log-level", required_argument, 0, 'L' },
|
|
||||||
{"daemon", no_argument, 0, 'D' },
|
|
||||||
{"spdy-proxy", no_argument, 0, 's' },
|
|
||||||
{"client-proxy", no_argument, 0, 'p' },
|
{"client-proxy", no_argument, 0, 'p' },
|
||||||
|
{"spdy-proxy", no_argument, 0, 's' },
|
||||||
{"add-x-forwarded-for", no_argument, &flag, 1 },
|
{"add-x-forwarded-for", no_argument, &flag, 1 },
|
||||||
{"frontend-spdy-read-timeout", required_argument, &flag, 2 },
|
{"frontend-spdy-read-timeout", required_argument, &flag, 2 },
|
||||||
{"frontend-read-timeout", required_argument, &flag, 3 },
|
{"frontend-read-timeout", required_argument, &flag, 3 },
|
||||||
|
@ -525,11 +526,10 @@ int main(int argc, char **argv)
|
||||||
{"client", no_argument, &flag, 17 },
|
{"client", no_argument, &flag, 17 },
|
||||||
{"backend-spdy-window-bits", required_argument, &flag, 18 },
|
{"backend-spdy-window-bits", required_argument, &flag, 18 },
|
||||||
{"cacert", required_argument, &flag, 19 },
|
{"cacert", required_argument, &flag, 19 },
|
||||||
{"help", no_argument, 0, 'h' },
|
|
||||||
{0, 0, 0, 0 }
|
{0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
int c = getopt_long(argc, argv, "DL:ksb:c:f:n:hp", long_options,
|
int c = getopt_long(argc, argv, "DL:b:c:f:hkn:ps", long_options,
|
||||||
&option_index);
|
&option_index);
|
||||||
if(c == -1) {
|
if(c == -1) {
|
||||||
break;
|
break;
|
||||||
|
@ -538,34 +538,34 @@ int main(int argc, char **argv)
|
||||||
case 'D':
|
case 'D':
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_DAEMON, "yes"));
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_DAEMON, "yes"));
|
||||||
break;
|
break;
|
||||||
case 'h':
|
|
||||||
print_help(std::cout);
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
case 'L':
|
case 'L':
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_LOG_LEVEL, optarg));
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_LOG_LEVEL, optarg));
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_BACKEND, optarg));
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_BACKEND, optarg));
|
||||||
break;
|
break;
|
||||||
|
case 'c':
|
||||||
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_SPDY_MAX_CONCURRENT_STREAMS,
|
||||||
|
optarg));
|
||||||
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_FRONTEND, optarg));
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_FRONTEND, optarg));
|
||||||
break;
|
break;
|
||||||
|
case 'h':
|
||||||
|
print_help(std::cout);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
case 'k':
|
case 'k':
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_INSECURE, "yes"));
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_INSECURE, "yes"));
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_WORKERS, optarg));
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_WORKERS, optarg));
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'p':
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_SPDY_MAX_CONCURRENT_STREAMS,
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_CLIENT_PROXY, "yes"));
|
||||||
optarg));
|
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_SPDY_PROXY, "yes"));
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_SPDY_PROXY, "yes"));
|
||||||
break;
|
break;
|
||||||
case 'p':
|
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_CLIENT_PROXY, "yes"));
|
|
||||||
break;
|
|
||||||
case '?':
|
case '?':
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
case 0:
|
case 0:
|
||||||
|
|
Loading…
Reference in New Issue