mirror of
https://github.com/actix/actix-web.git
synced 2024-12-23 16:40:37 +00:00
Support chunked encoding for UrlEncoded body #262
This commit is contained in:
parent
ec0737e392
commit
a7dab950f3
1 changed files with 1 additions and 11 deletions
|
@ -148,7 +148,6 @@ pub trait HttpMessage {
|
||||||
/// Returns error:
|
/// Returns error:
|
||||||
///
|
///
|
||||||
/// * content type is not `application/x-www-form-urlencoded`
|
/// * content type is not `application/x-www-form-urlencoded`
|
||||||
/// * transfer encoding is `chunked`.
|
|
||||||
/// * content-length is greater than 256k
|
/// * content-length is greater than 256k
|
||||||
///
|
///
|
||||||
/// ## Server example
|
/// ## Server example
|
||||||
|
@ -365,9 +364,7 @@ where
|
||||||
|
|
||||||
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
|
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
|
||||||
if let Some(req) = self.req.take() {
|
if let Some(req) = self.req.take() {
|
||||||
if req.chunked().unwrap_or(false) {
|
if let Some(len) = req.headers().get(header::CONTENT_LENGTH) {
|
||||||
return Err(UrlencodedError::Chunked);
|
|
||||||
} else if let Some(len) = req.headers().get(header::CONTENT_LENGTH) {
|
|
||||||
if let Ok(s) = len.to_str() {
|
if let Ok(s) = len.to_str() {
|
||||||
if let Ok(len) = s.parse::<u64>() {
|
if let Ok(len) = s.parse::<u64>() {
|
||||||
if len > 262_144 {
|
if len > 262_144 {
|
||||||
|
@ -575,13 +572,6 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_urlencoded_error() {
|
fn test_urlencoded_error() {
|
||||||
let req =
|
|
||||||
TestRequest::with_header(header::TRANSFER_ENCODING, "chunked").finish();
|
|
||||||
assert_eq!(
|
|
||||||
req.urlencoded::<Info>().poll().err().unwrap(),
|
|
||||||
UrlencodedError::Chunked
|
|
||||||
);
|
|
||||||
|
|
||||||
let req = TestRequest::with_header(
|
let req = TestRequest::with_header(
|
||||||
header::CONTENT_TYPE,
|
header::CONTENT_TYPE,
|
||||||
"application/x-www-form-urlencoded",
|
"application/x-www-form-urlencoded",
|
||||||
|
|
Loading…
Reference in a new issue