demoved debian build directory for upstream maintainance
[cleanup] code path cleanup
[cleanup] standardised and renamed functions to more appropriate names
Fixed an issue where HTTPS would not be set correctly

mod_rewrite causes our hook to get called twice, but on the second instance the environment is reset, this patch
overcomes this by storing the HTTPS value as a note on the connection and restores it when it sees the note has
been set on the second call. We do not need to restore any other values as the IP and port remain set to our
corrected values from the first call.