Merge lp:~deuns-martinez/loggerhead/flup into lp:loggerhead

Proposed by Denis Martinez
Status: Superseded
Proposed branch: lp:~deuns-martinez/loggerhead/flup
Merge into: lp:loggerhead
Diff against target: 40 lines (+21/-1)
2 files modified
loggerhead/config.py (+3/-0)
loggerhead/main.py (+18/-1)
To merge this branch: bzr merge lp:~deuns-martinez/loggerhead/flup
Reviewer Review Type Date Requested Status
Loggerhead Team Pending
Review via email: mp+15174@code.launchpad.net

This proposal has been superseded by a proposal from 2009-11-27.

To post a comment you must log in.
Revision history for this message
Denis Martinez (deuns-martinez) wrote :

Proposal to add FastCGI, SCGI and AJP support using flup.
This makes it usable under the Cherokee web server and others.

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

This looks nice to be, though I don't want to set up something to test it.

The (optional) flup dependency should be added to the README, but that's something than can be done when it's merged.

39 + return

That should be sys.exit(1), IMO.

Revision history for this message
Robert Collins (lifeless) wrote :

Matt, why sys.exit(1) rather than return? to get a non-zero exit code?

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

(Oops, didn't see this email.)

Robert Collins wrote:
> Matt, why sys.exit(1) rather than return? to get a non-zero exit code?

Yeah. Plus, it's consistent with the other code.

Revision history for this message
Martin Albisetti (beuno) wrote :

Denis, could you tweak these bits so we can merge?

lp:~deuns-martinez/loggerhead/flup updated
395. By Denis Martinez

sys.exit(1) instead of return

Revision history for this message
Denis Martinez (deuns-martinez) wrote :

Alright, it's done.

Unmerged revisions

395. By Denis Martinez

sys.exit(1) instead of return

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loggerhead/config.py'
2--- loggerhead/config.py 2009-10-17 08:47:38 +0000
3+++ loggerhead/config.py 2009-11-23 22:55:19 +0000
4@@ -46,6 +46,9 @@
5 "(defaults to 8080)."))
6 parser.add_option("--host", dest="user_host",
7 help="Host Loggerhead should listen on.")
8+ parser.add_option("--protocol", dest="protocol",
9+ help=("Protocol to use: http, scgi, fcgi, ajp"
10+ "(defaults to http)."))
11 parser.add_option("--memory-profile", action="store_true",
12 help="Profile the memory usage using Dozer.")
13 parser.add_option("--prefix", dest="user_prefix",
14
15=== modified file 'loggerhead/main.py'
16--- loggerhead/main.py 2009-10-17 06:35:33 +0000
17+++ loggerhead/main.py 2009-11-23 22:55:19 +0000
18@@ -151,4 +151,21 @@
19 else:
20 host = config.get_option('user_host')
21
22- httpserver.serve(app, host=host, port=port)
23+ if not config.get_option('protocol'):
24+ protocol = 'http'
25+ else:
26+ protocol = config.get_option('protocol')
27+
28+ if protocol == 'http':
29+ httpserver.serve(app, host=host, port=port)
30+ else:
31+ if protocol == 'fcgi':
32+ from flup.server.fcgi import WSGIServer
33+ elif protocol == 'scgi':
34+ from flup.server.scgi import WSGIServer
35+ elif protocol == 'ajp':
36+ from flup.server.ajp import WSGIServer
37+ else:
38+ print >> sys.stderr, 'Unknown protocol: %s.' % (protocol)
39+ return
40+ WSGIServer(app, bindAddress=(host, int(port))).run()

Subscribers

People subscribed via source and target branches