KB Article #182423
Connection fails with java.io.IOException: malformed field name
Problem
A connection from Connect to URL, Connection or a similar filter fails with an exception like:
nested fault: malformed field name java.io.IOException: malformed field name at com.vordel.dwe.http.ClientTransaction.readResponse(Native Method) at com.vordel.circuit.net.State.readResponse(State.java:105) at com.vordel.circuit.net.State.sendBody(State.java:235) at com.vordel.circuit.net.State.tryTransaction(State.java:380) at com.vordel.circuit.net.ConnectionProcessor.invoke(ConnectionProcessor.java:312) at com.vordel.circuit.net.ConnectionProcessor.invoke(ConnectionProcessor.java:280) at com.vordel.circuit.InvocationEngine.invokeFilter(InvocationEngine.java:149) at com.vordel.circuit.InvocationEngine.invokeCircuit(InvocationEngine.java:41) at com.vordel.circuit.InvocationEngine.recordCircuitInvocation(InvocationEngine.java:279) at com.vordel.circuit.InvocationEngine.processMessage(InvocationEngine.java:241) at com.vordel.circuit.SyntheticCircuitChainProcessor.invoke(SyntheticCircuitChainProcessor.java:65) at com.vordel.dwe.http.HTTPPlugin.processRequest(HTTPPlugin.java:417) at com.vordel.dwe.http.HTTPPlugin.invokeDispose(HTTPPlugin.java:443) at com.vordel.dwe.http.HTTPPlugin.invoke(HTTPPlugin.java:135)
Resolution
This happens when invalid headers are received from an endpoint. The "field name" the error refers to is the part of the HTTP header before the colon. These have a grammar defined in the RFC which must be adhered to. For example if a server sends an incorrect header like X-XSS Protection: 1; mode=block instead of X-XSS-Protection: 1; mode=block in the response, it would result in an error like this one. Note how the incorrect version of the header contains a space prior to the colon, which is not permitted by the grammar.
For ease of reference this is the grammar the RFC defines for field names:
5.1. Field Names
A field name labels the corresponding field value as having the semantics defined by that name. For example, the Date header field is defined in Section 6.6.1 as containing the origination timestamp for the message in which it appears.
field-name = token
5.6.2. Tokens
Tokens are short textual identifiers that do not include whitespace or delimiters.
token = 1*tchar
tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA; any VCHAR, except delimiters