118
118
relpath = environ['bzrlib.relpath']
119
# 1. subtract HTTP path from rcp ("adjusted rcp")
120
# 1a. If HTTP path unconsumed, clone backing transport with
121
# remainder ("adjusted transport")
122
# 2. feed HPSS request path + adjusted/backing transport + adjusted
125
120
if not relpath.startswith('/'):
126
121
relpath = '/' + relpath
127
122
if not relpath.endswith('/'):
130
# (relpath='/foo/bar/', rcp='/foo/' -> (rp 'bar', arcp '/')
131
# relpath='/foo/', rcp='/foo/bar/' -> (rp '/', arcp '/bar')
125
# Compare the HTTP path (relpath) and root_client_path, and calculate
126
# new relpath and root_client_path accordingly, to be used to build the
132
128
if relpath.startswith(self.root_client_path):
133
# The entire root client path is part of the relpath.
129
# The relpath traverses all of the mandatory root client path.
130
# Remove the root_client_path from the relpath, and set
131
# adjusted_tcp to None to tell the request handler that no further
132
# path translation is required.
134
133
adjusted_rcp = None
135
# Consume the relpath part we just subtracted
136
134
adjusted_relpath = relpath[len(self.root_client_path):]
137
135
elif self.root_client_path.startswith(relpath):
138
136
# The relpath traverses some of the mandatory root client path.
139
# Subtract relpath from HTTP request
137
# Subtract the relpath from the root_client_path, and set the
140
139
adjusted_rcp = '/' + self.root_client_path[len(relpath):]
141
# The entire relpath was consumed.
142
140
adjusted_relpath = '.'
144
142
adjusted_rcp = self.root_client_path