forked from indymedia/epicyon
Check content type
parent
d2bc9b52b4
commit
a8c72965f5
36
daemon.py
36
daemon.py
|
@ -3510,24 +3510,30 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
print('POST size too large')
|
print('POST size too large')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if ' boundary=' in headers['Content-Type']:
|
if not headers.get('Content-Type'):
|
||||||
boundary=headers['Content-Type'].split('boundary=')[1]
|
if headers.get('Content-type'):
|
||||||
if ';' in boundary:
|
headers['Content-Type']=headers['Content-type']
|
||||||
boundary=boundary.split(';')[0]
|
elif headers.get('content-type'):
|
||||||
|
headers['Content-Type']=headers['content-type']
|
||||||
|
if headers.get('Content-Type'):
|
||||||
|
if ' boundary=' in headers['Content-Type']:
|
||||||
|
boundary=headers['Content-Type'].split('boundary=')[1]
|
||||||
|
if ';' in boundary:
|
||||||
|
boundary=boundary.split(';')[0]
|
||||||
|
|
||||||
postBytes=self.rfile.read(length)
|
postBytes=self.rfile.read(length)
|
||||||
|
|
||||||
# second length check from the bytes received
|
# second length check from the bytes received
|
||||||
# since Content-Length could be untruthful
|
# since Content-Length could be untruthful
|
||||||
length=len(postBytes)
|
length=len(postBytes)
|
||||||
if length>self.server.maxPostLength:
|
if length>self.server.maxPostLength:
|
||||||
print('POST size too large')
|
print('POST size too large')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Note sending new posts needs to be synchronous, otherwise any attachments
|
# Note sending new posts needs to be synchronous, otherwise any attachments
|
||||||
# can get mangled if other events happen during their decoding
|
# can get mangled if other events happen during their decoding
|
||||||
print('Creating new post: '+newPostThreadName)
|
print('Creating new post: '+newPostThreadName)
|
||||||
self._receiveNewPostProcess(authorized,postType,path,headers,length,postBytes,boundary)
|
self._receiveNewPostProcess(authorized,postType,path,headers,length,postBytes,boundary)
|
||||||
return pageNumber
|
return pageNumber
|
||||||
|
|
||||||
def do_POST(self):
|
def do_POST(self):
|
||||||
|
|
Loading…
Reference in New Issue