0

Are there any way to send an http request to know for example the md5 of a file?

I need it because I have a php script that downloads a remote file from http and then writes it locally.

I would like to check if it was transfered right.

Thanks

The Scrum Meister
  • 29,681
  • 8
  • 66
  • 64
  • 2
    There's a [`Content-MD5`](http://www.faqs.org/rfcs/rfc1864.html) header supposed to be in HTTP responses, but few webservers send it. For Apache it depends on the `ContentDigest On` directive. – mario Feb 15 '11 at 21:57

3 Answers3

1

HTTP (in reality TCP) has internal error checking, so everything you download ist correct. The only problem you can have is an incomplete download, so check for filesize.

Tobias P.
  • 4,537
  • 2
  • 29
  • 36
-1

Without checksum at original server, either external or inside file (like .exe), you can't. HTTP provides no such functionality.

Teson
  • 6,644
  • 8
  • 46
  • 69
-1

This isn't efficient, but you could download it twice and checksum each (with md5 or sha). If the two match, and the size matches the content-length header, it's probably correct.

jcomeau_ictx
  • 37,688
  • 6
  • 92
  • 107