comparison mercurial/debugcommands.py @ 37045:a708e1e4d7a8

url: support suppressing Accept header Sending this header automatically could interfere with future testing and client behavior. Let's add a knob to disable the behavior. We don't have a control for User-Agent because urllib will send it if we don't set something. I don't feel like hacking into the bowels of urllib to figure out how to suppress that. UA shouldn't be used for anything meaningful. So it shouldn't pose any problems beyond non-determinism (since the header has the Mercurial version in it). Differential Revision: https://phab.mercurial-scm.org/D2843
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 13 Mar 2018 10:34:36 -0700
parents d3a9036d9ae9
children fddcb51b5084
comparison
equal deleted inserted replaced
37044:d3a9036d9ae9 37045:a708e1e4d7a8
2844 } 2844 }
2845 2845
2846 if ui.debugflag: 2846 if ui.debugflag:
2847 openerargs[r'loggingopts'][r'logdataapis'] = True 2847 openerargs[r'loggingopts'][r'logdataapis'] = True
2848 2848
2849 # Don't send default headers when in raw mode. This allows us to
2850 # bypass most of the behavior of our URL handling code so we can
2851 # have near complete control over what's sent on the wire.
2852 if opts['peer'] == 'raw':
2853 openerargs[r'sendaccept'] = False
2854
2849 opener = urlmod.opener(ui, authinfo, **openerargs) 2855 opener = urlmod.opener(ui, authinfo, **openerargs)
2850 2856
2851 if opts['peer'] == 'raw': 2857 if opts['peer'] == 'raw':
2852 ui.write(_('using raw connection to peer\n')) 2858 ui.write(_('using raw connection to peer\n'))
2853 peer = None 2859 peer = None