Re: [reSIProcate] WebSocket cookie support
On 04/09/13 23:02, Scott Godin wrote:
> Correct me if I'm wrong, but the Cookie header is part of an HTTP message
> and not a SIP message, correct? Assuming yes - I would be very hesitant to
Yes, the HTTP "Upgrade" request sent in the WebSocket handshake
> modify the SIP message parsing logic for multi header support of an HTTP
> message - this sounds wrong to me. I would suggest either using
It is a little bit naughty, but that is how the WebSocket handshake code
works. This is part of the original WebSocket patch imported from the
SIPml5 contribution, notice how it handles the HTTP request as a SipMessage:
https://github.com/resiprocate/resiprocate/blob/master/resip/stack/ConnectionBase.cxx#L553
and the extra headers, e.g. h_SecWebSocketKey:
https://github.com/resiprocate/resiprocate/blob/master/resip/stack/ConnectionBase.cxx#L664
Catalin has already put in the Cookie header as StringCategory in his
fork and we will probably merge his contribution and then, if necessary,
all the WebSocket related headers would need to be moved away from the
SIP parser later on, that would probably have to be a separate task.
> StringCategory as you have pointed out, or just performing HTTP message
> parsing with separate routines and classes utilizing the ParseBuffer
> utility class.
>
> Scott
>
>
> On Wed, Sep 4, 2013 at 4:41 PM, Catalin Constantin Usurelu <
> catalin.usurelu5@xxxxxxxxx> wrote:
>
>> Hi everyone,
>>
>> I'm working on adding cookie support for WebSocket in reSIProcate but I'm
>> not sure how to proceed, so I would like some suggestions/feedback, if
>> possible.
>>
>> Basically I would like to use the existing code and logic used to
>> implement the SIP header support in resip/stack (that's where the cookie
>> code will be too).
>> The thing is, from reading the RFC's, the cookie header is like this:
>> Cookie: name1=value1; name2=value2 And you can theoretically have many
>> headers (but in practice it's never done).The problem is I can't use the
>> existing code to parse the ';' symbol, it only knows of using ',' to split
>> multiple field-values.I could add some code to also treat the cookie
>> case but it's not really "sip grammar" (neither
>> is the cookie, but I think it's fine if it uses the existing code), so I'm
>> not sure if it's ok or not. Or I could just use the Cookie header as
>> StringCategory type, and make a separate parser
>> just for cookies but it won't really adhere to the code style/pattern.
>>
>> Kind regards,
>>
>> Catalin
>>
>> _______________________________________________
>> resiprocate-devel mailing list
>> resiprocate-devel@xxxxxxxxxxxxxxx
>> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
>>
>
>
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel@xxxxxxxxxxxxxxx
> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
>