diff -r d3a9036d9ae9 -r a708e1e4d7a8 mercurial/debugcommands.py --- a/mercurial/debugcommands.py Tue Mar 13 11:20:07 2018 -0700 +++ b/mercurial/debugcommands.py Tue Mar 13 10:34:36 2018 -0700 @@ -2846,6 +2846,12 @@ if ui.debugflag: openerargs[r'loggingopts'][r'logdataapis'] = True + # Don't send default headers when in raw mode. This allows us to + # bypass most of the behavior of our URL handling code so we can + # have near complete control over what's sent on the wire. + if opts['peer'] == 'raw': + openerargs[r'sendaccept'] = False + opener = urlmod.opener(ui, authinfo, **openerargs) if opts['peer'] == 'raw':