summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-05-13 21:50:50 +0000
committerLennart Poettering <lennart@poettering.net>2006-05-13 21:50:50 +0000
commit6a878d00ccfe153d8b7b3950f34accc8c82bc4a2 (patch)
tree2c5ae66a83ff6bf248addbb950be94bd7d494be8
parent1b2df0f0a3f2dbcb68294694267fd3adac5f6ff1 (diff)
merge patch from "TFKyle", which fixes the parsing of ServerName directives when port numbers are specified
git-svn-id: file:///home/lennart/svn/public/mod_dnssd/trunk@56 634eccf8-0006-0410-930e-e16565b0b7de
-rw-r--r--src/mod_dnssd.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/mod_dnssd.c b/src/mod_dnssd.c
index 21edb42..c715045 100644
--- a/src/mod_dnssd.c
+++ b/src/mod_dnssd.c
@@ -141,10 +141,22 @@ static void assemble_services(struct runtime_data *r) {
for (v = ap_conftree; v; v = v->next) {
const char *a = v->args;
- if (strcasecmp(v->directive, "ServerName") == 0)
- default_host_name = ap_getword_conf(t, &a);
-
- else if (strcasecmp(v->directive, "Listen") == 0) {
+ if (strcasecmp(v->directive, "ServerName") == 0) {
+ const char *tdhn = NULL;
+ char *colon;
+ tdhn = ap_getword_conf(t, &a);
+ colon = strrchr(tdhn, ':');
+ if (colon) {
+ apr_size_t sz;
+ if (!default_port) {
+ default_port = (uint16_t) atoi(colon+1);
+ }
+ sz = colon - tdhn;
+ default_host_name = apr_pstrndup(t, tdhn, sz);
+ } else {
+ default_host_name = tdhn;
+ }
+ } else if (strcasecmp(v->directive, "Listen") == 0) {
char *sp;
if (!default_port) {
@@ -178,8 +190,21 @@ static void assemble_services(struct runtime_data *r) {
/* ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->main_server, "VHOST_INTERNAL %s | %s | %s | %s", l->directive, l->args, vname, vtypes); */
- if (strcasecmp(l->directive, "ServerName") == 0)
- host_name = ap_getword_conf(t, &a);
+ if (strcasecmp(l->directive, "ServerName") == 0) {
+ const char *thn = NULL;
+ thn = ap_getword_conf(t, &a);
+ colon = strrchr(thn, ':');
+ if (colon) {
+ apr_size_t sz;
+ if (!vport) {
+ vport = (uint16_t) atoi(colon+1);
+ }
+ sz = colon - thn;
+ host_name = apr_pstrndup(t, thn, sz);
+ } else {
+ host_name = thn;
+ }
+ }
else if (strcasecmp(l->directive, "DNSSDServiceName") == 0)
vname = ap_getword_conf(t, &a);
else if (strcasecmp(l->directive, "DNSSDServiceTypes") == 0)
@@ -853,3 +878,4 @@ module AP_MODULE_DECLARE_DATA dnssd_module = {
register_hooks /* register hooks */
};
+/* vim:set expandtab: */