हम फ्लास्क वेब सेवा काम कर रहे हैं, और हमें स्ट्रीमिंग पोस्ट के साथ कुछ समस्याएं आ रही हैं - यानी हेडर में स्थानांतरण-एन्कोडिंग शामिल है: खंडित।फ्लास्क और ट्रांसफर-एन्कोडिंग:
ऐसा लगता है कि डिफ़ॉल्ट फ्लास्क HTTP 1.1 का समर्थन नहीं करता है। क्या इसके आसपास कोई कार्य है?
हम इस आदेश को चला रहे हैं:
$ curl -v -X PUT --header "Transfer-Encoding: chunked" -d @pylucene-3.6.1-2-src.tar.gz "http://localhost:5000/async-test"
इस कोड के खिलाफ:
@app.route("/async-test", methods=['PUT'])
def result():
print '------->'+str(request.headers)+'<------------'
print '------->'+str(request.data)+'<------------'
print '------->'+str(request.form)+'<------------'
return 'OK'
यहाँ कर्ल उत्पादन है:
$ curl -v -X PUT --header "Transfer-Encoding: chunked" -d @pylucene-3.6.1-2-src.tar.gz "http://localhost:5000/async-test"
* About to connect() to localhost port 5000 (#0)
* Trying ::1... Connection refused
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 5000 (#0)
> PUT /async-test HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: localhost:5000
> Accept: */*
> Transfer-Encoding: chunked
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Content-Type: text/html; charset=utf-8
< Content-Length: 2
< Server: Werkzeug/0.8.3 Python/2.7.1
< Date: Wed, 02 Jan 2013 21:43:24 GMT
<
और यहाँ बोतल सर्वर उत्पादन है:
* Running on 0.0.0.0:5000/
------->Transfer-Encoding: chunked
Content-Length:
User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
Host: localhost:5000
Expect: 100-continue
Accept: */*
Content-Type: application/x-www-form-urlencoded
<------------
-------><------------
------->ImmutableMultiDict([])<------------
पर प्राप्त करने के लिए आप कभी भी इस के लिए एक समाधान मिला chunked से निपटने के लिए कोड जोड़ा? –
मुझे अधिसूचनाएं चालू नहीं करनी चाहिए, इसलिए मुझे अब तक यह टिप्पणी नहीं दिखाई दे रही है। Waqas का जवाब सही है; हमने टेस्ट कोड जावा पर ले जाया। –