New middlewares

13 views
Skip to first unread message

Alexey Zakhlestin

unread,
Jan 28, 2011, 10:30:02 AM1/28/11
to AiP development
Upcoming AiP update will also bring a pack of new "official"
Middlewares:

1) Cascade
Takes array of applications as parameter and returns result of the
first application, which doesn't send 404 error-code.
This might be useful for implementing static-caches (first app is
a FileServe, second is dynamic content generator)

new \AiP\Middleware\Cascade(array($app1, $app2), 404)

2) Compress
Compresses result using deflate or gzip, if client supports it

new \AiP\Middleware\Compress($app)

3) ConditionalGet
Sends empty response with status=304, if content didn't change,
according to Etag/LastModified

new \AiP\Middleware\ConditionalGet($app)

4) Directory
Allows to serve files in directory, using custom application. If
allowed, also returns listings of files in directories.

new \AiP\Middleware\Directory($file_app, $path,
$show_directory_listings)


also, note, that PHP_Compat middleware was renamed to \AiP\Middleware
\HTTPParser

p.s. Do you have ideas of more useful middlewares?
Reply all
Reply to author
Forward
0 new messages