Skip to content

Commit

Permalink
Support multiple domains (Step 10/?)
Browse files Browse the repository at this point in the history
  • Loading branch information
bel2125 committed Nov 12, 2017
1 parent 238043a commit 4378fdc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/multidomain/base_domain.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
listening_ports 80r,443s
listening_ports 80r,443s,8080
ssl_certificate resources/cert/server.pem
authentication_domain default
add_domain examples/multidomain/add_domain.conf
Expand Down
15 changes: 15 additions & 0 deletions src/civetweb.c
Original file line number Diff line number Diff line change
Expand Up @@ -12192,6 +12192,21 @@ alloc_get_host(struct mg_connection *conn)
DEBUG_TRACE("HTTPS Host: %s", host);

} else {
struct mg_domain_context *dom = &(conn->phys_ctx->dd);
while (dom) {
if (!mg_strcasecmp(host, dom->config[AUTHENTICATION_DOMAIN])) {

/* Found matching domain */
DEBUG_TRACE("HTTP domain %s found",
dom->config[AUTHENTICATION_DOMAIN]);

/* TODO: Check if this is a HTTP or HTTPS domain */
conn->dom_ctx = dom;
break;
}
dom = dom->next;
}

DEBUG_TRACE("HTTP Host: %s", host);
}

Expand Down

0 comments on commit 4378fdc

Please sign in to comment.