Add handling with proxy server

Hello Andrew,

i use this change a few months for me, and you may find the change well.

Best regards,
Frank