Jump to content
Sonjli

THttpClient vs TIdHttp in Linux

Recommended Posts

Hello,

I found an issue using the rtl THTTPClient.Post method in Linux.

If I use a windows client that makes the post to Linux server, all working like a charm.

If I use a linux client (paserver via docker container) the post works but the server doesn't understand tha call.

If I use TIdHTTP instead, all keep working like a charm.

Any idea about this?

Isn't the standard RTL completely cross platform?

Share this post


Link to post
Posted (edited)
18 minutes ago, Sonjli said:

If I use a linux client (paserver via docker container) the post works but the server doesn't understand tha call.

Can you be more specific? 

Quote

Isn't the standard RTL completely cross platform?

Yes. What does that have to do with the issue? 

Edited by Remy Lebeau

Share this post


Link to post
7 hours ago, Remy Lebeau said:

Can you be more specific

I am using keycloak for oauth2. The POST to retrieve the jwt token works perfectly with indy in linux container. Keycloak gives me a "java.lang.StringIndexOutOfBoundsException" when I use THttpClient.

If I compile under Windows and do the POST from windows to keycloak both works.

7 hours ago, Remy Lebeau said:

Yes. What does that have to do with the issue?

If I compile my app for Linux: Indy works, THttpClient doesn't work

If I compile my app for Windows: Indy works, THttpClient works

Share this post


Link to post
2 minutes ago, Sonjli said:

I am using keycloak for oauth2. The POST to retrieve the jwt token works perfectly with indy in linux container. Keycloak gives me a "java.lang.StringIndexOutOfBoundsException" when I use THttpClient.

Did you try capturing and comparing the raw HTTP requests that THTTPClient and TIdHTTP are generating to see what is different between them?

Share this post


Link to post
On 8/8/2024 at 5:58 PM, Remy Lebeau said:

Did you try capturing and comparing the raw HTTP requests that THTTPClient and TIdHTTP are generating to see what is different between them?

Non for now. Can you recommend me a simple sniffer? (wireshark is too much for me...)

Or is there any other way to capture the raw request?

Share this post


Link to post
1 hour ago, Sonjli said:

Non for now. Can you recommend me a simple sniffer? (wireshark is too much for me...)

Or is there any other way to capture the raw request?

Capturing the traffic is easy with TIdHTTP. You can simply assign any of Indy's TIdLog... components to the TIdHTTP.Intercept property, such as TIdLogFile.

 

I don't know if THTTPClient has any similar feature to capture its traffic without using an external sniffer. If Wireshark is too much for you, maybe Fiddler or similar logging proxy with work for you? 

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

×