Skip to content
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

Add body validation for "multipart/form-data" requests #44

Open
lezhnev74 opened this issue Jul 16, 2019 · 3 comments
Open

Add body validation for "multipart/form-data" requests #44

lezhnev74 opened this issue Jul 16, 2019 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@lezhnev74
Copy link
Owner

lezhnev74 commented Jul 16, 2019

Currently, the body of the request is validated as a string:

$body = (string) $message->getBody();

This does not work with schema validation at the moment. The problem is that we CAN specify multipart body format with a schema.

Review and decide how to change that.

Refs:

@lezhnev74 lezhnev74 added the enhancement New feature or request label Jul 16, 2019
@lezhnev74 lezhnev74 self-assigned this Jul 16, 2019
@lezhnev74 lezhnev74 changed the title Improve body validation for "multipart/form-data" requests Add body validation for "multipart/form-data" requests Jul 16, 2019
@lezhnev74
Copy link
Owner Author

Initial work is there, but PHP does not let us to access raw HTTP request body, instead we can only access $_POST/$_FILES or ServerRequest::getParsedBody/ServerRequest::getUploadedFiles.

@scaytrase
Copy link
Contributor

Initial work is there, but PHP does not let us to access raw HTTP request body

what about reading stdin directly?

https://php.net/manual/en/wrappers.php.php

php://input is a read-only stream that allows you to read raw data from the request body.

@lezhnev74
Copy link
Owner Author

Well, it would be awesome, but: php://input is not available with enctype="multipart/form-data". as stated in that doc. Webservers won't push raw HTTP body to the PHP, hm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants