This commit is contained in:
yumoqing 2022-04-12 11:09:35 +08:00
parent 8f903cc2cd
commit 9548d7ae33

View File

@ -1,4 +1,5 @@
from aiohttp import web import aiohttp
from aiohttp import web, BasicAuth
from aiohttp import client from aiohttp import client
from .baseProcessor import * from .baseProcessor import *
@ -23,9 +24,13 @@ class ProxyProcessor(BaseProcessor):
chunk_size = 40960 chunk_size = 40960
d = await self.path_call(request) d = await self.path_call(request)
reqH = request.headers.copy() reqH = request.headers.copy()
auth = None
if d.get('user') and d.get('password'):
auth = BasicAuth(d['user'], d['password'])
async with client.request( async with client.request(
request.method, request.method,
d['url'], d['url'],
auth=auth,
headers = reqH, headers = reqH,
allow_redirects=False, allow_redirects=False,
data=await request.read()) as res: data=await request.read()) as res: