Hi, Maciej, On Tue, Sep 8, 2009 at 3:24 PM, Maciej Stachowiak<mjs@apple.com> wrote:
On Sep 7, 2009, at 10:41 PM, Yuzo Fujishima wrote:
Building and installing some Apache modules doesn't seem like that big a deal to me, if it would really make testing more practical.
However, it seems like using a premade websocket server implementation would make some forms of testing harder. In particular, it would be more difficult to test what happens in the face of malformed results from the server, which is a very important part of testing.
So based on that, it probably makes more sense to do at least some of the testing and a lower level, so we can easily test invalid server responses.
Using mod_pywebsocket, we can write a server-side Web Socket handler for a URL and put it in a corresponding directory under LayoutTests/...
A handler is a Python script and can send (or not send) arbitrary bytes, malformed or not, to the browser.
Sounds like that part will be easy to test, then, though I'm surprised that mod_pywebsocket doesn't implement the WebSocket protocol framing.
mod_pywebsocket provides utility classes that handles framing. Normal handlers are expected to use them. http://code.google.com/p/pywebsocket/source/browse/trunk/src/example/echo_ws... mod_pywebsocket allows direct access to the connection in addition.
A handler is called after Web Socket handshake. There is no way to send malformed messages during handshake, as far as mod_pywebsocket is functioning properly. We may need a different mechanism here.
How do you test a case where the Web server returns broken HTTP headers, for example? Perhaps we can do similar for Web Sockets?
One way is to control the status line and headers is using .asis files.
Thank you! Yuzo
Regards, Maciej