{"issue":{"state":"open","created_at":"2011-12-05T16:25:41Z","updated_at":"2011-12-06T05:35:34Z","user":{"gravatar_id":"2e9917e2d900a1ab680af6ac8bd4ded1","id":733442,"url":"https://api.github.com/users/ibrechin","login":"ibrechin","avatar_url":"https://secure.gravatar.com/avatar/2e9917e2d900a1ab680af6ac8bd4ded1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"comments":1,"body":"This is due to a couple of issues involved with the fact that it is necessary to create two requests and the file already having been read and a boundary set in the content-type header by the first request, resulting in the second (authenticated) request lacking file data and having an incorrect boundary even if you reset the file input stream.\r\n\r\nHowever, more than that it seems like a waste of bytes to send POST data up with the initial request which you know will come back as 401. As a quick fix in my own project I have added an if statement around lines 360-388 in models.py with the conditional \r\n\r\n    if (not isinstance(self.auth, HTTPDigestAuth)) or 'Authorization' in self.headers:\r\n\r\nbut I expect there is a more elegant way. If there already exists a way to do an empty first request when using HTTP Digest then I was unable to find it.","assignee":null,"number":298,"id":2451226,"labels":[],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"title":"File upload not working with HTTP digest authentication","html_url":"https://github.com/kennethreitz/requests/issues/298","closed_at":null,"url":"https://api.github.com/repos/kennethreitz/requests/issues/298","milestone":null},"action":"created","comment":{"created_at":"2011-12-06T05:35:34Z","updated_at":"2011-12-06T05:35:34Z","user":{"gravatar_id":"2eccc4005572c1e2b12a9c00580bc86f","id":119893,"url":"https://api.github.com/users/kennethreitz","login":"kennethreitz","avatar_url":"https://secure.gravatar.com/avatar/2eccc4005572c1e2b12a9c00580bc86f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"Thanks for the report. I'm really unhappy with the post-hook thing that's being used in the Digest Auth handler. It feels really messy.\r\n\r\nI'd love to take a more elegant approach, but nothing seems immediately obvious.","id":3028456,"url":"https://api.github.com/repos/kennethreitz/requests/issues/comments/3028456"}}