Influencer/UNplugged — pull request #15 by overbyrn (2013-01-24 13:27:20+00:00)
Title: HTTPS Fixes for SABnzbd

Ok gents, this is my second attempt at tidying up https functionality in sabnzbd. If you get a chance to review this soon I'd appreciate it as it took me _forever_ to get back up to speed with this and I'd like to close this off whilst it's still fresh in my mind. Accounting for all the permutations of setting up http/https is a royal pain in the neck. I think I've got it down, but there could be some glitches. The main thing to bare in mind is that restarting SAB from within its own gui seems to cause the daemon to not restart. I am assuming officiall support for stopping and starting sab is only from within the unraid plugin. That would certainly close off a few issues. Either way, I've tried to account for situations where a user configures https from sab gui and does hit restart. If the daemon dies, then they will likely go back to unraid sab gui. Without a refresh they'll still have stop/restart and that should be sufficient to kick the daemon off. If they previously closed the unraid sab gui page, then reentering it should determine sab is not running and allow to start as normal.

As stated there are quite a few scenarios where things can go wrong, but on the whole I think I've caught the main ones.

Please give it a look over and let me know your thoughts.