-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[enh] py: drop deps #5407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[enh] py: drop deps #5407
Conversation
| pyyaml==6.0.3 | ||
| httpx[http2]==0.28.1 | ||
| httpx-socks[asyncio]==0.10.0 | ||
| Brotli==1.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far I remember this Brotli requirement was added in first place to the httpx stack, to process incoming HTTP responses:
However, I don't know if there is any engine that absolutely requires Brotli. Usually, (http incomming) compression can be controlled via the Accept-Encoding header.
The default is:
Line 1043 in 0245327
| 'Accept-Encoding': 'gzip, deflate', |
If we remove Brotli here (what is OK for me), we should also have a look at the Accept-Encoding header in our outgoing requests and remove the br
searxng/searx/engines/tineye.py
Line 76 in 0245327
| 'Accept-Encoding': 'gzip, defalte, br', |
Other places can be found by the following search query:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's not a single site that doesn't support uncompressed responses, so sites not serving br content they will fall back on something else or uncompressed, but I don't understand why Accept-Encoding header is overridden on some engines. httpx will set the supported encodings automatically, as every HTTP client does.
This looks like a valid exception:
searxng/searx/engines/brave.py
Lines 201 to 202 in 0245327
| # Don't accept br encoding / see https://github.com/searxng/searxng/pull/1787 | |
| params['headers']['Accept-Encoding'] = 'gzip, deflate' |
...The other matches are not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why Accept-Encoding header is overridden on some engines.
..
httpx will set the supported encodings automatically, as every HTTP client does.
I guess it was my fail .. when reverse engineering these engines, I simply copied the header from my browser without considering that SearXNG (or httpx) already sets a default value for it.
the supported encodings automatically, as every HTTP client does.
Can you please also correct the unnecessary and partially incorrect overwriting of the headers in this branch? Thanks 👍
update: you already cleaned up the header while I had written the lines above :-)
The difference between decompression with brotli or gzip in HTML files is negligible for 3 MB of compiled binary package. Introduced in searxng@eaa694f Closes https://github.com/searxng/searxng/security/code-scanning/276 Closes https://github.com/searxng/searxng/security/dependabot/37
return42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, totally forgot this PR .. thanks for cleaning the HTTP header.
The difference between decompression with brotli or gzip in HTML files is negligible for 3 MB of compiled binary package.
unixthreadnamelooks like a weird workaround to me, this wasn't handled on uWSGI/Granian side?Introduced in eaa694f
Closes https://github.com/searxng/searxng/security/code-scanning/276
Closes https://github.com/searxng/searxng/security/dependabot/37