这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@inetol
Copy link
Member

@inetol inetol commented Nov 1, 2025

The difference between decompression with brotli or gzip in HTML files is negligible for 3 MB of compiled binary package.

unixthreadname looks 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

pyyaml==6.0.3
httpx[http2]==0.28.1
httpx-socks[asyncio]==0.10.0
Brotli==1.1.0
Copy link
Member

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:

'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

'Accept-Encoding': 'gzip, defalte, br',

Other places can be found by the following search query:

Copy link
Member Author

@inetol inetol Nov 2, 2025

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:

# Don't accept br encoding / see https://github.com/searxng/searxng/pull/1787
params['headers']['Accept-Encoding'] = 'gzip, deflate'

...The other matches are not.

Copy link
Member

@return42 return42 Nov 2, 2025

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
Copy link
Member

@return42 return42 left a 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.

@return42 return42 merged commit 7af922c into searxng:master Nov 6, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants