cmogstored dev/user discussion/issues/patches/etc
 help / color / mirror / code / Atom feed
* Re: help w/ md5sum PUT
       [not found] <CABJfL5iOmEtE-S1teCzAsish-Z9Rz9rMYu_6nvuXtXqYX3PSfA@mail.gmail.com>
@ 2015-02-04  0:07 ` David Birdsong
  2015-02-04  0:20   ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: David Birdsong @ 2015-02-04  0:07 UTC (permalink / raw)
  To: mogile, cmogstored-public

[resending to the correct cmogstored list]

On Tue, Feb 3, 2015 at 3:59 PM, David Birdsong <david.birdsong@gmail.com>
wrote:

> Hi Eric, I'm troubleshooting my client that's PUTing to cmogstored and
> getting 400 response codes.
>
> If I supply a header:
> Content-MD5: MJH_pL-pTjsfQV4PiYDLFA==
>
> cmogstored returns a 400.
>
> If I don't set it, I get a 201 and find the fid on disk and see that its
> md5 sum (hex encoded) is: 3091ffa4bfa94e3b1f415e0f8980cb14
>
>
> python -c "print 'MJH_pL-pTjsfQV4PiYDLFA=='.decode('base64').encode('hex')"
>
> 3091e92e94e3b1f415e0f8980cb140
>
> Got any tips as to how to get cmogstored to allow this MD5?
>
> I built cmogstored built at version 1.4.1
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: help w/ md5sum PUT
  2015-02-04  0:07 ` help w/ md5sum PUT David Birdsong
@ 2015-02-04  0:20   ` Eric Wong
  2015-02-04  0:24     ` David Birdsong
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2015-02-04  0:20 UTC (permalink / raw)
  To: mogile; +Cc: cmogstored-public, David Birdsong

David Birdsong <david.birdsong@gmail.com> wrote:
> On Tue, Feb 3, 2015 at 3:59 PM, David Birdsong <david.birdsong@gmail.com>
> wrote:
> 
> > Hi Eric, I'm troubleshooting my client that's PUTing to cmogstored and
> > getting 400 response codes.
> >
> > If I supply a header:
> > Content-MD5: MJH_pL-pTjsfQV4PiYDLFA==

How are you generating that base64?

I could be wrong, but it the '_' (underscore) is not a part of the
normal set of characters used by base64.  Perhaps you're using a base64
variant? (there's one URL-friendly variant, at least)

It doesn't look like the gnulib base64 module (which cmogstored uses)
handles underscore... (warning: I'm sleep deprived and haven't touched
a computer in a few days, so maybe I'm missing something, too)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: help w/ md5sum PUT
  2015-02-04  0:20   ` Eric Wong
@ 2015-02-04  0:24     ` David Birdsong
  2015-02-04  0:28       ` David Birdsong
  0 siblings, 1 reply; 4+ messages in thread
From: David Birdsong @ 2015-02-04  0:24 UTC (permalink / raw)
  To: Eric Wong; +Cc: mogile, cmogstored-public

On Tue, Feb 3, 2015 at 4:20 PM, Eric Wong <e@80x24.org> wrote:

> David Birdsong <david.birdsong@gmail.com> wrote:
> > On Tue, Feb 3, 2015 at 3:59 PM, David Birdsong <david.birdsong@gmail.com
> >
> > wrote:
> >
> > > Hi Eric, I'm troubleshooting my client that's PUTing to cmogstored and
> > > getting 400 response codes.
> > >
> > > If I supply a header:
> > > Content-MD5: MJH_pL-pTjsfQV4PiYDLFA==
>
> How are you generating that base64?
>
> I could be wrong, but it the '_' (underscore) is not a part of the
> normal set of characters used by base64.  Perhaps you're using a base64
> variant? (there's one URL-friendly variant, at least)
>
> It doesn't look like the gnulib base64 module (which cmogstored uses)
> handles underscore... (warning: I'm sleep deprived and haven't touched
> a computer in a few days, so maybe I'm missing something, too)
>

It's from Golang's base64 package:
return base64.URLEncoding.EncodeToString(m.checksum.Sum(nil))

...but yeah, here's python's re-encoding:
>>> base64.urlsafe_b64encode(
base64.decodestring('MJH_pL-pTjsfQV4PiYDLFA=='))

'MJHpLpTjsfQV4PiYDLFA'


I'll try playing around with other Go encoding methods.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: help w/ md5sum PUT
  2015-02-04  0:24     ` David Birdsong
@ 2015-02-04  0:28       ` David Birdsong
  0 siblings, 0 replies; 4+ messages in thread
From: David Birdsong @ 2015-02-04  0:28 UTC (permalink / raw)
  To: Eric Wong; +Cc: mogile, cmogstored-public

On Tue, Feb 3, 2015 at 4:24 PM, David Birdsong <david.birdsong@gmail.com>
wrote:

>
>
> On Tue, Feb 3, 2015 at 4:20 PM, Eric Wong <e@80x24.org> wrote:
>
>> David Birdsong <david.birdsong@gmail.com> wrote:
>> > On Tue, Feb 3, 2015 at 3:59 PM, David Birdsong <
>> david.birdsong@gmail.com>
>> > wrote:
>> >
>> > > Hi Eric, I'm troubleshooting my client that's PUTing to cmogstored and
>> > > getting 400 response codes.
>> > >
>> > > If I supply a header:
>> > > Content-MD5: MJH_pL-pTjsfQV4PiYDLFA==
>>
>> How are you generating that base64?
>>
>> I could be wrong, but it the '_' (underscore) is not a part of the
>> normal set of characters used by base64.  Perhaps you're using a base64
>> variant? (there's one URL-friendly variant, at least)
>>
>> It doesn't look like the gnulib base64 module (which cmogstored uses)
>> handles underscore... (warning: I'm sleep deprived and haven't touched
>> a computer in a few days, so maybe I'm missing something, too)
>>
>
> It's from Golang's base64 package:
> return base64.URLEncoding.EncodeToString(m.checksum.Sum(nil))
>
> ...but yeah, here's python's re-encoding:
> >>> base64.urlsafe_b64encode(
> base64.decodestring('MJH_pL-pTjsfQV4PiYDLFA=='))
>
> 'MJHpLpTjsfQV4PiYDLFA'
>
>
> I'll try playing around with other Go encoding methods.
>

Ok, I swapped in base64.StdEncoding and it worked.
http://golang.org/pkg/encoding/base64/#pkg-index

I expected the base64.URLEncoding to be the way to go.

Case closed.

Thanks!


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-04  0:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CABJfL5iOmEtE-S1teCzAsish-Z9Rz9rMYu_6nvuXtXqYX3PSfA@mail.gmail.com>
2015-02-04  0:07 ` help w/ md5sum PUT David Birdsong
2015-02-04  0:20   ` Eric Wong
2015-02-04  0:24     ` David Birdsong
2015-02-04  0:28       ` David Birdsong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/cmogstored.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).