Skip to content

Authentitifcation digest TCP/TLS session reuse#3582

Closed
simon0356 wants to merge 1 commit intowarmcat:mainfrom
simon0356:TCPReuseHTTPAuthDigest
Closed

Authentitifcation digest TCP/TLS session reuse#3582
simon0356 wants to merge 1 commit intowarmcat:mainfrom
simon0356:TCPReuseHTTPAuthDigest

Conversation

@simon0356
Copy link
Copy Markdown
Contributor

Hello Andy,

As i use HTTP Auth digest along with websockets i want to fix the behaviour using mbedtls that close the TCP socket and TLS session when the digest authentification challenge is received on the client.

I describe my issue and "Claude Sonnet 4.6" has offering the patch here.

I have tested on a linux platform + mbedtls and valgrind to track memory leak (since we reuse the session and reset the header table)
Also tested on a FreeRTOS + LwIP + mbedtls platform.

I would be happy to have your review on this and if possible to merge it in main.

Thanks !
Simon

Avoid TCP and TLS session re-opening when HTTP authentification digest challenge is provided by server along with a 401 Unauthorized and a connection : keep-alive header set

Signed-off-by: stropee <simon@sirocha.fr>
Co-developed-by: Claude Sonnet 4.6 <claude-sonnet-4-6@anthropic.com>
@lws-team
Copy link
Copy Markdown
Member

lws-team commented May 7, 2026

How do you feel about this version of the patch on _temp (it's essentially main plus a few patches) branch... does it also work for you?

a393c8a

Basically this is more cautious about collecting headers before making a decision, allowing to to defend against chunked / request smuggling.

@simon0356
Copy link
Copy Markdown
Contributor Author

I have tested your proposal on both setup :

  • Linux host + Mbedtls with valgrind check : Ok
  • FreeRTOS + LwIP + Mbedtls : Ok .

It is ok to me, thanks for the review and for the integration.

I have in mind to provide you later a minimal example of websockets server with digest auth support in user callback to allow testing this feature in CI.

Thanks !
Simon

@simon0356 simon0356 closed this May 7, 2026
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