forked from jonashaag/bjoern
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring of @k3d3's initial Unix socket patch.
The 'port' argument of 'bjoern.run' may now be omitted if using Unix sockets.
- Loading branch information
Showing
6 changed files
with
71 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule http-parser
updated
from 3cf68f to 1786fd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,10 @@ | ||
import bjoern | ||
from random import choice | ||
|
||
def app1(env, sr): | ||
sr('200 ok', [('Foo', 'Bar'), ('Blah', 'Blubb'), ('Spam', 'Eggs'), ('Blurg', 'asdasjdaskdasdjj asdk jaks / /a jaksdjkas jkasd jkasdj '), | ||
('asd2easdasdjaksdjdkskjkasdjka', 'oasdjkadk kasdk k k k k k ')]) | ||
return ['hello', 'world'] | ||
|
||
def app2(env, sr): | ||
sr('200 ok', []) | ||
return 'hello' | ||
|
||
def app3(env, sr): | ||
sr('200 abc', [('Content-Length', '12')]) | ||
yield 'Hello' | ||
yield ' World' | ||
yield '\n' | ||
|
||
def app4(e, s): | ||
s('200 ok', []) | ||
return ['hello\n'] | ||
|
||
apps = (app1, app2, app3, app4) | ||
|
||
def wsgi_app(env, start_response): | ||
return choice(apps)(env, start_response) | ||
|
||
bjoern.run(wsgi_app, 'unix:@hello_unix', 0) | ||
import sys | ||
from hello import * | ||
|
||
if __name__ == '__main__': | ||
try: | ||
host = sys.argv[1] | ||
except IndexError: | ||
host = 'hello_unix' | ||
host = 'unix:' + host | ||
bjoern.run(wsgi_app, host) |