Jump to content
Sign in to follow this  
Frédéric

TDSRestConnection, bug in DoSetCredential

Recommended Posts

Hi,

 

Just want to share this and to eventually have confirmation (or not !!)

I suspect a bug in the DoSetCredential method used by TDSRestConnection (System.Net.HttpClient.Win, TWinHTTPClient.DoSetCredential)

 

I'm just upgrading an (working !) application from Delphi XE7 to Delphi 10.3.1.

It's an application using Datasnap REST to communicate with a standalone Datasnap server (or IIS ISAPI in production)

 

By doing my first tests I immediatly encountered the following problem:

 

By calling the TDSRestConnection.TestConnection I get this error: Error adding header (87): Incorrect parameter ==> ('Paramètre incorrect' translated from french)

Basic authentication is used.

After debugging the code I saw that TNetEncoding.Base64.Encode adds a linebreak after 76 chars (The base64 encoded credentials goes slightly over 80chars...). This seems the default behavior the TBase64Encoding class but the WinHttpAddRequestHeaders API don't like it.

I have changed the code in System.Net.HttpClient.Win to change the CharsPerLine to 255 and then it is OK.

 

Bug or misuse ?

 

Thanks !

 

Frederic

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×