push@server:~$ http_proxy="http://user@password@10.0.0.2:3128" python test.py
Traceback (most recent call last):
File "test.py", line 12, in <module>
bucket = conn.create_bucket('foo.vazor.com')
File "/usr/lib/pymodules/python2.6/boto/s3/connection.py", line 314,
in create_bucket
data=data)
File "/usr/lib/pymodules/python2.6/boto/s3/connection.py", line 342,
in make_request
data, host, auth_path, sender)
File "/usr/lib/pymodules/python2.6/boto/connection.py", line 459, in
make_request
return self._mexe(method, path, data, headers, host, sender)
File "/usr/lib/pymodules/python2.6/boto/connection.py", line 386, in
_mexe
connection = self.get_http_connection(host, self.is_secure)
File "/usr/lib/pymodules/python2.6/boto/connection.py", line 288, in
get_http_connection
return self.new_http_connection(host, is_secure)
File "/usr/lib/pymodules/python2.6/boto/connection.py", line 298, in
new_http_connection
connection = self.proxy_ssl()
File "/usr/lib/pymodules/python2.6/boto/connection.py", line 351, in
proxy_ssl
sslSock = httplib.ssl.SSLSocket(sock)
File "/usr/lib/python2.6/ssl.py", line 118, in __init__
self.do_handshake()
File "/usr/lib/python2.6/ssl.py", line 293, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [Errno 8] _ssl.c:480: EOF occurred in violation of
protocol
Here is my test script:
import boto
access_key = 'access_key_here'
secret_access_key = 'secret_access_key_here'
conn = boto.connect_s3(
aws_access_key_id = access_key,
aws_secret_access_key = secret_access_key,
)
bucket = conn.create_bucket('foo.vazor.com')
A curl to an https website using the same proxy seems to work so I think
that piece is working properly... Anyone have any ideas what might be
going on here?
thx
Matt
--
Matt Billenstein
ma...@vazor.com
http://www.vazor.com/
I'm seeing an error when connecting to s3 using a proxy (squid):
push@server:~$ http_proxy="http://user@pass...@10.0.0.2:3128" python test.py
--
You received this message because you are subscribed to the Google Groups "boto-users" group.
To post to this group, send email to boto-...@googlegroups.com.
To unsubscribe from this group, send email to boto-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/boto-users?hl=en.
m
On Mon, Nov 22, 2010 at 03:33:02PM -0500, Mitchell Garnaat wrote:
> Hi -
> You will have to pass in args to the S3Connection constructor for proxy,
> proxy_port, proxy_user, and proxy_pass.
> Mitch
>
> On Mon, Nov 22, 2010 at 3:19 PM, Matt Billenstein <[1]ma...@vazor.com>
> wrote:
>
> I'm seeing an error when connecting to s3 using a proxy (squid):
>
> push@server:~$ http_proxy="[2]http://user@[3]pass...@10.0.0.2:3128"
> python test.py
>
> Traceback (most recent call last):
> *File "test.py", line 12, in <module>
> * *bucket = conn.create_bucket('[4]foo.vazor.com')
> *File "/usr/lib/pymodules/python2.6/boto/s3/connection.py", line 314,
> in create_bucket
> * *data=data)
> *File "/usr/lib/pymodules/python2.6/boto/s3/connection.py", line 342,
> in make_request
> * *data, host, auth_path, sender)
> *File "/usr/lib/pymodules/python2.6/boto/connection.py", line 459, in
> make_request
> * *return self._mexe(method, path, data, headers, host, sender)
> *File "/usr/lib/pymodules/python2.6/boto/connection.py", line 386, in
> _mexe
> * *connection = self.get_http_connection(host, self.is_secure)
> *File "/usr/lib/pymodules/python2.6/boto/connection.py", line 288, in
> get_http_connection
> * *return self.new_http_connection(host, is_secure)
> *File "/usr/lib/pymodules/python2.6/boto/connection.py", line 298, in
> new_http_connection
> * *connection = self.proxy_ssl()
> *File "/usr/lib/pymodules/python2.6/boto/connection.py", line 351, in
> proxy_ssl
> * *sslSock = httplib.ssl.SSLSocket(sock)
> *File "/usr/lib/python2.6/ssl.py", line 118, in __init__
> * *self.do_handshake()
> *File "/usr/lib/python2.6/ssl.py", line 293, in do_handshake
> * *self._sslobj.do_handshake()
> ssl.SSLError: [Errno 8] _ssl.c:480: EOF occurred in violation of
> protocol
>
> Here is my test script:
>
> import boto
>
> access_key = 'access_key_here'
> secret_access_key = 'secret_access_key_here'
> conn = boto.connect_s3(
> * * * *aws_access_key_id * * * = access_key,
> * * * *aws_secret_access_key * = secret_access_key,
> )
>
> bucket = conn.create_bucket('[5]foo.vazor.com')
>
> A curl to an https website using the same proxy seems to work so I think
> that piece is working properly... *Anyone have any ideas what might be
> going on here?
>
> thx
>
> Matt
>
> --
> Matt Billenstein
> [6]ma...@vazor.com
> [7]http://www.vazor.com/
> --
> You received this message because you are subscribed to the Google
> Groups "boto-users" group.
> To post to this group, send email to [8]boto-...@googlegroups.com.
> To unsubscribe from this group, send email to
> [9]boto-users+...@googlegroups.com.
> For more options, visit this group at
> [10]http://groups.google.com/group/boto-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "boto-users" group.
> To post to this group, send email to boto-...@googlegroups.com.
> To unsubscribe from this group, send email to
> boto-users+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/boto-users?hl=en.
>
> References
>
> Visible links
> 1. mailto:ma...@vazor.com
> 2. http://user/
> 3. http://pass...@10.0.0.2:3128/
> 4. http://foo.vazor.com/
> 5. http://foo.vazor.com/
> 6. mailto:ma...@vazor.com
> 7. http://www.vazor.com/
> 8. mailto:boto-...@googlegroups.com
> 9. mailto:boto-users%2Bunsu...@googlegroups.com
> 10. http://groups.google.com/group/boto-users?hl=en
Mitch, when they're ready, should I just send you those fixes, or post them here, or what?
Please send them along -- I failed to mention I'd tried explicitely
passing the proxy params in the s3 connect before I sent that first
message with the same results...
m
> Mitch, when they're ready, should I just send you those fixes, or post them here, or what?
>
> On Nov 22, 2010, at 3:33 PM, Mitchell Garnaat wrote:
>
> > You will have to pass in args to the S3Connection constructor for proxy, proxy_port, proxy_user, and proxy_pass.
> >
> > Mitch
>
> 4. http://foo.vazor.com/
> 5. http://foo.vazor.com/
> 6. mailto:ma...@vazor.com
> 7. http://www.vazor.com/
> 8. mailto:boto-...@googlegroups.com
> 9. mailto:boto-users%2Bunsu...@googlegroups.com
> 10. http://groups.google.com/group/boto-users?hl=en
--
headers['Expect'] = '100-Continue'
def get_proxy_auth_header(self):auth = base64.encodestring(self.proxy_user+':'+self.proxy_pass).strip()
if self.use_proxy:path = self.prefix_proxy_to_path(path, host)
GET http://example.com/index.html HTTP/1.1
GET /index.html HTTP/1.1
if self.use_proxy:if not self.is_secure:path = self.prefix_proxy_to_path(path, host)
I've seen proxies drop connections when they are overloaded, and for
no apparent reason too.
We've used with success this patch:
http://people.rpath.com/~misa/boto-ssl-reconnect.patch
If your problem is intermittent, please try the patch and let me know
if it helps.
Mitch, I don't remember if I ever submitted this patch - I am sure I
didn't since you took all my patches so far :-/ I am not very proud of
it, ideally it should wait a random amount of time (exponential
backoff would be nice).
Mihai
httplib/urllib/urllib2 and friends had this problem until very
recently, and it got propagated in all sorts of other places
(including my own code).
Mihai
> Let's stop using encodestring() and strip(). base64.b64encode() will
> do just fine.
Yes, that makes a lot more sense. I've made that change to my fixes and it'll be
that way when I post them (that is, after they *work*).
Yes! This is the one -- oddly I don't have any issue with the Expect
header it seems though...
Thanks!
m
m
> --
> You received this message because you are subscribed to the Google Groups "boto-users" group.
> To post to this group, send email to boto-...@googlegroups.com.
> To unsubscribe from this group, send email to boto-users+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/boto-users?hl=en.
>
--
> BTW, this behavior in base64 of appending a newline has bit me in the
> ass a couple times now -- why does it do that?
Apparently you're not the only one - Mihai said
> Let's stop using encodestring() and strip(). base64.b64encode() will
> do just fine.
>
> httplib/urllib/urllib2 and friends had this problem until very
> recently, and it got propagated in all sorts of other places
> (including my own code).
I think encodestring() adds the newlines for MIME compliance. From the Wikipedia
page about Base64,
> MIME does not specify a fixed length for Base64-encoded lines, but it does
> specify a maximum line length of 76 characters. Additionally it specifies that
> any extra-alphabetic characters must be ignored by a compliant decoder,
> although most implementations use a CR/LF newline pair to delimit encoded
> lines.
So encodestring() is trying to help you out by keeping the b64-representation of
your string from being too long -- making it MIME-ready.
If you're using strings that are short, or if you're not going to stick the result in
a MIME message, use base64.b64encode() per Mihai's suggestion.
> Yes! This is the one -- oddly I don't have any issue with the Expect
> header it seems though...
>
> Thanks!
Glad to help. I'm still struggling to get SQS and S3 working properly behind
both Squid and MS Forefront TMG.
The problem is that when using a proxy, Boto wants to add the scheme and
host part of the protocol to the path when building the request. This seems
to work fine for all of my tests *except* when accessing AWS over SSL
using TMG.
When connecting to AWS using regular HTTP, Boto adds the prefix and sends
> GET http://s3.amazonaws.com/ HTTP/1.1
TMG is fine with this, parsing the absolute URI and doing its proxy thing.
When connecting to AWS using HTTPS, though, Boto sends
> GET https://s3.amazonaws.com/ HTTP/1.1
and TMG responds with an empty HTML page, <HTML></HTML>, along
with a header
> Refresh: 0; URL=https://s3.amazonaws.com/
as if specifying the full URI, not just the pathname, was making TMG think
it should just redirect you.
I'm not really clear what's going on in here yet... trying to figure it all out.
If anybody has any insights I'd be delighted to hear them.
Thanks!
Now, it may be that amazonaws is barfing if you are sending it a full
URL in the GET request. This is not a problem when you're going plain
HTTP, because the proxy strips it for you, but it may be a problem
when going through the tunnel.
I was unable to reproduce my theory though - I did:
telnet s3.amazonaws.com 80
GET http://s3.amazonaws.com/ HTTP/1.1
Host: s3.amazonaws.com
HTTP/1.1 307 Temporary Redirect
x-amz-id-2: brJJF38JiYRXvH2mlqm94MdOyBmmA3wIEzimhIkXTuBa/fwadvsPr5pkZrJmeMub
x-amz-request-id: D1AB97B498F5E69C
Date: Tue, 23 Nov 2010 00:20:28 GMT
Location: http://aws.amazon.com/s3
Content-Length: 0
Server: AmazonS3
so that seems reasonable.
Mihai
> If the GET https:// is sent _after_ you established the tunnel to
> amazonaws, then I doubt it's the proxy's fault. The proxy has
> absolutely no way to know what's going through the tunnel.
That's what I thought, but I'd swear *somehow* TMG is getting in
the way. This may be incorrect sleuthing, but TMG uses upper-case
HTML tags in its error pages -- and the response I get back
along with that "Refresh" header is
> <HTML></HTML>
whereas I don't recall ever seeing upper-case HTML tags from
Amazon. Not a very strong clue, but a clue.
Will investigate further and report back here.