From cad4d68238cc8649f7673e9beb14d343ba19dc67 Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Wed, 28 Mar 2012 16:53:09 -0300 Subject: [PATCH] configure destination --- src/spedye_conf.c | 1 + src/spedye_main.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/spedye_conf.c b/src/spedye_conf.c index 4b26f2d..bf2baa8 100644 --- a/src/spedye_conf.c +++ b/src/spedye_conf.c @@ -23,6 +23,7 @@ init_blank_config(spedye_conf_t *conf) spedye_vhost_t *vhost = calloc(1, sizeof(spedye_vhost_t)); spedye_listener_t *lrec = calloc(1, sizeof(spedye_listener_t)); conf->listeners = lrec; + vhost->destport = 80; lrec->port = 443; lrec->vhosts = vhost; } diff --git a/src/spedye_main.c b/src/spedye_main.c index 6d88a32..efe788e 100644 --- a/src/spedye_main.c +++ b/src/spedye_main.c @@ -68,9 +68,22 @@ process_args(spedye_conf_t *conf, int argc, char *argv[]) conf->listeners->address = strdup(arg); } /* TODO: proper parse IP:port, handle v6 */ - continue; } + + if (long_arg("-f", "--forward", i, argc, argv, &arg)) { + i++; + + p = strrchr(arg, ':'); + + if (p) { + conf->listeners->vhosts->destport = atoi(p+1); + *p = '\0'; + } + + conf->listeners->vhosts->destaddress = strdup(arg); + } + } conf->worker_count = 10; return 0;