@@ -868,25 +868,28 @@ def _listing_iter(self, lcontainer, lprefix, env):
868
868
self .account_name , lcontainer )
869
869
marker = ''
870
870
while True :
871
- path = '/%s/%s' % (quote (self .account_name ), quote (lcontainer ))
872
- lreq = Request .blank (
873
- '%s?prefix=%s&format=json&marker=%s' %
874
- (path , quote (lprefix ), quote (marker )), environ = env )
871
+ lreq = Request .blank ('i will be overridden by env' , environ = env )
872
+ lreq .environ ['PATH_INFO' ] = \
873
+ '/%s/%s' % (quote (self .account_name ), quote (lcontainer ))
875
874
lreq .environ ['REQUEST_METHOD' ] = 'GET'
876
- lreq .path_info = path
875
+ lreq .environ ['QUERY_STRING' ] = \
876
+ 'format=json&prefix=%s&marker=%s' % (quote (lprefix ),
877
+ quote (marker ))
877
878
shuffle (lnodes )
878
879
lresp = self .GETorHEAD_base (lreq , _ ('Container' ),
879
880
lpartition , lnodes , lreq .path_info ,
880
881
self .app .container_ring .replica_count )
881
- if lresp .status_int == 404 :
882
- raise ListingIterNotFound ()
883
- elif lresp .status_int // 100 != 2 :
884
- raise ListingIterError ()
885
882
if 'swift.authorize' in env :
886
883
lreq .acl = lresp .headers .get ('x-container-read' )
887
884
aresp = env ['swift.authorize' ](lreq )
888
885
if aresp :
889
886
raise ListingIterNotAuthorized (aresp )
887
+ if lresp .status_int == 404 :
888
+ raise ListingIterNotFound ()
889
+ elif lresp .status_int // 100 != 2 :
890
+ raise ListingIterError ()
891
+ if not lresp .body :
892
+ break
890
893
sublisting = json .loads (lresp .body )
891
894
if not sublisting :
892
895
break
0 commit comments