I am using Delphi 7 and Indy 9 to implement a trivial HTTP server. When I upload a file to the server using the POST method, I would like to know the content-length before the OnCommandGet event, in order to show a progress bar. The event sequence is the following:
- On the OnPostStream I create a file stream and hook the OnWork event. (here I need the content-length to set the progress bar)
- The POST body is uploaded and the OnWork fires with the transferred bytes.
- The OnCommandGet even fires and I get the TIdHTTPRequestInfo object wuth the correct content length, but at this point it is too late.
I modified the Indy sources to get a copy of the TIdHTTPRequestInfo in the ASender.Data field passed to the OnPostStream handler. Everything works, but I would like not to touch Indy.
Is there a cleaner solution? Thank you