I posted this question DwinsHs for Inno Setup: How to add an apikey HTTP header of a request?
And now I want to edit the HTTP_HEADER
during the install. The HTTP_HEADER
is a const
. I changed it to a var
to be able to edit it. But when I do this, during the download I have an error "failed to send request to the HTTP server"
In my setup, the user should insert credentials (user, password) in a previous wizard page, and after that the setup get the APIKEY of the user session from the remote server from where it will download the files that the user asked for.
The HTTP_HEADER
const
is used by HttpSendRequest(hRequest, HTTP_HEADER, Length(HTTP_HEADER), '', 0);
in the dwinshs.iss
:
function HttpSendRequest(hRequest: HINTERNET; lpszHeaders: PAnsiChar; dwHeadersLength: DWORD; lpOptional: PAnsiChar;
dwOptionalLength: DWORD): BOOL;
external 'HttpSendRequestA@wininet.dll stdcall delayload setuponly';
I changed the type of HTTP_HEADER
to PAnsiChar
but I have the same error.
Can you tell me how to resolve my problem, please? Thanks.
Change HTTP_HEADER
declaration in dwinshs.iss
to:
var HTTP_HEADER: string;
And then modify the value as you need in your code, prior to the file download:
HTTP_HEADER := 'Header: value';