Merge pull request #132 from veebs/WebSocketVersion
Changed tabs to spaces and added some docs for websocket packages.
This commit is contained in:
commit
f05b7b0b7e
@ -47,11 +47,13 @@
|
|||||||
* }
|
* }
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* <p>10. Run the test <tt>python fuzzing_client.py</tt>. Note that the actual test case python code is
|
* <p>10. Run <tt>WebSocketServer</tt> in this package
|
||||||
|
*
|
||||||
|
* <p>11. Run the test <tt>python fuzzing_client.py</tt>. Note that the actual test case python code is
|
||||||
* located in <tt>/usr/local/lib/python2.6/dist-packages/autobahn-0.4.3-py2.6.egg/autobahn/cases</tt>
|
* located in <tt>/usr/local/lib/python2.6/dist-packages/autobahn-0.4.3-py2.6.egg/autobahn/cases</tt>
|
||||||
* and not in the checked out git repository.
|
* and not in the checked out git repository.
|
||||||
*
|
*
|
||||||
* <p>11. See the results in <tt>reports/servers/index.html</tt>
|
* <p>12. See the results in <tt>reports/servers/index.html</tt>
|
||||||
*/
|
*/
|
||||||
package io.netty.example.http.websocketx.autobahn;
|
package io.netty.example.http.websocketx.autobahn;
|
||||||
|
|
||||||
|
@ -36,13 +36,10 @@ import io.netty.channel.socket.nio.NioServerSocketChannelFactory;
|
|||||||
*
|
*
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Safari 5+ (draft-ietf-hybi-thewebsocketprotocol-00)
|
* <li>Safari 5+ (draft-ietf-hybi-thewebsocketprotocol-00)
|
||||||
* <li>
|
|
||||||
* <li>Chrome 6-13 (draft-ietf-hybi-thewebsocketprotocol-00)
|
* <li>Chrome 6-13 (draft-ietf-hybi-thewebsocketprotocol-00)
|
||||||
* <li>
|
|
||||||
* <li>Chrome 14+ (draft-ietf-hybi-thewebsocketprotocol-10)
|
* <li>Chrome 14+ (draft-ietf-hybi-thewebsocketprotocol-10)
|
||||||
* <li>
|
* <li>Chrome 16+ (RFC 6455 aka draft-ietf-hybi-thewebsocketprotocol-17)
|
||||||
* <li>Firefox 7+ (draft-ietf-hybi-thewebsocketprotocol-10)
|
* <li>Firefox 7+ (draft-ietf-hybi-thewebsocketprotocol-10)
|
||||||
* <li>
|
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public class WebSocketServer {
|
public class WebSocketServer {
|
||||||
|
@ -36,13 +36,10 @@ import io.netty.channel.socket.nio.NioServerSocketChannelFactory;
|
|||||||
*
|
*
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Safari 5+ (draft-ietf-hybi-thewebsocketprotocol-00)
|
* <li>Safari 5+ (draft-ietf-hybi-thewebsocketprotocol-00)
|
||||||
* <li>
|
|
||||||
* <li>Chrome 6-13 (draft-ietf-hybi-thewebsocketprotocol-00)
|
* <li>Chrome 6-13 (draft-ietf-hybi-thewebsocketprotocol-00)
|
||||||
* <li>
|
|
||||||
* <li>Chrome 14+ (draft-ietf-hybi-thewebsocketprotocol-10)
|
* <li>Chrome 14+ (draft-ietf-hybi-thewebsocketprotocol-10)
|
||||||
* <li>
|
* <li>Chrome 16+ (RFC 6455 aka draft-ietf-hybi-thewebsocketprotocol-17)
|
||||||
* <li>Firefox 7+ (draft-ietf-hybi-thewebsocketprotocol-10)
|
* <li>Firefox 7+ (draft-ietf-hybi-thewebsocketprotocol-10)
|
||||||
* <li>
|
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public class WebSocketSslServer {
|
public class WebSocketSslServer {
|
||||||
|
@ -48,7 +48,7 @@ public class WebSocketServerHandshaker13 extends WebSocketServerHandshaker {
|
|||||||
|
|
||||||
private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketServerHandshaker13.class);
|
private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketServerHandshaker13.class);
|
||||||
|
|
||||||
public static final String WEBSOCKET_17_ACCEPT_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
public static final String WEBSOCKET_13_ACCEPT_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
||||||
|
|
||||||
private boolean allowExtensions = false;
|
private boolean allowExtensions = false;
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ public class WebSocketServerHandshaker13 extends WebSocketServerHandshaker {
|
|||||||
res.setStatus(HttpResponseStatus.BAD_REQUEST);
|
res.setStatus(HttpResponseStatus.BAD_REQUEST);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String acceptSeed = key + WEBSOCKET_17_ACCEPT_GUID;
|
String acceptSeed = key + WEBSOCKET_13_ACCEPT_GUID;
|
||||||
byte[] sha1 = sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII));
|
byte[] sha1 = sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII));
|
||||||
String accept = base64Encode(sha1);
|
String accept = base64Encode(sha1);
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import io.netty.handler.codec.http.HttpVersion;
|
|||||||
import io.netty.handler.codec.http.HttpHeaders.Names;
|
import io.netty.handler.codec.http.HttpHeaders.Names;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instances the appropriate handshake class to use for clients
|
* Instances the appropriate handshake class to use for servers
|
||||||
*/
|
*/
|
||||||
public class WebSocketServerHandshakerFactory {
|
public class WebSocketServerHandshakerFactory {
|
||||||
|
|
||||||
|
@ -57,6 +57,6 @@ public enum WebSocketVersion {
|
|||||||
} else if (this == V13) {
|
} else if (this == V13) {
|
||||||
return "13";
|
return "13";
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException(this.toString() + " cannot be converted to a string.");
|
throw new IllegalArgumentException(this.toString() + " does not have a HttpHeaderValue.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user