Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Big Potential Issue With HTTP Headers and IOS 9 / Safari 9
Fri, Oct 2 2015 6:03 AMPermanent Link

Mark Brooks

Slikware

Avatar

All,

Just a quick one to potentially be wary of. I think I have discovered an issue with EWB apps that utilise HTTP headers when running in Safari or Chrome on iOS 9 and in Safari 9 on Yosemite or El Capitan.

My code generally sets HTTP headers using code like this:

- RequestHeaders.Add('Content-Type: application/json')

You will note that there is a space between the header name element and the corresponding value element within the header string.

Deeper inside EWB this results in a call to the SetRequestHeader method of the HTTP object. At this stage EWB will have parsed out the name and value elements. The latter will unfortunately have a space in, so in this case we will see the following call:

- SetRequestHeader('Content-Type',' application/json')

Again, you will see that the space remains in front of the value element. I think this is because the EWB parsing is handled by the standard TStringList name-value functionality.

Whilst this has never been an issue before, it turns out that the SetRequestHeader call in IOS 9 and Safari 9 (and I suspect an upcoming version of Chrome) will throw an exception (Syntax Error DOM Exception 12) because of the leading space.

So, immediate workaround is to ensure that your request headers do not contain a space between the name and value element (even though they will have one when returned by the browser!!!!!). I have LOTS of these to fix.

Medium term I wonder if Tim thinks this is worth a fix within EWB at the point where the name and value elements are passed into SetRequestHeader, or is it down to the caller to get it right?

Either way - beware. It took me a day to work this one out!

Mark
Fri, Oct 2 2015 8:59 AMPermanent Link

Matthew Jones

Mark Brooks wrote:

> Medium term I wonder if Tim thinks this is worth a fix within EWB at
> the point where the name and value elements are passed into
> SetRequestHeader, or is it down to the caller to get it right?

Strikes me that a couple of Trim() calls can't hurt...

--

Matthew Jones
Fri, Oct 2 2015 9:13 AMPermanent Link

Mark Brooks

Slikware

Avatar

"Matthew Jones" wrote:

>> Strikes me that a couple of Trim() calls can't hurt...

You took the words right out of my mouth!
Fri, Oct 2 2015 10:25 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< Medium term I wonder if Tim thinks this is worth a fix within EWB at the point where the name and value elements are passed into SetRequestHeader, or is it down to the caller to get it right? >>

Nah, it'll be fixed.  I'll add it for 2.02.

Thanks for the heads-up.  I'm still using IOS 7 on my iPhone, so I haven't seen this. Smile

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Oct 2 2015 11:27 AMPermanent Link

Mark Brooks

Slikware

Avatar

Tim Young [Elevate Software] wrote:

>>Nah, it'll be fixed.  I'll add it for 2.02.

And that is why we love you xxxxx

PS. Hope Sam's doing ok. Say hi from the UK.
Fri, Oct 2 2015 4:14 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< PS. Hope Sam's doing ok. Say hi from the UK. >>

Yes, she is, and will do, thanks. Smile

Tim Young
Elevate Software
www.elevatesoft.com
Image