How to read http_userid's Base64 encoded userid from Ruby?

Luca De Marinis loop at interact.it
Tue Feb 9 17:50:12 MSK 2010


On Tue, Feb 9, 2010 at 1:20 PM, Sven C. Koehler <schween at snafu.de> wrote:

> Hey,
>
> I am using the http user id module and have not yet figured out how I can
> read the base64 encoded cookie from Ruby.  It seems like nginx uses a
> different form of base64 than Ruby does...
>
> Example:
> | uid value = E2F32BD0F154704B0C176D1D02050303
>
> In Ruby I see the cookie encoded like this:
>
> | {"uid"=>"0Cvz4ktwVPEdbRcMAwMFAg=="}
> When I try to decode this value with Base64 in Ruby I get:
>
>
Hi, Don't know the details, but the E2F3... thing is not base64. It looks
more like hex encoding (should read as E2 F3 2B).. see ruby's String#unpack
to munge it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100209/5a1f27e8/attachment.html>


More information about the nginx mailing list