httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Kraemer <Martin.Krae...@Mch.SNI.De>
Subject Re: APR MD5 routines and EBCDIC (or generic translation)
Date Tue, 02 May 2000 14:08:04 GMT
On Mon, May 01, 2000 at 10:25:01PM -0400, Jeff Trawick wrote:
> 
> Why not avoid the double translation and instead store a translation
> flag with the MD5 context if translation is to be performed and have
> ap_MD5Update() et al only translate if the flag is set?

Good point. I guess that initially MD5 was used only for MD5 Content-Digest
on HTML files. And when someone realized that it broke on x-ascii-html
files, I did not fix it cleanly.

Yes. Your proposal is the best answer. The conversion flag should be
part of the context, and should be initialized in ap_MD5Init() or set
in a new function ap_MD5InitConv() or some such.

> Are there some subleties I'm missing that led to the current
> translation code in ap_MD5Update() and ap_md5digest()?

Not AFAIR.

> (I start to wonder why ap_MD5Update() should have translation logic at
> all, but without it there would probably be more code and extra data
> copies here and there.)

It needs conversion for EBCDIC documents because the MD5 hash must
give the same results as on the client side (and the client sees the
ASCII document).

> Does anybody remember or otherwise have an opinion on this?

Put it into the AP_MD5_CTX type. Initializing the conversion flag
to 0 in ap_MD5Init() and setting it as appropriate in a separate
function (macro!) ap_MD5InitConv() call has the advantage that you
don't have two signatures (with/without conv. flag) for one function.
Cscope / ctags easily gets confused...
e.g.,
#define ap_MD5InitConv(context,value) context->convert=value

Thanks for pointing this out,

    Martin
-- 
  <Martin.Kraemer@MchP.Siemens.De>      |       Fujitsu Siemens
       <martin@apache.org>              |   81730  Munich,  Germany
((See you at ApacheCon 2000 in Orlanda, Florida, March 8-10, 2000!))
		   <URL:http://ApacheCon.Com/>

Mime
View raw message