make md5 checksums actually work instead of simply calculating the length

of an empty buffer...  the output file wasn't readable...  also warn that
we can't checksum on stdout and print out the base64 encoded version of the
md5 checksum...

Site to actually return md5 digest: web.golux.com
Verified that fetch was broken: Ken Coar <Ken.Coar@Golux.Com>
This commit is contained in:
John-Mark Gurney 1999-05-18 19:37:37 +00:00
parent c558c5795a
commit 85020e14f0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=47303

View file

@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: http.c,v 1.25 1999/02/03 20:24:53 fenner Exp $
* $Id: http.c,v 1.26 1999/02/23 18:51:13 wollman Exp $
*/
#include <sys/types.h>
@ -1006,7 +1006,7 @@ http_retrieve(struct fetch_state *fs)
if (to_stdout)
local = fopen("/dev/stdout", restarting ? "a" : "w");
else
local = fopen(fs->fs_outputfile, restarting ? "a" : "w");
local = fopen(fs->fs_outputfile, restarting ? "a+" : "w+");
if (local == 0) {
warn("%s: fopen", fs->fs_outputfile);
fclose(remote);
@ -1048,7 +1048,11 @@ http_retrieve(struct fetch_state *fs)
*/
fseek(local, restart_from, SEEK_SET);
fs->fs_status = "computing MD5 message digest";
status = check_md5(local, base64ofmd5);
if (!to_stdout)
status = check_md5(local, base64ofmd5);
else
warnx("can't check md5 digest on stdout: %s",
base64ofmd5);
free(base64ofmd5);
}