플라스크 웹 서비스가 작동하도록 노력하고 있습니다. 스트리밍 게시물에 몇 가지 문제가 있습니다. 즉 헤더에 Transfer-Encoding : chunked가 포함되어있는 경우입니다.플라스크 및 전송 인코딩 : 청크
기본 플라스크가 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([])<------------
에서 얻을 수있는 구문 분석 청크를 처리하는 코드를 추가? –
알림을 켜지 않아야하므로 지금까지이 설명을 보지 못했습니다. Waqas의 대답은 정확합니다. 테스트 코드를 Java로 옮겼습니다. –