[jdev] ruby xmppd, and Psi
Norman Rasmussen
norman at rasmussen.co.za
Thu Sep 18 09:43:58 CDT 2008
On Thu, Sep 18, 2008 at 4:34 PM, Eric Will <rakaur at malkier.net> wrote:
> I found my problem. As I figured, it was my fault. I hadn't counted on
> cnonce being base64-encoded, and in my code that forms the `response`
> hash I use, I split the string into key=>value by splitting on the '='
> sign. The cnonce had an '=' on the end of it, which was just getting
> lopped off. I've fixed this with:
You shouldn't split it that way, because you also won't handle quoted
strings with comma's correctly. Here's the regex I use:
(\w+\s*=\s*(?:(?:"[^"]+")|(?:[^,]+)))
you end up with one capture per key=value, then you can split that on the
first = is the string, and then remove the quotes from the value if they
exist.
(I guess the correct thing to do would be to write a proper tokenizer
instead of string splitting, or regex)
--
- Norman Rasmussen
- Email: norman at rasmussen.co.za
- Home page: http://norman.rasmussen.co.za/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.jabber.org/jdev/attachments/20080918/9ebc0459/attachment-0002.htm>
More information about the JDev
mailing list