diff --git a/README.md b/README.md index 7064714..d212f66 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,10 @@ docker run -d --name="gh-proxy-py" \ ### 注意 python版本的机器如果无法正常访问github.io会启动报错,请自行修改静态文件url -默认配置下clone走github.com.cnpmjs.org,项目文件会走jsDeliver,如需走服务器,修改配置即可 + +workers版本默认配置下clone走github.com.cnpmjs.org,项目文件会走jsDeliver,如需走服务器,修改配置即可 + +python版本默认走服务器(2021.3.27更新) ## Cloudflare Workers计费 diff --git a/app/main.py b/app/main.py index 5ec99ec..d93e35a 100644 --- a/app/main.py +++ b/app/main.py @@ -12,9 +12,9 @@ from urllib3.exceptions import ( DecodeError, ReadTimeoutError, ProtocolError) # config -# git使用cnpmjs镜像、分支文件使用jsDelivr镜像的开关,0为关闭,默认开启 -jsdelivr = 1 -cnpmjs = 1 +# git使用cnpmjs镜像、分支文件使用jsDelivr镜像的开关,0为关闭,默认关闭 +jsdelivr = 0 +cnpmjs = 0 size_limit = 1024 * 1024 * 1024 * 999 # 允许的文件大小,默认999GB,相当于无限制了 https://github.com/hunshcn/gh-proxy/issues/8 HOST = '127.0.0.1' # 监听地址,建议监听本地然后由web服务器反代 PORT = 80 # 监听端口 @@ -115,11 +115,7 @@ def proxy(u): if url.startswith('https:/') and not url.startswith('https://'): url = 'https://' + url[7:] r = requests.request(method=request.method, url=url, data=request.data, headers=r_headers, stream=True) - for i in ['Content-Range', 'Content-Type']: - if i in r.headers: - headers[i] = r.headers.get(i) - if r.status_code == 200: - headers = dict(r.headers) + headers = dict(r.headers) try: headers.pop('Transfer-Encoding') except KeyError: