If you haven’t heard of Powerpal, it’s a little Bluetooth Low-Energy (BLE) device available in Australia that attaches to your residential electricity meter to collect and display realtime and historic energy usage data via a mobile app. This alone is pretty awesome, but if you’re in the state of Victoria, you can also get one for free under the Victorian Government Energy Upgrades scheme.
… and if you claim yours via my referral link, I get $5: https://www.
Earlier this week, I thought I stumbled across a bug in the go standard library.
Earlier this week, I was wrong.
While browsing the net/http sources, I spotted what appears to be an index out of range in calls to http.Request.BasicAuth().
Decoding func parseBasicAuth():
If the value string has prefix “Basic “ base64 decode the remainder of the string find the index of the first colon (:) in the decoded result return username and password as the substrings before and after the colon, respectively But wait - what if there’s nothing after the colon?
Edit: Thanks to /u/epiris for pointing out that I actually posted a server-side code example, not client side. I think I got distracted while finishing off the post… completely missing the point! Whoops. Code sample is fixed now.
At work this week, I was tasked with updating a couple of older internal go applications currently serving HTTP to serve HTTPS instead.
Generally, go makes this a pretty simple task and there are plenty of existing guides on the web that cover the process, so I won’t bore you with it here.