|
@@ -3,12 +3,16 @@ import html |
|
|
import http.client |
|
|
import http.client |
|
|
import json |
|
|
import json |
|
|
import os |
|
|
import os |
|
|
|
|
|
import re |
|
|
import shlex |
|
|
import shlex |
|
|
import ssl |
|
|
import ssl |
|
|
import sys |
|
|
import sys |
|
|
import urllib.parse |
|
|
import urllib.parse |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RESPONSE_PATTERN = re.compile(r'''^<\?xml version=(["'])1\.0\1 encoding=(["'])UTF-8\2\?>''' '\n?' r'''<ListBucketResult xmlns=(["'])http://(?:s3\.amazonaws\.com/doc/2006-03-01/|doc\.s3\.amazonaws\.com/2006-03-01)\3>'''.encode('ascii')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Arguments |
|
|
# Arguments |
|
|
i = 1 |
|
|
i = 1 |
|
|
withListUrls = False |
|
|
withListUrls = False |
|
@@ -79,7 +83,7 @@ while True: |
|
|
break |
|
|
break |
|
|
attempt += 1 |
|
|
attempt += 1 |
|
|
continue |
|
|
continue |
|
|
if not body.startswith(b'<?xml version="1.0" encoding="UTF-8"?>\n<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">') and not body.startswith(b"<?xml version='1.0' encoding='UTF-8'?><ListBucketResult xmlns='http://doc.s3.amazonaws.com/2006-03-01'>"): |
|
|
|
|
|
|
|
|
if not RESPONSE_PATTERN.match(body): |
|
|
raise RuntimeError(f'Invalid body: {body[:200]}...') |
|
|
raise RuntimeError(f'Invalid body: {body[:200]}...') |
|
|
|
|
|
|
|
|
if b'<Marker></Marker>' in body[:200] and 'marker' in params: |
|
|
if b'<Marker></Marker>' in body[:200] and 'marker' in params: |
|
|