D887: httppeer: use native strings for headers

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Mon Oct 2 11:52:07 EDT 2017


yuja requested changes to this revision.
yuja added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> httppeer.py:233
>                  encargs = urlreq.urlencode(sorted(args.items()))
> -                for header, value in encodevalueinheaders(encargs, 'X-HgArg',
> +                for header, value in encodevalueinheaders(encargs, r'X-HgArg',
>                                                            headersize):

Appears that encodevalueinheaders() takes bytes.

I don't know which would be better to pass unicodes around or convert them
at one place.

> httppeer.py:240
> +        qs = '?%s' % urlreq.urlencode([
> +            (pycompat.strurl(qq[0]), pycompat.strurl(qq[1])) for qq in q])
> +        cu = r"%s%s" % (pycompat.strurl(self._url), qs)

Perhaps this should be handled in urlencode() because it converts the output
from str to bytes.

REPOSITORY
  rHG Mercurial

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

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


More information about the Mercurial-devel mailing list