mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-10 00:42:14 +00:00
Minor optimization to avoid scanning a list twice
This commit is contained in:
parent
6e0a0b4d21
commit
ae0556b874
1 changed files with 6 additions and 3 deletions
|
|
@ -325,11 +325,14 @@ static int is_authorized(const struct mg_connection *conn,
|
|||
/* ****************************************** */
|
||||
|
||||
static int isCaptiveConnection(struct mg_connection *conn) {
|
||||
char *host = (char*)mg_get_header(conn, "Host");
|
||||
|
||||
return(ntop->getPrefs()->isCaptivePortalEnabled()
|
||||
&& (ntohs(conn->client.lsa.sin.sin_port) == 80)
|
||||
&& (mg_get_header(conn, "Host"))
|
||||
&& (strcasestr((char*)mg_get_header(conn, "Host"), CONST_HELLO_HOST) == NULL)
|
||||
&& (ntop->getPrefs()->get_alt_http_port() != 0));
|
||||
&& (ntop->getPrefs()->get_alt_http_port() != 0)
|
||||
&& host
|
||||
&& (strcasestr(host, CONST_HELLO_HOST) == NULL)
|
||||
);
|
||||
}
|
||||
|
||||
/* ****************************************** */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue