UpgradResponse headers are now case insensitive
This commit is contained in:
parent
9be64bab11
commit
fc371fc7e6
|
@ -41,13 +41,14 @@ public class UpgradeResponse implements HandshakeResponse
|
|||
|
||||
public void addHeader(String name, String value)
|
||||
{
|
||||
List<String> values = headers.get(name);
|
||||
String key = name.toLowerCase();
|
||||
List<String> values = headers.get(key);
|
||||
if (values == null)
|
||||
{
|
||||
values = new ArrayList<>();
|
||||
}
|
||||
values.add(value);
|
||||
headers.put(name,values);
|
||||
headers.put(key,values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,7 +73,7 @@ public class UpgradeResponse implements HandshakeResponse
|
|||
|
||||
public String getHeader(String name)
|
||||
{
|
||||
List<String> values = headers.get(name);
|
||||
List<String> values = getHeaders(name);
|
||||
// no value list
|
||||
if (values == null)
|
||||
{
|
||||
|
@ -117,7 +118,7 @@ public class UpgradeResponse implements HandshakeResponse
|
|||
|
||||
public List<String> getHeaders(String name)
|
||||
{
|
||||
return headers.get(name);
|
||||
return headers.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
public int getStatusCode()
|
||||
|
@ -190,7 +191,7 @@ public class UpgradeResponse implements HandshakeResponse
|
|||
{
|
||||
List<String> values = new ArrayList<>();
|
||||
values.add(value);
|
||||
headers.put(name,values);
|
||||
headers.put(name.toLowerCase(),values);
|
||||
}
|
||||
|
||||
public void setStatusCode(int statusCode)
|
||||
|
|
|
@ -111,6 +111,7 @@ public class HttpResponseHeaderParser
|
|||
{
|
||||
String headerName = header.group(1);
|
||||
String headerValue = header.group(2);
|
||||
// TODO: need to split header/value if comma delimited
|
||||
response.addHeader(headerName,headerValue);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue