Bug description
HAProxyMessageForwarder.buildHAProxyMessage parses source and destination ports with Integer.parseInt from either proxy protocol channel attributes or the channel remote/local address strings.
If a port value is malformed, for example a non-numeric proxy protocol port attribute or a malformed channel address, buildHAProxyMessage can throw NumberFormatException. This makes HAProxy message forwarding fail with a runtime parsing exception instead of simply skipping an invalid proxy protocol message.
Expected behavior
Invalid or malformed proxy protocol port values should not throw from HAProxy message construction. The forwarder should treat the HAProxy message as unavailable and return null, consistent with existing behavior when required attributes are missing.
Affected area
proxy module, remoting HTTP/2 proxy HAProxy protocol forwarding.
Suggested fix
- Parse proxy protocol ports through a safe helper.
- Return
null when source or destination ports cannot be parsed.
- Keep existing behavior for valid port values.
- Add unit tests for valid channel address parsing and malformed port values.
Bug description
HAProxyMessageForwarder.buildHAProxyMessageparses source and destination ports withInteger.parseIntfrom either proxy protocol channel attributes or the channel remote/local address strings.If a port value is malformed, for example a non-numeric proxy protocol port attribute or a malformed channel address,
buildHAProxyMessagecan throwNumberFormatException. This makes HAProxy message forwarding fail with a runtime parsing exception instead of simply skipping an invalid proxy protocol message.Expected behavior
Invalid or malformed proxy protocol port values should not throw from HAProxy message construction. The forwarder should treat the HAProxy message as unavailable and return
null, consistent with existing behavior when required attributes are missing.Affected area
proxymodule, remoting HTTP/2 proxy HAProxy protocol forwarding.Suggested fix
nullwhen source or destination ports cannot be parsed.