Forum Discussion
Jorge_Cabanilla
Nimbostratus
Jul 08, 2010Send a binary file as content in http:response, I need help
Hi,
Some one knows how to send a binary file as content in an HTTP:respond?
Is it possible to assign a file to a variable?
How to read a file?
I need the next:
...
Hamish
Cirrocumulus
Jul 08, 2010You have 2 choices.
1. Hardcode the content to be sent back in the iRule itself.
2. Or read the content from a DataGroup (Class).
I did write an iRule last year for a customer that let you use the F5 as a web server, and used datagroups as the 'filesystem' repository...
If you're going to go down that route, then the hardest thing is to get the binary content into the DataGroup itself. (That's only 'hard' because you have to encode the binary file and then add it into key/value pairs in a string DataGroup (I used a perl script and iControl to read a real filesystem, encode and upload the values, using the filename as the key. And adding in the mimetype as well so the iRule didn't need to figure it out).
(Sorry to be vague, but I don't have the iRule or perl code that I wrote - But it is my recommendation to go this way... It's harder at first, but oh so easy to add new files... Just drop them in a directory on a server and run the upload command).
H
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects