On Thu, Sep 18, 2008 at 4:34 PM, Eric Will <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
- Home page: http://norman.rasmussen.co.za/
_______________________________________________
JDev mailing list
FAQ: http://www.jabber.org/discussion-lists/jdev-faq
Forum: http://www.jabberforum.org/forumdisplay.php?f=20
Info: http://mail.jabber.org/mailman/listinfo/jdev
Unsubscribe: [EMAIL PROTECTED]
_______________________________________________

Reply via email to