Skip to content

Allow ini-like filesize for RequestBodyBufferMiddleware and MultipartParser #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2017

Conversation

WyriHaximus
Copy link
Member

Split off from #276
Implements / closes #275

Copy link
Member

@clue clue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally LGTM, needs some documentation and tests though 👍

@@ -696,14 +696,14 @@ public function testUploadTooLargeFile()
$data .= "Content-Disposition: form-data; name=\"file\"; filename=\"hello\"\r\n";
$data .= "Content-type: text/plain\r\n";
$data .= "\r\n";
$data .= "world\r\n";
$data .= str_repeat('world', 1024) . "\r\n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test makes perfect sense to me, but I feel that this is a bit misplaced here. Maybe add a separate test case for this? 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

}

$this->sizeLimit = $sizeLimit;
$this->sizeLimit = IniUtil::iniSizeToBytes($sizeLimit);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but doesn't match docblock/documentation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

}

$this->uploadMaxFilesize = (int)$uploadMaxFilesize;
$this->uploadMaxFilesize = IniUtil::iniSizeToBytes($uploadMaxFilesize);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but doesn't match docblock/documentation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

@WyriHaximus
Copy link
Member Author

@clue updated and added docs and tests

@WyriHaximus
Copy link
Member Author

And fixed the test error that just came up 😊

'GET',
'https://example.com/',
array(),
new HttpBodyStream($stream, 2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the 2 make sense here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, sementically no, doesn't make sense. Practically doesn't make a difference though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it anyway 👍

@@ -68,7 +68,7 @@
private $emptyCount = 0;

/**
* @param int|null $uploadMaxFilesize
* @param int|string|null $uploadMaxFilesize
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, same change is required for RequestBodyParserMiddleware 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

'GET',
'https://example.com/',
array(),
new HttpBodyStream($stream, 2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, sementically no, doesn't make sense. Practically doesn't make a difference though.

* configuration. (Note that the value from
* the CLI configuration will be used.)
* @param int|string|null $sizeLimit Either an int with the max request body size
* or an ini like sze string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sze -> size. Also, maybe mention an example like 8M.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 👍

* or null to use post_max_size from PHP's
* configuration. (Note that the value from
* the CLI configuration will be used.)
* @param int|string|null $sizeLimit Either an int with the max request body size
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "...body size in bytes..."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, done 👍

@clue clue merged commit 0c54ac8 into reactphp:master Dec 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow ini-like filesizes
4 participants