* Version 1 and 2 header currently supported.
*/
bool
-ConnStateData::findProxyProtocolMagic()
+ConnStateData::parseProxyProtocolHeader()
{
// http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt
return proxyProtocolError("PROXY protocol error: invalid header");
}
+ // TODO: detect short non-magic prefixes earlier to avoid
+ // waiting for more data which may never come
+
// not enough bytes to parse yet.
return false;
}
PROF_start(parseHttpRequest);
// try to parse the PROXY protocol header magic bytes
- if (needProxyProtocolHeader_ && !findProxyProtocolMagic())
+ if (needProxyProtocolHeader_ && !parseProxyProtocolHeader())
break;
HttpParserInit(&parser_, in.buf.c_str(), in.buf.length());
log_addr = xact->tcpClient->remote;
log_addr.applyMask(Config.Addrs.client_netmask);
- // XXX: should do this in start(), but SSL/TLS operations begin before start() is called
if (port->disable_pmtu_discovery != DISABLE_PMTU_OFF &&
(transparent() || port->disable_pmtu_discovery == DISABLE_PMTU_ALWAYS)) {
#if defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DONT)
/* PROXY protocol functionality */
bool proxyProtocolValidateClient();
- bool findProxyProtocolMagic();
+ bool parseProxyProtocolHeader();
bool parseProxy10();
bool parseProxy20();
bool proxyProtocolError(const char *reason = NULL);