tamagokun / rackem

Rack implementation in PHP with built-in web server for development.
http://tamagokun.github.io/rackem/
MIT License
63 stars 3 forks source link

phpsgi #34

Open c9s opened 9 years ago

c9s commented 9 years ago

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

c9s commented 9 years ago

by the way, we also developed an extension for phpsgi https://github.com/phpsgi/phpsgi/tree/master/ext

tamagokun commented 9 years ago

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.

c9s commented 9 years ago

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.

tamagokun commented 9 years ago

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?

c9s commented 9 years ago

@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?

c9s commented 9 years ago

cc @RickySu

c9s commented 9 years ago

Let me introduce @RickySu, he is working on libuv http server implementation on both HHVM / Zend PHP engines. He is also interested in PHPSGI. :)

tamagokun commented 9 years ago

@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:

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.

tamagokun commented 9 years ago

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.

tamagokun commented 9 years ago

wow. libuv in php would be just amazing.

Slack is good. I'm on slack all the time anyways.

c9s commented 9 years ago

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!

tamagokun commented 9 years ago

Thanks! Sounds good! Be safe.