Re: Help with 400 Bad Request

Ulrich Klauer <[email protected]> Sun, 15 Feb 2015 10:59:51 +0100
Newsgroups gmane.comp.audio.musicbrainz.devel
Message-ID <[email protected]>
Joe Martinez wrote:

> Ok, I just sent two more.  The first one was missing the "?client..." part
> of the URL, and I got an authorization error.  The second one had the
> "?client..." part in the URL, and I got the Bad Request again, with an
> empty body.

It seems the issue might be in the URI used for calculating the  
digest. The header was:

Authorization: Digest  
username="jmartine",realm="musicbrainz.org",nonce="9SeEag2TSsSWn5OpDa/C0Q==",uri="/ws/2/rating",algorithm="MD5",cnonce="a1f74260843b54d3b773c4bf84b7ae5c",nc=00000001,qop="auth",response="8086d2cbc3bb9b20425f9a66f5443e98",opaque="W01Tt4kCQ+qOe2Oo6O6vGg=="

At the same time, the actual request was for  
/ws/2/rating?client=StarMyGrooves-1.0, so that is what the uri part in  
Authorization should be.

With that, I found this SO question:  
http://stackoverflow.com/questions/3109507
It seems it is a bug in .NET; there is mention of a bug report to  
Microsoft Connect in the comments on the accepted answer, but I can't  
access it (requires some account). The original poster solved it by  
reimplementing digest auth themselves.

Ulrich