Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stop the IdHTTP.Post stream upload without closing the connection

Let's see if I can phrase my question well enough.
I use TIdHttp.Post (and Patch) requests to upload a source stream, like

fHTTP.Patch(URL, InputStream);

Is there some way to interrupt the uploading of the stream, as if the data has ended, but without raising exceptions and closing the connections?

I am migrating some Java code that deals with a tus server. And one of the methods seems to do exactly the above. It make a patch request, uploads a stream, but it also has the option to stop the upload. When it is stopped, the client stops uploading the stream, but afterwards still reads the response from the server over the same connection. That response contains information about the data uploaded.

Looking at the code I could not find a clever solution. The uploading of the stream is called by TIdCustomHTTP.ConnectToHost and handled inside TIdIOHandler.Write and WriteDirect. But I didn't see how it can be interrupted midway without raising an exception, which then closes the connection.

Using Delphi 10.1 with Indy that comes with it.


Messages In This Thread
Stop the IdHTTP.Post stream upload without closing the connection - by vladimir - 01-24-2019, 07:16 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)