[MERGE][1.0][Bug 124089] Add root_client_path parameter to SmartWSGIApp, and use it to translate paths received from clients to local paths.

Martin (gzlist) gzlist at googlemail.com
Mon Dec 17 07:20:13 GMT 2007


On 14/12/2007, Andrew Bennetts <andrew at canonical.com> wrote:
> Andrew Bennetts wrote:
> [...]
> >
> > I have code locally that works for bzr+http, even with a shared repository.
>
> And here it is.

I have tried this with the bzr-http-client branch merged too, and it
works here as well. (with caveat about socket buffering on large
packs)

> This builds on my original bug-124089 bundle:
>
>   * allows root_client_path to be None, to indicate "no further translation
>     necessary",
>   * allows passing root_client_path to the SmartServer constructor, and
>   * changes the bzrlib.transport.http.wsgi module to take advantage of all this.
>
> The basic idea in SmartWSGIApp is that it compares the path from the HTTP
> request with the root_client_path, and then adjusts the backing transport and/or
> root_client_path given to the smart request handler accordingly.  The end result
> is that as far as the client is concerned, an HTTP POST of "mkdir c" to /a/b/ is
> equivalent to POSTing "mkdir b/c" to /a/, etc.

I don't see why all the path-wrangling stages can't go in the
RelpathSetter app, as that's what the name implies it should be doing.
But as you've largely depreciated it, why not move the last bit of it
into SmartWSGIApp and junk it?

Oh, and a minor request, can we have:
- def make_app(root, prefix, path_var, readonly=True):
+ def make_app(root, prefix, path_var="REQUEST_URI", readonly=True):
I see no reason not to default it to the common value.

> This, combined with the small change to fix the client-side path calculations
> I've posted separately, makes bzr+http actually work in non-trivial situations.

That patch is also fine, though it can lead to a couple of  weird (but
harmless) things, like requesting something that ends up as
chroot://../... followed by chroot://../../... and thus making the
server check the same thing multiple times.

I have an update-to-update of http_smart_server.txt in progress. Have
successfully tested apache configuration and scripting that works for
mod_python, mod_wsgi, mod_cgi (for fun, with some slight issues),
mod_fastcgi (with some larger issues). Will attack the text before
posting diff.

Martin



More information about the bazaar mailing list