##// 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 (push/clone etc.). It's implemented with basic auth function
22 (push/clone etc.). It's implemented with basic auth function
23 """
23 """
24
24
25 import copy
25 import logging
26 import logging
26 import urllib.parse
27 import urllib.parse
27 import urllib.request
28 import urllib.request
@@ -32,6 +33,7 b' from rhodecode.lib import utils'
32 from rhodecode.lib.ext_json import json
33 from rhodecode.lib.ext_json import json
33 from rhodecode.lib.middleware import simplevcs
34 from rhodecode.lib.middleware import simplevcs
34 from rhodecode.lib.middleware.utils import get_path_info
35 from rhodecode.lib.middleware.utils import get_path_info
36 from rhodecode.lib.str_utils import safe_str
35
37
36 log = logging.getLogger(__name__)
38 log = logging.getLogger(__name__)
37
39
@@ -95,7 +97,7 b' class SimpleHg(simplevcs.SimpleVCS):'
95 i = 1
97 i = 1
96 chunks = [] # gather chunks stored in multiple 'hgarg_N'
98 chunks = [] # gather chunks stored in multiple 'hgarg_N'
97 while True:
99 while True:
98 head = environ.get('HTTP_X_HGARG_{}'.format(i))
100 head = environ.get(f'HTTP_X_HGARG_{i}')
99 if not head:
101 if not head:
100 break
102 break
101 i += 1
103 i += 1
@@ -118,8 +120,18 b' class SimpleHg(simplevcs.SimpleVCS):'
118 """
120 """
119 default = 'push'
121 default = 'push'
120 batch_cmds = []
122 batch_cmds = []
123
121 try:
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 cmds = cls._get_xarg_headers(environ)
133 cmds = cls._get_xarg_headers(environ)
134
123 for pair in cmds:
135 for pair in cmds:
124 parts = pair.split(' ', 1)
136 parts = pair.split(' ', 1)
125 if len(parts) != 2:
137 if len(parts) != 2:
General Comments 0
You need to be logged in to leave comments. Login now