#1 2019-02-07 12:03:09

egold2005
Member
Registered: 2019-01-28
Posts: 16

How lengthy reads should be processed with THttpClientSocket

I am still trying to get any meaningful help on this wonderful resource....

How do i use THttpClientSocket when overring TSqlHttpServer.Request method to create a kind of proxy?

       FClient := THttpClientSocket.Open('localhost', '8095');

       result := FClient.Request(Ctxt.URL, Ctxt.Method, 10000, Ctxt.InHeaders, Ctxt.InContent, Ctxt.InContentType, TRUE);

       Ctxt.OutContent := FClient.Content;
       Ctxt.OutContentType := FClient.ContentType;

       Ctxt.OutCustomHeaders := '';
       for vIdx := Low(FClient.Headers) to High(FClient.Headers) do
          Ctxt.OutCustomHeaders := Ctxt.OutCustomHeaders + #13#10 + FClient.Headers[vIdx];


The end point services are RESTful services, i need to be able to handle GET/POST/DELETE etc

The code above works fine for small responses, but when it comes to lengthy datasets returns it seems the response data never gets through.

Should i somehow create a loop to add to Ctxt.OutContent or it should be handled in some other way?

Offline

#2 2019-02-08 07:30:34

pvn0
Member
From: Slovenia
Registered: 2018-02-12
Posts: 210

Re: How lengthy reads should be processed with THttpClientSocket

egold2005 wrote:

I am still trying to get any meaningful help on this wonderful resource....

Probably because you keep ignoring everyone telling you not to do this. This is a framework, but you decided not to use it like that, instead you want to do low level stuff but you don't understand it well. That's OK, that's why the framework will handle all the low level stuff for you, you just have to figure out what services you want to expose to the world and then implement it in the context of the framework by following the incredible documentation available to you.

Offline

Board footer

Powered by FluxBB