Welcome Guest, Not a member yet? Register   Sign In
Compressed Asset Provider
#1

[eluser]Pygon[/eluser]
Hello all. Been playing around with something. Unfortunately, I, like many people, do not have ZLIB on my production PHP install, but I need a way to provide gzip'd assets (css, js, jpg, jpeg, gif, png, bmp).

Therefore, I present Combust (codename, we'll see if I stick with it), a compressed asset provider.

Advantages:
- caching of gzipped files
- ZLIB not required on your production system, gzip-cache the file locally, then copy to your server.
- if no ZLIB, content will be servered as normal

*Just a note: This is a rought sort of 'alpha' version. Feel free to make suggestions or contribute.*

Usage:
Load the AssetProvider library.

set_directory( <directory> ) - sets the working base directory. Automatically set to APPPATH. Cannot be set outside of server root.

send_file( <path/to/filename>,<enable caching T/F> ) - will not accept a path outside of the current working directory for safety -- preventing user submission of "../../../file/outside/server". Second parameter determines whether file should be cached.

library/AssetProvider.php on privatepaste

*One last note: Really, this is rough code. I'll be refining it over the coming weeks and will continue to update it if there is interest.*
#2

[eluser]Pygon[/eluser]
Next update (tomorrow):
- disallow filetypes such as php, inc, etc
- anything else I think of tonight
#3

[eluser]Derek Allard[/eluser]
Looks nice, and can't wait to see where you go with this. I'm moving this post into "ingited code" to give it the attention it deserves.




Theme © iAndrew 2016 - Forum software by © MyBB