Forum Discussion
Michael_A__Fied
Nimbostratus
Jun 23, 2009Broken b64 decoding
Following this article:
http://devcentral.f5.com/wiki/default.aspx/iRules/LTMMaintenancePage.html
I have a nicely implemented maintenance page.
I want to add a new png file in b64 encoding, and all went well except that the decoding seems to break about 30% down.
The image is about 700x700 pixels, in png format. Using the web-based decoder at http://www.motobit.com/util/base64-decoder-encoder.asp I can confirm that the file is b64 encoded and decoded properly.
File size is about 95k - is that even a factor?
Any ideas would be great at this point.
8 Replies
- hoolio
Cirrostratus
I haven't seen any posts about the base64 decode failing. Maybe it's the format of the encoded string in the file? It should be in the format of:
"base64encodedtext",
with no new lines or carriage returns in between the double quotes.
If that doesn't solve the problem, can you elaborate on how the decoding is breaking 30% through the image?
Aaron - Michael_A__Fied
Nimbostratus
The image has been properly formatted with quotes and comma. We use other images that work just fine (albeit they are smaller images).
The image properties are transmitted correctly - pixels of size (683 x 730).
The first 200 or so pixels are rendered correctly, and then the rest is shown as white.
I took the same properly formatted string, used the online decoder, and it renders correctly. - hoolio
Cirrostratus
Are there any spaces in the base64 encoded text? If so, I think they'd need to be replaced with +. Are you okay with posting the encoded text?
Aaron - hwidjaja_37598
Altostratus
Could it be due to there are '\r' characters in your base64? What about trying to remove it in step 4:
tr -d '\n|\r' < file_with_newlines > file_without_newlines
Or, try to verify your base64 in LTM (eg. file_with_newlines):
openssl enc -d -base64 -in file_with_newlines -out file.png - hwidjaja_37598
Altostratus
Correction, the tr command should be:
tr -d '\n\r' < file_with_newlines > file_without_newlines - hwidjaja_37598
Altostratus
Or, copy the png file (eg. image.png) to LTM and run this:
openssl enc -base64 -in image.png | tr -d '\n' > /var/class/maint.logo.png.class
Sorry for spamming :D - Michael_A__Fied
Nimbostratus
Thanks y'all for your assistance - the file was formatted correctly all along from the get-go.
Seems like there's a upper limit on the size of an external class file.
From F5 Support:One of my colleagues is working on an AskF5 solution article, but it is not yet ready for publication. He tells me that the maximum size of a list item (not including the surrounding double-quotes and trailing comma) is 65520 bytes.
So all we did was split the file into smaller segments and it worked just fine. - hoolio
Cirrostratus
Thanks for posting the issue/solution.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
