# HG changeset patch # User John Mulligan # Date 1487016737 18000 # Node ID 1beeb51859305f6212b3ef091447a3bfa9c57a7d # Parent 1f151a33af8e5f8e4df02bdd1c1210ad2d25e4f1 keepalive: honor urllib2 style get_method overrides In urllib2 docs and discussions it can be found that in order to make a request other than GET or POST the get_method of a Request object can be overriden. Make Mercurial's internal version of this honor the return value of get_method. Please see the followup patch to the bugzilla extension for the reason for this change. Marking RFC because I'm not entirely sure this is the right way make the HTTP requests. diff -r 1f151a33af8e -r 1beeb5185930 mercurial/keepalive.py --- a/mercurial/keepalive.py Fri Feb 10 13:56:31 2017 -0800 +++ b/mercurial/keepalive.py Mon Feb 13 15:12:17 2017 -0500 @@ -310,14 +310,16 @@ try: if req.has_data(): data = req.get_data() - h.putrequest('POST', req.get_selector(), **skipheaders) + h.putrequest( + req.get_method(), req.get_selector(), **skipheaders) if 'content-type' not in headers: h.putheader('Content-type', 'application/x-www-form-urlencoded') if 'content-length' not in headers: h.putheader('Content-length', '%d' % len(data)) else: - h.putrequest('GET', req.get_selector(), **skipheaders) + h.putrequest( + req.get_method(), req.get_selector(), **skipheaders) except socket.error as err: raise urlerr.urlerror(err) for k, v in headers.items():