pike.git / lib / modules / Protocols.pmod / WebSocket.pmod

version» Context lines:

pike.git/lib/modules/Protocols.pmod/WebSocket.pmod:603:    function fn;    if (fn = stream->set_nodelay)    fn();    stream->write("");    }       protected string expected_accept;       //! Read HTTP response from remote endpoint and handle connection    //! upgrade. -  protected void http_read(mixed _id, string data, -  object hp, array(extension_factory) extensions, mapping rext) { +  protected void http_read(mixed _id, string data, object hp, +  array(object|extension_factory) extensions, +  mapping rext) {       if (state != CONNECTING) {    websocket_closed();    return;    }       array tmp = hp->feed(data);       if (tmp) {    int major, minor;
pike.git/lib/modules/Protocols.pmod/WebSocket.pmod:699:    (string)websocket_version)/","),    websocket_version)) {    WS_WERR(1, "http_read: Unsupported Sec-WebSocket-Version: %O.\n",    headers["sec-websocket-version"]);    websocket_closed();    return;    }       if (arrayp(extensions)) {    mapping ext = parse_websocket_extensions(headers["sec-websocket-extensions"]); -  array tmp = ({ }); +        /* we finish the extension negotiation */    foreach (extensions; int i; object|extension_factory f) {    if (!objectp(f))    extensions[i] = f(1, ext, rext);    }       extensions = filter(extensions, objectp);       if (sizeof(extensions)) this_program::extensions = extensions;
pike.git/lib/modules/Protocols.pmod/WebSocket.pmod:1272:   #endif      //! Returns an extension factory which implements the @expr{permessage-deflate@} WebSocket extension.   //! It uses the default options from @[deflate_default_options]. Due to how the   //! @expr{permessage-deflate@} extension works, defragmented frames will be recombined   //! automatically.   //!   //! @note   //! If the @expr{permessage-deflate@} extension is not being used, it falls back to use   //! @[defragment]. - object permessagedeflate(void|mapping default_options) { + extension_factory permessagedeflate(void|mapping default_options) {   #if constant(Gz.deflate)    default_options = deflate_default_options + (default_options||([]));       object|zero factory(int(0..1) client_mode, mapping ext, mapping rext) {       if (client_mode && !ext) {    /* this is the first step, we just offer the extension without any    * parameters */    rext["permessage-deflate"] = ([]);    return 0;
pike.git/lib/modules/Protocols.pmod/WebSocket.pmod:1331: Inside #if constant(Gz.deflate)
   options->compressionWindowSize    = rparm->server_max_window_bits = p;    }       rext["permessage-deflate"] = rparm;    }       return _permessagedeflate(options);    };   #else -  object factory() { +  object factory(mixed ...) {    return defragment();    }   #endif       return factory;   }      //! An extension which performs extra conformance checks on incoming WebSocket frames. It can be used   //! either for testing or in situations where a very strict protocol interpretation is necessary.   class conformance_check {