Reputation: 187
I am trying to get all the raw request headers from Asynchronous Pluggable Protocol I've implemented. But I can only get a few basic headers using IHttpNegotiate
. Such as Accept-Language
, Referer
. With a tool called HTTP Analyzer
these things can be viewed in more detail.
function RetrieveRequestHeaders(const szUrl: PWideChar; const OIProtSink: IInternetProtocolSink): String;
var
pHttpNeg: IHttpNegotiate;
Headers: PWideChar;
HR: HResult;
begin
Result := '';
HR := IUnknown_QueryService(OIProtSink, IID_IHttpNegotiate, IID_IHttpNegotiate, pHttpNeg);
if Succeeded(HR) then
begin
Headers := nil;
HR := pHttpNeg.BeginningTransaction(szUrl, nil, 0, Headers);
if Succeeded(HR) then
begin
Result := Headers;
CoTaskMemFree(Headers);
end;
end;
end;
Upvotes: 0
Views: 1095
Reputation: 36840
IHTTPNegotiate.BeginningTransaction
will give you the (additional) headers the browser wants to add to the outgoing request. As the protocol handler you're responsible to create the full outgoing HTTP request header, like you can see with a HTTP analyzer tool.
Upvotes: 1