Skip to content

Commit da80ca8

Browse files
authored
Merge pull request #21 from xray33/feature/proxy_packages_more_than_100mb_size
Feature/proxy packages more than 100mb size
2 parents 7e00cb0 + 9d17c61 commit da80ca8

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

contrib/pypi-server.conf.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ pool_size = 16
88
secret = 'change me please'
99
database = URL('sqlite:///tmp/test.db')
1010
user = 'nobody'
11+
max_body_size = 200 # in megabytes

pypi_server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
("Dmitry Orlov", "me@mosquito.su")
1010
]
1111

12-
version_info = (0, 4, 5)
12+
version_info = (0, 4, 6)
1313

1414
__version__ = ".".join(map(str, version_info))
1515
__author__ = ", ".join("{0} <{1}>".format(*author) for author in author_info)

pypi_server/server.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@
7676
help="Maximum HTTP Client instances for proxy requests (default 25) [ENV:MAX_CLIENTS]",
7777
default=int(os.getenv("MAX_CLIENTS", '25')), type=int)
7878

79+
define("max_body_size",
80+
help="Maximum HTTP Client body size for proxy requests (in megabytes, default 100) [ENV:MAX_BODY_SIZE]",
81+
default=int(os.getenv("MAX_BODY_SIZE", '100')), type=int)
82+
7983
define("pypi_server",
8084
help="PYPI service url. Using for proxy. (default https://pypi.python.org/) [ENV:PYPY_SERVER]",
8185
default=URL(os.getenv("PYPI_SERVER", 'https://pypi.python.org/')), type=URL)
@@ -161,7 +165,7 @@ def handle_pdb(sig, frame):
161165
log.info("Init thread pool with %d threads", options.pool_size)
162166
handlers.base.BaseHandler.THREAD_POOL = futures.ThreadPoolExecutor(options.pool_size)
163167

164-
AsyncHTTPClient.configure(None, max_clients=options.max_http_clients)
168+
AsyncHTTPClient.configure(None, max_clients=options.max_http_clients, max_body_size=options.max_body_size*1024*1024)
165169

166170
proxy_url = URL(os.getenv('{0}_proxy'.format(options.pypi_server.scheme)))
167171
if proxy_url:

0 commit comments

Comments
 (0)