##// END OF EJS Templates
fix(mercurial): fixed httppostargs logic
super-admin -
r5606:faa7b2f4 default
parent child Browse files
Show More
@@ -22,6 +22,7 b' SimpleHG middleware for handling mercuri'
22 22 (push/clone etc.). It's implemented with basic auth function
23 23 """
24 24
25 import copy
25 26 import logging
26 27 import urllib.parse
27 28 import urllib.request
@@ -32,6 +33,7 b' from rhodecode.lib import utils'
32 33 from rhodecode.lib.ext_json import json
33 34 from rhodecode.lib.middleware import simplevcs
34 35 from rhodecode.lib.middleware.utils import get_path_info
36 from rhodecode.lib.str_utils import safe_str
35 37
36 38 log = logging.getLogger(__name__)
37 39
@@ -95,7 +97,7 b' class SimpleHg(simplevcs.SimpleVCS):'
95 97 i = 1
96 98 chunks = [] # gather chunks stored in multiple 'hgarg_N'
97 99 while True:
98 head = environ.get('HTTP_X_HGARG_{}'.format(i))
100 head = environ.get(f'HTTP_X_HGARG_{i}')
99 101 if not head:
100 102 break
101 103 i += 1
@@ -118,8 +120,18 b' class SimpleHg(simplevcs.SimpleVCS):'
118 120 """
119 121 default = 'push'
120 122 batch_cmds = []
123
121 124 try:
125 httppostargs_enabled = True
126 post_args_size = environ.get('HTTP_X_HGARGS_POST')
127 if post_args_size and httppostargs_enabled:
128 # a new proto when httppostargs is enabled
129 response_data = copy.copy(environ['wsgi.input'])
130 cmds = [safe_str(response_data.read(post_args_size))]
131 else:
132 # old way... from headers
122 133 cmds = cls._get_xarg_headers(environ)
134
123 135 for pair in cmds:
124 136 parts = pair.split(' ', 1)
125 137 if len(parts) != 2:
General Comments 0
You need to be logged in to leave comments. Login now