RTC Forums
April 27, 2024, 04:02:31 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Just upgraded RTC SDK, something big seems to have changed  (Read 6286 times)
Andrew.W
RTC License
***
Posts: 43


« on: April 02, 2010, 01:41:50 PM »

Hi Daniel

I've just upgraded from 3.3 to the latest SDK.

Now it seems that URL parameters are being read in Uppercase, whereas before they were in the case that they were submitted in.

For example:

http://www.example.com/appdetail.htm?asAccountCode=A1111-11111&Action=EmailInbox&aiUConsole=1052794

Suppose you try to find out what parameters you have been passed.

3.30 returns 'asAccountCode'

Latest returns 'ASACCOUNTCODE'.

How can I just get what is in the URL?
Logged
Andrew.W
RTC License
***
Posts: 43


« Reply #1 on: April 02, 2010, 02:27:00 PM »

Ah, I see why:

TrtcHttpValues.setItemName now folds to uppercase anything it is passed.

It would have been better if:

- This came with a big warning in the change information (I've just re-read it again and cannot see this mentioned).
- You tried to keep applications compatible unless there was a massive reason not to do so.

Cheers, Andy
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #2 on: April 02, 2010, 03:12:45 PM »

Sorry, but this change was NOT intended.

It looks like a few too many UpperCase calls have slipped into the TRtcHttpValues class while splitting Add, Find and Set methods into the default case-insensitive versions and the new case-sensitive versions. You should be able to simply remove the Upper_Case call you have found without negative side-effects.

All assignments to "FValues.Strings" should be made WITHOUT doing any conversions to the original string. There are a few other places where this is being done now and I will be looking into releasing an update as soon as I get back from my vacation (mid of April).

Best Regards,
Danijel Tkalcec
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: April 02, 2010, 04:48:13 PM »

I have found a way to upload the file to the Web Server (using this mobile internet connection I've had to use maximum timeouts values for FTP access, but it finally passed through), please download the updated "rtcInfo.pas" unit from RTC SDK PRO Download area and let me know if you should have any other issues with it.

Best Regards,
Danijel Tkalcec
Logged
Andrew.W
RTC License
***
Posts: 43


« Reply #4 on: April 02, 2010, 05:38:04 PM »

It's looking good - behaviour of the app now looks normal  Kiss
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #5 on: April 02, 2010, 06:07:43 PM »

Thank you for your feedback. Should you or anyone else bump into any problems with the updated "rtcInfo.pas" unit, please let me know.

Best Regards,
Danijel Tkalcec
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #6 on: April 11, 2010, 05:46:32 PM »

RealThinClient SDK 3.82 is now ready for download (RTC SDK PRO Download area), correcting the issue with HTTP Query parameter names and HTTP Header names which were being converted to UPPERCASE.

Even though changes in the "rtcInfo.pas" unit (released about two weeks ago as a single file patch) were sufficient to fix the problem with Query parameter names being converted to UPPERCASE, a few more changes were required in socket and message connection providers to correct the same issue with HTTP Header names (which were also being converted to UPPERCASE).

Anyway ... this issue is now be fully resolved with RTC SDK 3.82.

Best Regards,
Danijel Tkalcec
Logged
Andrew.W
RTC License
***
Posts: 43


« Reply #7 on: April 15, 2010, 07:18:48 PM »

Another problem.

X-FORWARDED-FOR used to be returned in upper case in 3.30. It's now in Proper case (X-Forwarded-For) for some reason.

Anyway, I've coded around it now but something to be aware of. I'd be in favour of just leaving everything the way it is now.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #8 on: April 15, 2010, 08:14:36 PM »

All HTTP Header parameter names and Query parameter names were UPPERCASED by mistake in a few RTC SDK versions, which is what I have fixed in the latest RTC SDK version. In other words, the results you are getting now are correct and RTC SDK 3.30 had a bug (it was converting names to UPPERCASE - which it should NOT have been doing).

But, the change in HTTP header and query parameter name casing only affects developers who are accessing these items through the ItemName and ItemValue properties. Would you have used the Value property instead, you would not even notice there was a change, because the Request.Value['X-FORWARDED-FOR'] returns the same as Request.Value['X-Forwarded-For'] (index is case-insensitive). The same goes for Query parameters, where Request.Query['SID'] returns the same as Request.Query['Sid'].

If you want to make your code error-proof and work with different clients (some might send you parameters in all uppercase, some could do it in mixed case and some in lowercase), you should actually change your implementation to use the Value (or ValueCS) property instead of enumerating through Items using ItemName. The ItemName property is normally used only when you need the exact names passed in the correct case (for example, if you would be writing a proxy and would not want to modify header values). If you are expecting parameters (for example, the X-FORWARDED-FOR header), it is easier to simply check a parameter value using the Value or ValueCS property (as explained above) than to enumerate through all received parameters and check if the one you need is present.

Also ... If you have old and new RTC Clients, because the old RTC SDK version was automatically converting all HTTP header values names to UpperCase, you should not put specific expectations about HTTP value name casing in your code. Make your code independent of any case style used by the other side, or you might be breaking compatibility with old clients by making your code compatible with new clients. Also note that some Proxy servers might be sending you X-FORWARDED-FOR instead of X-Forwarded-For, or any other possible alternative.

HTTP specification ( http://www.w3.org/Protocols/HTTP/1.0/draft-ietf-http-spec.html#Message-Headers ) says when referring to HTTP header parameters (message headers) that <quote>field names are case-insensitive</quote>, which means that you should not make the assumption about the case in which each HTTP header parameter name will be received. Instead, make your implementation case-insensitive. You can do this by using the Value property instead of ItemName and ItemValue, or by using case-insensitive string comparison functions (like "SameText", for example) to check if ItemName matches.

Best Regards,
Danijel Tkalcec
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.027 seconds with 16 queries.