Merge lp:~mnordhoff/loggerhead/380026-fix-serving-branches into lp:loggerhead

Proposed by Matt Nordhoff
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mnordhoff/loggerhead/380026-fix-serving-branches
Merge into: lp:loggerhead
Diff against target: None lines
To merge this branch: bzr merge lp:~mnordhoff/loggerhead/380026-fix-serving-branches
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+6759@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Matt Nordhoff (mnordhoff) wrote :

Serving branches over HTTP had gotten broken when Loggerhead was converted to use transports. This fixes it. (See bug #380026.)

Jelmer proposed an alternate fix 5 days ago in lp:~jelmer/loggerhead/fix-bzrserve, but I didn't notice until after I had written this.

I like my fix better, though, since it returns 404 Not Found instead of a traceback when someone tries to access .bzr/ on a remote branch.

Revision history for this message
Matt Nordhoff (mnordhoff) wrote :

...OTOH, Jelmer included a nice TODO comment.

Revision history for this message
Matt Nordhoff (mnordhoff) wrote :

Oh, I forgot about one bug I noticed in my fix:

When serving a remote branch, the 404 responses don't get logged properly. It just shows:

DEBUG:paste.httpserver.ThreadPool:Added task (0 tasks queued)
DEBUG:paste.httpserver.ThreadPool:Added task (0 tasks queued)
DEBUG:paste.httpserver.ThreadPool:Added task (0 tasks queued)
DEBUG:paste.httpserver.ThreadPool:Added task (0 tasks queued)

How should I fix that?

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Looks good, and fixes the bug.

The 404s not being logged thing is strange, but happens for other 404s too -- so probably isn't a problem with this branch.

Please land.

review: Approve

Updating diff...

An updated diff will be available in a few minutes. Reload to see the changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loggerhead/apps/transport.py'
2--- loggerhead/apps/transport.py 2009-05-04 20:28:50 +0000
3+++ loggerhead/apps/transport.py 2009-05-24 19:14:44 +0000
4@@ -82,8 +82,13 @@
5 elif environ['PATH_INFO'] == '/favicon.ico':
6 return favicon_app(environ, start_response)
7 elif '/.bzr/' in environ['PATH_INFO']:
8- app = urlparser.make_static(None, self.transport)
9- return app(environ, start_response)
10+ try:
11+ path = urlutils.local_path_from_url(self.transport.base)
12+ except errors.InvalidURL:
13+ raise httpexceptions.HTTPNotFound()
14+ else:
15+ app = urlparser.make_static(None, path)
16+ return app(environ, start_response)
17 else:
18 return BranchesFromTransportServer(
19 self.transport, self)(environ, start_response)

Subscribers

People subscribed via source and target branches