-int start_http_listener(struct conf_config *conf,
- const char *listener_override,
- const char *proxy_override)
-{
- struct conf_server *ser;
- for (ser = conf->servers; ser; ser = ser->next)
- {
- char hp[128];
- *hp = '\0';
- if (listener_override)
- {
- strcpy(hp, listener_override);
- listener_override = 0; /* only first server is overriden */
- }
- else
- {
- strcpy(hp, ser->host ? ser->host : "");
- if (ser->port)
- {
- if (*hp)
- strcat(hp, ":");
- sprintf(hp + strlen(hp), "%d", ser->port);
- }
- }
- if (http_init(hp, ser))
- return -1;
-
- *hp = '\0';
- if (proxy_override)
- strcpy(hp, proxy_override);
- else if (ser->proxy_host || ser->proxy_port)
- {
- strcpy(hp, ser->proxy_host ? ser->proxy_host : "");
- if (ser->proxy_port)
- {
- if (*hp)
- strcat(hp, ":");
- sprintf(hp + strlen(hp), "%d", ser->proxy_port);
- }
- }
- if (*hp)
- http_set_proxyaddr(hp, ser->myurl ? ser->myurl : "");
- }
- return 0;
-}