Open c9s opened 9 years ago
by the way, we also developed an extension for phpsgi https://github.com/phpsgi/phpsgi/tree/master/ext
Hey, that's great! I'd love to help out any way I can. Rack'em isn't actively worked on these days, but I do have a few production projects that run on it, so it still gets some updates from time to time.
I started it in 2012, so the code is probably pretty outdated. PHP has made some pretty great strides recently.
so excited! I just added you as the team member in phpsgi. The phpsgi specification is not finished yet actually, I am still thinking about a way to support file upload for SAPI servers and PHP implemented servers like your rackem or reactphp.
Thanks! Where do you prefer to have conversations? Slack, Gitter, Gchat, etc?
Uploads should just read http form data from the input stream, right? Or are you thinking of the implementation?
@tamagokun
which one do you prefer? I've opened a #phpsgi channel on PHP Taiwan Slack, if you want a new slack account just for PHPSGI I think it also works. IRC also works for me. :)
Uploads should just read http form data from the input stream, right? Or are you thinking of the implementation?
yeah.. it should read form data from the input stream, but I think the implementation might affect the specification while the implementation is experimental. And for SAPI we have $_FILES
, not sure if we want to support the $_FILES
array. XD
How does rackem handle the file upload mechanism?
cc @RickySu
Let me introduce @RickySu, he is working on libuv http server implementation on both HHVM / Zend PHP engines. He is also interested in PHPSGI. :)
@c9s man, it's been awhile since I was knee-deep in dealing with PHP file uploads, but let me ramble off some things that I may or may not be remembering correctly:
$_FILES
array and are not in the php://input
stream. I could be wrong on this, I don't exactly remember.$_FILES
array if it is not empty, but PHP builds the array structure incorrectly/in a non-standard way, so it needs to be restructured to conform with other form data fields (https://github.com/tamagokun/rackem/blob/master/lib/Rackem/Utils.php#L107)$_POST
and $_FILES
are empty, Rackem will use its own multipart/post parser to handle everything. It's kind of messy, but it handles nested form data and multipart uploads quite well. (https://github.com/tamagokun/rackem/blob/master/lib/Rackem/Utils.php#L8)I never did get around to implementing file streaming or chunk encoding, so the parser is assuming that it has the entire http body in string form.
Another thing I never got around to doing is #21.
When looking into temp files, there were some functions that claimed it would automatically destroy the temp file when the PHP process closed, but it didn't actually work. Most likely the server implementation would have to keep track of the temp files and delete them on close, or just leave them.
I think Rack just leaves uploads and leaves it up to other libraries to deal with them.
wow. libuv in php would be just amazing.
Slack is good. I'm on slack all the time anyways.
Hi @tamagokun! Just invited you to the Slack channel.
I think we might have to think about how to handle both $_FILES
from SAPI and the input stream well and have a consistent way to simplify our specification. :)
Will check your links and reply you few days later. we have typhoon and project deadlines coming!
Thanks! Sounds good! Be safe.
Wow amazing! I didn't find your project until I finished the PHPSGI spec and the server implementation. XD
I guess you might be interested in PHPSGI https://github.com/phpsgi/phpsgi
And we also implemented a HTTP server based on PHPSGI https://github.com/phpsgi/Funk
It would be great if you can join us and maybe we can share some of codes . :D