Commits

victorlin  committed 8de80b8

Add basic files

  • Participants

Comments (0)

Files changed (5)

+POST / HTTP/1.1
+Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
+Accept-Charset: Big5,utf-8;q=0.7,*;q=0.3
+Accept-Encoding: gzip,deflate,sdch
+Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4
+Cache-Control: max-age=0
+Connection: keep-alive
+Content-Length: 377
+Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryAQRPBQgGHAhs61hx
+Origin: null
+Host: example.com
+
+------WebKitFormBoundaryAQRPBQgGHAhs61hx
+Content-Disposition: form-data; name="image"; filename="log.txt"
+Content-Type: text/plain
+
+hello
+------WebKitFormBoundaryAQRPBQgGHAhs61hx
+Content-Disposition: form-data; name="name"
+
+
+------WebKitFormBoundaryAQRPBQgGHAhs61hx
+Content-Disposition: form-data; name="submit"
+
+Submit
+------WebKitFormBoundaryAQRPBQgGHAhs61hx--
+import socket
+
+with open('my_req.txt', 'rt') as file:
+    req = file.read()
+
+HOST = '127.0.0.1'
+PORT = 7777
+s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+s.connect((HOST, PORT))
+s.send(req)
+while True:
+    data = s.recv(1024)
+    if not data:
+        break
+    print data
+s.close()
+---
+uwsgi:
+    pidfile: uwsgi.pid
+    socket: /tmp/uwsgi_bug.sock
+    chmod-socket: 666
+    master: true
+    no-orphans: true
+    module: wsgi
+...
+

File uwsgi_bug.nx.conf

+server {
+    listen       7777;
+
+    location / {
+        include uwsgi_params;
+        uwsgi_pass unix:///tmp/uwsgi_bug.sock;
+    }
+}
+def application(environ, start_response):
+    if True:
+        from webob import Request
+        req = Request(environ)
+        print req.str_POST
+    input = environ['wsgi.input']
+    while True:
+        line = input.readline()
+        if not line:
+            break
+        print repr(line)
+