Einzelnen Beitrag anzeigen

generic

Registriert seit: 24. Mär 2004
Ort: bei Hannover
2.416 Beiträge
 
Delphi XE5 Professional
 
#11

Re: Clac CRC before downloading

  Alt 19. Apr 2010, 17:45
Look here:
http://en.wikipedia.org/wiki/HTTP_ETag
the german one is better:
http://de.wikipedia.org/wiki/HTTP_ETag
and
http://solariz.de/2044/etag_webseite...chleunigen.htm

Depending on the Webserver you have a strong Etag or not.
Strong ETags using checksums.
Weak ETags you can detect on "W/" before the Etag-Code.
last link uses php code for MD5-Etaging

Delphi-Quellcode:
uses
  MSXML2_TLB;

var
  req : IXMLHTTPRequest;
  str_link: string;
begin
  req := CoXMLHTTP40.Create;
  str_link:='http://linktofile';
  req.Open('HEAD', str_link, False, EmptyParam, EmptyParam);
  req.send(EmptyParam);
  // check for req.status=200 -> if true no error
  MessageDlg(req.getAllResponseHeaders(), mtWarning, [mbOK], 0);
  MessageDlg(req.getResponseHeader('Etag'), mtWarning, [mbOK], 0);

  req:=nil;
end;

the headers may look like:
Code:
Date   Mon, 19 Apr 2010 15:45:57 GMT
Server   Apache
Pragma   public
Expires   Mon, 19 Apr 2010 16:34:07 GMT
Last-Modified   Mon, 19 Apr 2010 15:34:07 GMT
Cache-Control   max-age=2890, public, must-revalidate, proxy-revalidate Vary   Accept-Encoding,Cookie,User-Agent
Etag   7e828ab2622e112d6a6bd3b7083a560b
Content-Encoding   gzip
Content-Type   text/html; charset=UTF-8
Coding BOTT - Video Tutorials rund um das Programmieren - https://www.youtube.com/@codingbott
  Mit Zitat antworten Zitat