summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2015-02-16 12:44:31 +0100
committerBenoit Foucher <benoit@zeroc.com>2015-02-16 12:44:31 +0100
commitc4b35b30b99898e9ef1ae44655011b3575d634a3 (patch)
tree87879b8d66e9a85bb0c9022731cff7fe72756183 /java/src
parentICE-6307 - Fixed ruby makefile to add ruby static lib path to linker for cust... (diff)
downloadice-c4b35b30b99898e9ef1ae44655011b3575d634a3.tar.bz2
ice-c4b35b30b99898e9ef1ae44655011b3575d634a3.tar.xz
ice-c4b35b30b99898e9ef1ae44655011b3575d634a3.zip
Fixed ICE-6225 - Added headers attribute to WSConnectionInfo
Diffstat (limited to 'java/src')
-rw-r--r--java/src/Ice/src/main/java/IceInternal/HttpParser.java16
-rw-r--r--java/src/Ice/src/main/java/IceInternal/WSTransceiver.java11
2 files changed, 20 insertions, 7 deletions
diff --git a/java/src/Ice/src/main/java/IceInternal/HttpParser.java b/java/src/Ice/src/main/java/IceInternal/HttpParser.java
index defa5d5c9ea..4f39d53d306 100644
--- a/java/src/Ice/src/main/java/IceInternal/HttpParser.java
+++ b/java/src/Ice/src/main/java/IceInternal/HttpParser.java
@@ -246,7 +246,7 @@ final class HttpParser
{
if(p > start)
{
- if(_headerName.length() == 0)
+ if(_headerName.isEmpty())
{
throw new WebSocketException("malformed header");
}
@@ -295,7 +295,7 @@ final class HttpParser
}
case HeaderFieldNameEnd:
{
- if(_headerName.length() == 0)
+ if(_headerName.isEmpty())
{
StringBuffer str = new StringBuffer();
for(int i = start; i < p; ++i)
@@ -309,6 +309,7 @@ final class HttpParser
if(!_headers.containsKey(_headerName))
{
_headers.put(_headerName, "");
+ _headerNames.put(_headerName, str.toString());
}
}
@@ -664,12 +665,23 @@ final class HttpParser
return null;
}
+ java.util.Map<String, String> getHeaders()
+ {
+ java.util.Map<String, String> headers = new java.util.HashMap<String, String>();
+ for(java.util.Map.Entry<String, String> entry : _headers.entrySet())
+ {
+ headers.put(_headerNames.get(entry.getKey()), entry.getValue().trim()); // Return original header name.
+ }
+ return headers;
+ }
+
private Type _type;
private StringBuffer _method = new StringBuffer();
private StringBuffer _uri = new StringBuffer();
private java.util.Map<String, String> _headers = new java.util.HashMap<String, String>();
+ private java.util.Map<String, String> _headerNames = new java.util.HashMap<String, String>();
private String _headerName = "";
private int _versionMajor;
diff --git a/java/src/Ice/src/main/java/IceInternal/WSTransceiver.java b/java/src/Ice/src/main/java/IceInternal/WSTransceiver.java
index 719d78d2300..bfa0d65e5a7 100644
--- a/java/src/Ice/src/main/java/IceInternal/WSTransceiver.java
+++ b/java/src/Ice/src/main/java/IceInternal/WSTransceiver.java
@@ -484,6 +484,7 @@ final class WSTransceiver implements Transceiver
info.localPort = di.localPort;
info.remoteAddress = di.remoteAddress;
info.remotePort = di.remotePort;
+ info.headers = _parser.getHeaders();
return info;
}
@@ -501,7 +502,7 @@ final class WSTransceiver implements Transceiver
_resource = resource;
_incoming = false;
- //
+ //
// Use a 16KB write buffer size. We use 16KB for the write
// buffer size because all the data needs to be copied to the
// write buffer for the purpose of masking. A 16KB buffer
@@ -947,9 +948,9 @@ final class WSTransceiver implements Transceiver
{
if(_instance.traceLevel() >= 2)
{
- _instance.logger().trace(_instance.traceCategory(), "received " + protocol() +
+ _instance.logger().trace(_instance.traceCategory(), "received " + protocol() +
(_readOpCode == OP_DATA ? " data" : " continuation") +
- " frame with payload length of " + _readPayloadLength + " bytes\n" +
+ " frame with payload length of " + _readPayloadLength + " bytes\n" +
toString());
}
@@ -966,7 +967,7 @@ final class WSTransceiver implements Transceiver
{
if(_instance.traceLevel() >= 2)
{
- _instance.logger().trace(_instance.traceCategory(), "received " + protocol() +
+ _instance.logger().trace(_instance.traceCategory(), "received " + protocol() +
" connection close frame\n" + toString());
}
@@ -1236,7 +1237,7 @@ final class WSTransceiver implements Transceiver
// For an outgoing connection, each message must be masked with a random
// 32-bit value, so we copy the entire message into the internal buffer
// for writing. For incoming connections, we just copy the start of the
- // message in the internal buffer after the hedaer. If the message is
+ // message in the internal buffer after the hedaer. If the message is
// larger, the reminder is sent directly from the message buffer to avoid
// copying.
//