[SWS-950] getResponseHeaders() is case sensitive Created: 14/Mar/16  Updated: 05/Apr/16  Resolved: 05/Apr/16

Status: Closed
Project: Spring Web Services
Component/s: Core
Affects Version/s: 2.2.3
Fix Version/s: 2.3.0

Type: Bug Priority: Minor
Reporter: Oddgeir Gitlestad Assignee: Greg Turnquist
Resolution: Complete Votes: 1
Labels: spring-ws
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

In org.springframework.ws.transport.http.HttpUrlConnection we find the following code:

@Override
	public Iterator<String> getResponseHeaders(String name) throws IOException {
		Map<String, List<String>> mapHeader = connection.getHeaderFields();
		List<String> listHeaderValues = mapHeader.get(name);
		if (listHeaderValues == null) {
		    return Collections.<String>emptyList().iterator();
		} else {
		    return listHeaderValues.iterator();
		}
	}

This code returns an Iterator containing the HTTP-Header(s) that matches the parameter "name" . The problem is that this is case sensitive. According to the RFC HTTP-Headers are case-insensitive



 Comments   
Comment by Greg Turnquist [ 14/Mar/16 ]

Great point. What I'm wrestling with is that the interface for this API governs response header handling for not only HTTP, but also JMS, Mail, and XMPP. Do those implementations have the same case insensitivity?

Comment by Greg Turnquist [ 14/Mar/16 ]

Sorry. I resolved the wrong issue. Reopened.

Comment by Oddgeir Gitlestad [ 14/Mar/16 ]

I'm not sure about the other protocols. A quick google search gave me nothing. But this method is overridden so if you can fix it there it should not affect the others right?

Comment by Greg Turnquist [ 14/Mar/16 ]

True. It might take a bit of work to actually craft a unit test.

Comment by Oddgeir Gitlestad [ 18/Mar/16 ]

I started looking at it. If i change the content type header in MyServlet in AbstractHttpWebServiceMessageSenderIntegrationTestCase the testSendAndReceiveFault test fails. This is good since what I'm experiencing is that i don't get access to the fault when the header has a different case than Content-Type. I will write a fix for this but what i wonder is if this is enough test coverage or should i write a separate test case for header case sensitivity?

Comment by Oddgeir Gitlestad [ 18/Mar/16 ]

I created a pull request for this: https://github.com/spring-projects/spring-ws/pull/65

Generated at Mon Dec 11 07:52:59 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.