This project is read-only.

Problems with empty Cookie header

Jan 31, 2011 at 4:29 PM

Hello! 

We like Nugget a lot and want to use it in our project. Some problems were with using WebSocket emulation library (https://github.com/gimite/web-socket-js), it always generates Cookie header (empty in our case) - and hanshake fails

I've solved this problem by small "forehead" correction in ClientHandshake class:

private ClientHandshake ParseClientHandshake(ArraySegment<byte> byteShake)
        {
            // the "grammar" of the handshake
            var pattern = @"^(?<connect>[^\s]+)\s(?<path>[^\s]+)\sHTTP\/1\.1\r\n" +  // request line
                                      @"((?<field_name>[^:\r\n]+):(?<field_value>[^\r\n]+)\r\n)+"; // unordered set of fields (name-chars colon space any-chars cr lf)

// ...             
            for (int i = 0; i < fields["field_name"].Captures.Count; i++)
            {
                var name = fields["field_name"].Captures[i].ToString();
                var value = (fields["field_value"].Captures[i].ToString().Trim());
                if (value == "")
                {
                    continue;
                }
                switch (name.ToLower())
                {
// ...
                 }
            }
            return handshake;
        }
}

P.S. Can we join your team in Nugget development? It will be hardly used (i hope), so - If we find errors and correct as possible - it will be perfect to merge corrections with latest versions on the Codeplex