I have a python Flask listener waiting on port 8080. I expect another process to make a series of POST's to this port.The code for listener is as follows.
#!/usr/bin/env python2
from __future__ import print_function
from flask import Flask, request
from werkzeug import secure_filename
from datetime import datetime
import os, traceback, sys
import zlib
import ssl
import json
import os
import base64app = Flask('__name__')@app.route('/',methods=['GET','POST','OPTIONS'])
def recive_fe_events():try:data = request.get_data()if request.content_length < 20000 and request.content_length != 0:filename = 'out/{0}.json'.format(str(datetime.now()))with open(filename, 'w') as f:f.write(data)print('Wrote', filename)else:print("Request too long", request.content_length)content = '{{"status": 413, "content_length": {0}, "content": "{1}"}}'.format(request.content_length, data)return content, 413 except:traceback.print_exc()return None, status.HTTP_500_INTERNAL_SERVER_ERRORreturn '{"status": 200}\n'if __name__ == '__main__':app.run(host='0.0.0.0',debug=False,port=8080)
However whenever I try to trigger an event to be pushed to the above listener.It seems that I am getting OPTIONS
instead of POST
.
192.168.129.75 - - [20/May/2015 14:33:45] "OPTIONS / HTTP/1.1" 200 -
192.168.129.75 - - [20/May/2015 14:33:45] "OPTIONS / HTTP/1.1" 200 -
192.168.129.75 - - [20/May/2015 14:33:51] "OPTIONS / HTTP/1.1" 200 -
192.168.129.75 - - [20/May/2015 14:33:51] "OPTIONS / HTTP/1.1" 200 -
I read in the flask documentation. (Starting with Flask 0.6, OPTIONS is implicitly added and handled by the standard request handling.)
Why am I seeing OPTIONS
when I expect POST
.It seems that POST
seems to be missing for some reason.I have captured the traffic while the POST is happening usuing tcpdump and analyzed using wireshark.The relevant portion of the trace is attached here.
It does seem to me that the source trying to do the POST is encrypting the data using SSL.Is my understanding correct?