Roxen.git / server / modules / misc / websocket.pike

version» Context lines:

Roxen.git/server/modules/misc/websocket.pike:39:    return has_value(lower_case(id->request_headers->connection||"")/",",    "upgrade");   }      protected int is_upgrade_websocket(string path, RequestID id)   {    return has_value(lower_case(id->request_headers->upgrade||"")/",",    "websocket");   }    - protected int is_websocket_version_13(string path, RequestID id) + protected int is_websocket_version_valid(string path, RequestID id)   { -  return id->request_headers["sec-websocket-version"] == "13"; +  return id->request_headers["sec-websocket-version"] == +  (string)Protocols.WebSocket.websocket_version;   }      protected int has_valid_websocket_key(string path, RequestID id)   {    string raw_key = "";    catch {    raw_key = MIME.decode_base64(id->request_headers["sec-websocket-key"]);    };    return sizeof(raw_key) >= 16;   }
Roxen.git/server/modules/misc/websocket.pike:102:       id->register_vary_callback("connection", is_upgrade_websocket);       if (!is_upgrade_websocket("", id)) {    // Unsupported upgrade header.    id->misc->error_code = id->misc->error_code || Protocols.HTTP.HTTP_BAD;    TRACE_LEAVE("No - Unsupported or missing upgrade header.");    return 0;    }    -  id->register_vary_callback("sec-websocket-version", is_websocket_version_13); +  id->register_vary_callback("sec-websocket-version", +  is_websocket_version_valid);    -  if (!is_websocket_version_13("", id)) { +  if (!is_websocket_version_valid("", id)) {    // Unsupported WebSocket version.    TRACE_LEAVE("No - Unsupported websocket version.");    return Roxen.http_status(Protocols.HTTP.HTTP_BAD,    "Unsupported WebSocket version.") + ([    "extra_heads": ([ -  "Sec-WebSocket-Version": (string)13/*Protocols.WebSocket.websocket_version*/, +  "Sec-WebSocket-Version": (string)Protocols.WebSocket.websocket_version,    ]),    ]);    }       id->register_vary_callback("sec-websocket-key", has_valid_websocket_key);       if (!has_valid_websocket_key("", id)) {    // Invalid Sec-WebSocet-Key.    TRACE_LEAVE("No - Invalid Sec-WebSocket-Key.");    return Roxen.http_status(Protocols.HTTP.HTTP_BAD,