Adding Debian's patches to source

I mostly added the Debian patches to the source.  The one using gnutls instead of openssl I changed into a separate compile flag.  I feel that the code benefits from bugfixes from anywhere, so that's why I'm proposing this pull request.