urlsafe_decode64

By dirkkelly

Thursday, Jan 29, 2015

Back onto CampMinder today, we’re at the point where we know Proximo won’t work with our Ruby HTTP libraries and doesn’t support HTTPS connections anyway.

We decided it would be just as easy to set up our own Squid proxy, so with that we set up an instance on Digital Ocean and went googling for some tutorials on creating a proxy.

sudo apt-get update
sudo apt-get install squid

sudo cp /etc/squid3/squid.conf /etc/squid3/squid.conf.original
sudo chmod a-w /etc/squid3/squid.conf.original

sudo vim /etc/squid3/squid.conf #http_access allow all

That would be enough for our development environment, before production we’re going to have to set up http_authentication and SSL.

Once we had a proxy we could continue testing our script, we were especially interested in whether we could handle the ClientLinkRequest to CampMinders servers… turns out we couldn’t.

We were now able to send CampMinder a ClientLinkRequest with a signed payload that contained our response, unfortunately we were receiving an exception.

Object reference not set to an instance of an object

Not an error you want to get from an API, unfortunately CampMinder couldn’t find a trace of the exception, we were stumped.

It had become extremely difficult to reason with the payload decoding methods we had built (mentioned here), we wondered if it was with the payload we were having issues. Thankfully after going through the Base64 documentation we were able to find the more succinct solution of urlsafe_decode64.

Disaster! CampMinder’s signed payloads aren’t urlsafe to decode, now we were even more stumped, our messy decode software had worked, now the Library version of that request was causing issues. We went home with the problem unsolved.