Commit d3f62f27 authored by Michel Pelletier's avatar Michel Pelletier

Added try: except: to catch malformed PCGI info files.

parent 6e0e75cb
......@@ -346,12 +346,16 @@ class PCGIServer(asyncore.dispatcher):
"read configuration information from a PCGI info file"
lines=open(info_file).readlines()
directives={}
for line in lines:
line=string.strip(line)
if not len(line) or line[0]=='#':
continue
k,v=string.split(line,'=',1)
directives[string.strip(k)]=string.strip(v)
try:
for line in lines:
line=string.strip(line)
if not len(line) or line[0]=='#':
continue
k,v=string.split(line,'=',1)
directives[string.strip(k)]=string.strip(v)
except:
raise 'ParseError', 'Error parsing PCGI info file'
self.pid_file=directives.get('PCGI_PID_FILE',None)
self.socket_file=directives.get('PCGI_SOCKET_FILE',None)
if directives.has_key('PCGI_PORT'):
......
......@@ -346,12 +346,16 @@ class PCGIServer(asyncore.dispatcher):
"read configuration information from a PCGI info file"
lines=open(info_file).readlines()
directives={}
for line in lines:
line=string.strip(line)
if not len(line) or line[0]=='#':
continue
k,v=string.split(line,'=',1)
directives[string.strip(k)]=string.strip(v)
try:
for line in lines:
line=string.strip(line)
if not len(line) or line[0]=='#':
continue
k,v=string.split(line,'=',1)
directives[string.strip(k)]=string.strip(v)
except:
raise 'ParseError', 'Error parsing PCGI info file'
self.pid_file=directives.get('PCGI_PID_FILE',None)
self.socket_file=directives.get('PCGI_SOCKET_FILE',None)
if directives.has_key('PCGI_PORT'):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment