Workaround missing content-type, and formatting issues seen from some agents
Change-Id: I64f3375c0ed9a68cd620231ab14d17299840a97c
This commit is contained in:
parent
886c187e2f
commit
198943af58
@ -151,7 +151,7 @@ class HTTPRequestHandler(BaseHTTPRequestHandler):
|
|||||||
except:
|
except:
|
||||||
e = sys.exc_info()[0]
|
e = sys.exc_info()[0]
|
||||||
LOG.info("broadview_collector: do_POST missing content-type {}".format(e))
|
LOG.info("broadview_collector: do_POST missing content-type {}".format(e))
|
||||||
ctype = None
|
ctype = "application/json"
|
||||||
try:
|
try:
|
||||||
length = int(self.headers.getheader('content-length'))
|
length = int(self.headers.getheader('content-length'))
|
||||||
except:
|
except:
|
||||||
@ -159,7 +159,11 @@ class HTTPRequestHandler(BaseHTTPRequestHandler):
|
|||||||
LOG.info("broadview_collector: do_POST missing content-length {}".format(e))
|
LOG.info("broadview_collector: do_POST missing content-length {}".format(e))
|
||||||
length = 0
|
length = 0
|
||||||
if ctype and "json" in ctype.lower():
|
if ctype and "json" in ctype.lower():
|
||||||
data = ast.literal_eval(json.loads(self.rfile.read(length)))
|
c = self.rfile.read(length)
|
||||||
|
try:
|
||||||
|
data = ast.literal_eval(json.loads(c))
|
||||||
|
except:
|
||||||
|
data = json.loads(c)
|
||||||
code = collector.handlePOST(self.path, ctype, length, self.client_address[0], data )
|
code = collector.handlePOST(self.path, ctype, length, self.client_address[0], data )
|
||||||
data = json.dumps({})
|
data = json.dumps({})
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user