# HG changeset patch # User Florian Zeitz # Date 1338134032 -7200 # Node ID 4d21bd5dde497116ae13f28652d4588f3904f9c6 # Parent e87678a527202cf12631983abfe5ab307e3ee468 mod_websocket: Be nice to non-websocket clients diff -r e87678a52720 -r 4d21bd5dde49 mod_websocket/mod_websocket.lua --- a/mod_websocket/mod_websocket.lua Sun May 27 17:17:52 2012 +0200 +++ b/mod_websocket/mod_websocket.lua Sun May 27 17:53:52 2012 +0200 @@ -315,7 +315,12 @@ function handle_request(event, path) local request, response = event.request, event.response; - -- Add sanity checks + if not request.headers.sec_websocket_key then + response.headers.content_type = "text/html"; + return [[Websocket +

It works! Now point your WebSocket client to this URL to connect to Prosody.

+ ]]; + end response.conn:setlistener(listener); response.status = "101 Switching Protocols";