Issue68

Title format of retrieved hashes should be adaptable
Priority feature Status resolved
Superseder Nosy List poeml, theuni
Assigned To poeml Keywords

Created on 2010-09-18.13:12:56 by poeml, last changed by poeml.

Files
File name Uploaded Type Edit Remove
mb-issue68.patch poeml, 2010-09-18.21:56:51 application/octet-stream
Messages
msg268 (view) Author: poeml Date: 2010-09-19.18:15:37
The filenames can now also be switched off site-wide:


# Set to On to suppress the filename included when hashes are sent.
# Normally, they come as "99eaed37390ba0571f8d285829ff63fc  foobar", 
# as in the format well-known from the md5sum/sha1sum tools.
# Default: Off
MirrorBrainHashesSuppressFilenames On


http://svn.mirrorbrain.org/viewvc/mirrorbrain?view=revision&revision=8150
msg261 (view) Author: poeml Date: 2010-09-18.22:27:00
Patch in trunk:

- Hashes can now be requested without filename in the returned response, by
  sending "only_hash" as query_string, i.e. 
     http://host.example.com/foo.md5?only_hash
     http://host.example.com/foo?md5&only_hash
  This hopefully fixes issue #68 :-)

http://svn.mirrorbrain.org/viewvc/mirrorbrain?view=revision&revision=8141

Okay?
msg260 (view) Author: poeml Date: 2010-09-18.22:22:13
For the sake of clarity, the following request is equivalent and works as well 
(dot instead of question mark):

 curl -s 'http://192.168.0.117/du.list.md5?only_hash'
99eaed37390ba0571f8d285829ff63fc
msg257 (view) Author: poeml Date: 2010-09-18.21:56:51
Proposed patch attached. (Really simple.)
msg256 (view) Author: poeml Date: 2010-09-18.21:56:04
I fear that affording a configurability at that level would mean quite a lot of work, both in terms of code and 
documentation. And it might get a little complex for the user.

I'd rather add just one switch, called e.g. MirrorBrainIncludeFilenameInHashes.

If there's one space or two is not really important I think, and it is better to stick to existing formats. I just 
decided to use only one space out of sheer stubbornness, because I didn't understand the need for two.

I am worried a little bit about the users though - if the filename is configurable, it won't be as clear to them 
what they get as it is now. It is easy to oversee for the site admin to tweak the behaviour. But for users it 
could be confusing why one MirrorBrain installation reacts different than another.

I committed a patch that changes the space into two spaces to trunk:
http://svn.mirrorbrain.org/viewvc/mirrorbrain?view=revision&revision=8140

Other than that, I wonder if another way of saying "give me only the hash" could be useful. 

How would you find the following behaviour?


 curl -s 'http://192.168.0.117/du.list?md5'                                                              
99eaed37390ba0571f8d285829ff63fc  du.list
 curl -s 'http://192.168.0.117/du.list?md5&only_hash'
99eaed37390ba0571f8d285829ff63fc
msg255 (view) Author: theuni Date: 2010-09-18.16:38:09
I assume this is a result of my request. The latter would be much appreciated as
it would allow us to fetch a file, then file.md5, and not have to do any string
manipulations to verify.

Alternatively (sadly I know nothing of apache's capabilities wrt config files),
it would be especially nice to be able to set the format there. For ex:

MirrorBrainHashFormat "%hash %filename" #default
MirrorBrainHashFormat "%hash  %filename" #md5sum syntax
MirrorBrainHashFormat "%hash" #hash only

This may be feature-creep, I'm not sure if anyone else would need such flexibility.
msg254 (view) Author: poeml Date: 2010-09-18.13:12:56
The format in which hashes are retrieved should be made configurable.

At the moment, the format is, with a single space in between: 
<hash> <filename>

For parsing reasons, it might be worthwhile to use two spaces, just as the 
commonly used "md5sum" and "sha1sum" tools do.

On the other hand, it could also be useful to enable retrieving just the hash, 
without a filename (which is redundant anyway). (When such a response is saved to 
disk, it might again be better to comply to the well-known format with filename 
included...)
History
Date User Action Args
2010-09-19 18:15:38poemlsetstatus: testing -> resolved
messages: + msg268
2010-09-18 22:27:00poemlsetstatus: in-progress -> testing
messages: + msg261
2010-09-18 22:22:13poemlsetmessages: + msg260
2010-09-18 21:57:36poemlsetstatus: chatting -> in-progress
2010-09-18 21:56:51poemlsetfiles: + mb-issue68.patch
messages: + msg257
2010-09-18 21:56:05poemlsetmessages: + msg256
2010-09-18 16:38:12theunisetstatus: unread -> chatting
messages: + msg255
2010-09-18 13:12:56poemlcreate