It appears as though it's something with your proxy server.
I ran the script here at work, changing the proxy to our proxy server and it ran just fine. Just for kicks I ran it against an internal address and it failed with a completely different error than you described above. Running a search for the error described shows 411 as being: "The server refuses to accept the request without a defined Content- Length. The client MAY repeat the request if it adds a valid Content-Length header field containing the length of the message-body in the request message. " Maybe squid needs more headers??