如何啟用 HTTP2 Delphi 11?我一直在嘗試代碼,但沒有用
NetHTTPClient1.ProtocolVersion := 'HTTP_2_0';
uj5u.com熱心網友回復:
這應該有效:
implementation
uses
System.Net.HttpClient;
procedure DoSomeHTTPThings;
var
http: THTTPClient;
httpresponse: IHTTPResponse;
stringstream: TSTringStream;
begin
http := THTTPClient.Create;
stringstream := TStringStream.Create;
try
http.ProtocolVersion := THTTPProtocolVersion.HTTP_2_0;
httpresponse := http.Get('http://exampleurl.com', stringstream);
case httpresponse.Version of
THTTPProtocolVersion.UNKNOWN_HTTP: ;
THTTPProtocolVersion.HTTP_1_0: ;
THTTPProtocolVersion.HTTP_1_1: ;
THTTPProtocolVersion.HTTP_2_0: ;
end;
finally
stringstream.Free;
http.Free;
end;
end;
編輯:2021-09-23 12:23:在評論中將代碼更新為您的問題
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/315624.html
上一篇:Delphi-TPlannerMonthView設定專案顏色
下一篇:德爾福油漆盒變色后出現故障
