fix(line): respect proxy env vars in LINE adapter HTTP sessions#23357
Closed
AhmetArif0 wants to merge 1 commit into
Closed
fix(line): respect proxy env vars in LINE adapter HTTP sessions#23357AhmetArif0 wants to merge 1 commit into
AhmetArif0 wants to merge 1 commit into
Conversation
Contributor
Author
|
Reopening with correct author attribution. |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
All five
aiohttp.ClientSessioninstances in_LineClientignore proxyenvironment variables (
HTTP_PROXY,HTTPS_PROXY,ALL_PROXY). Usersrunning Hermes behind a corporate or transparent proxy see every LINE API
call fail —
reply,push,loading,fetch_content, andget_bot_user_idall bypass the system proxy.Root Cause
aiohttp.ClientSessiondefaults totrust_env=False. Without this flagthe session ignores proxy env vars and goes direct even when the host
network requires a proxy.
All five session constructions in
_LineClientomit the flag:```python
reply(), push(), loading(), fetch_content(), get_bot_user_id()
async with aiohttp.ClientSession(timeout=timeout) as session: # ← no trust_env
```
Fix
Add
trust_env=Trueto each of the fiveaiohttp.ClientSession()callsin
_LineClient. Symmetric with thewecom(wecom.py:276) andweixin(
weixin.py:1055,1268,1274) adapters, which already set this flag.```python
async with aiohttp.ClientSession(timeout=timeout, trust_env=True) as session:
```
No behavior change for users not running behind a proxy.