D231: httppeer: add support for httppostargs when we're sending a file

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Tue Aug 8 10:41:29 EDT 2017


durin42 added inline comments.

INLINE COMMENTS

> martinvonz wrote in httppeer.py:96
> It doesn't matter much since it's just a programming error if it happens, but how will these arguments to ValueError be rendered?

ValueError: ('_multifile only supports file objects that have a length but this one does not:', <type 'file'>, <open file 'README', mode 'r' at 0x110ff0b70>)

It ain't pretty, but it's got all the information we need.

> martinvonz wrote in httppeer.py:111
> nit: i think this can be "if got <= amt" to avoid an unnecessary 0-length read the next time _multifile.read() (and it does look like that will be the normal case, that the reader will read exactly the size of the first "file" first)

No, because consider these file buffers:

'foo', 'bar'

if we read(2), we'll pull 2 bytes off the first buffer, which is not yet exhausted, but got == amt.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D231

To: durin42, #hg-reviewers
Cc: martinvonz, mercurial-devel


More information about the Mercurial-devel mailing list