AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi Get resource info with HTTP
Thema durchsuchen
Ansicht
Themen-Optionen

Get resource info with HTTP

Ein Thema von WojTec · begonnen am 17. Dez 2013
Antwort Antwort
WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#1

Get resource info with HTTP

  Alt 17. Dez 2013, 19:31
I need to know remote file length and time, so I wrote with WinInet:

Delphi-Quellcode:
var
  hInet, hURL: HINTERNET;
  BufferLength: Cardinal;
  Reserved: Cardinal;
begin
  Result := 0;
  Reserved := 0;

  hInet := InternetOpen(PChar(AUserAgent), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
  if hInet <> nil then
  try
    hURL := InternetOpenUrl(hInet, PChar(AURL), nil, 0, 0, 0);
    if hURL <> nil then
    try
      BufferLength := SizeOf(Result);
      HttpQueryInfo(hURL, HTTP_QUERY_CONTENT_LENGTH or HTTP_QUERY_FLAG_NUMBER, @Result, BufferLength, Reserved);
    finally
      InternetCloseHandle(hURL);
    end;
  finally
    InternetCloseHandle(hInet)
  end;
end;
and in another function:

HTTP_QUERY_LAST_MODIFIED or HTTP_QUERY_FLAG_SYSTEMTIME I also did it with Indy:

TIdHTTP.Head(); API version (one function call in the same time, not both) is noticeably slower than VCL.

1. How to do it faster in API?
2. Is possible get more data by one HttpQueryInfo() or have to use one call for one HTTP response field?
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:42 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz