Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making requests from Flash for URLs with + signs in them

I am hosting images on Amazon S3 and using them in my Flash application. My application receives signed S3 urls that point to the images in S3. The URL looks something like this (line breaks added for clarity):

http://s3.amazonaws.com/my-bucket/my-image.jpg?
  AWSAccessKeyId=AKIAI7PSLIMJFIA2JRQG&
  Expires=1313812683&
  Signature=yhnSe47GRjReUQlfG/S/A+JJTdo=

The problem here is with the + sign that can occur in the Signature. If I send the + sign as-is, then the browser thinks that it's a space, as it should according to the URL specs. Really, S3 shouldn't use + signs for this reason, but it seems to be something they overlooked.

Normally this isn't a problem since you just replace the + sign with a %2B. However, Flash has some default behavior that makes this difficult.

From what I can see, the URLRequest object is setup to always encode URLs as if it was passed through the encodeURI function. I don't see any way to turn this off. Unfortunately, encodeURI doesn't encode + signs, but it does encode % signs.

This means that if I leave the + sign in there then Flash leaves it alone and S3 thinks I have a space in my URL. If I use %2B then Flash turns it into %252B, due to encoding the %. Doh!

Does anybody see a way around this that I'm missing?

like image 499
Kai Avatar asked Jan 21 '26 17:01

Kai


1 Answers

I don't think it is automatically changes the url submitted to it. Adobe's documentation even tells you to take care and escape unusual characters.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html?filter_flash=cs5&filter_flashplayer=10.2&filter_air=2.6

like image 56
DefconRhall Avatar answered Jan 23 '26 20:01

DefconRhall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!