File tree Expand file tree Collapse file tree 1 file changed +1
-7
lines changed
test/resources/testserver Expand file tree Collapse file tree 1 file changed +1
-7
lines changed Original file line number Diff line number Diff line change @@ -55,12 +55,8 @@ def send_head(self):
55
55
else :
56
56
return self .list_directory (path )
57
57
ctype = self .guess_type (path )
58
- if ctype .startswith ('text/' ):
59
- mode = 'r'
60
- else :
61
- mode = 'rb'
62
58
try :
63
- f = open (path , mode )
59
+ f = open (path , 'rb' )
64
60
except IOError :
65
61
self .send_error (404 , "File not found" )
66
62
return None
@@ -89,14 +85,12 @@ def stop_server(port=7000):
89
85
conn .getresponse ()
90
86
91
87
def start_server (port = 7000 ):
92
- import os
93
88
os .chdir (os .path .join (os .path .dirname (os .path .abspath (sys .argv [0 ])), '..' ))
94
89
server = StoppableHttpServer (('' , port ), StoppableHttpRequestHandler )
95
90
server .serve_forever ()
96
91
97
92
98
93
if __name__ == '__main__' :
99
- import sys
100
94
if len (sys .argv ) != 2 or sys .argv [1 ] not in [ 'start' , 'stop' ]:
101
95
print ("usage: {0} start|stop" .format (sys .argv [0 ]))
102
96
sys .exit (1 )
You can’t perform that action at this time.
0 commit comments