Skip to content

Conversation

@bbockelm
Copy link
Collaborator

Unlike XrdTlsSocket, the HTTP protocol did a one-sided TLS shutdown. This saved network a round-trip but at the cost of correctness: if the server shut down the connection after its response while the client was still sending data then the client may recieve a TCP reset prior to reading out the response.

This exact behavior was observed in unit tests and the correct approach is outlined in latest HTTP 1.1 RFC:

https://datatracker.ietf.org/doc/html/rfc9112#name-tls-connection-closure

Basically, we now do the same as XrdTlsSocket and perform a bidirectional TLS shutdown.

This takes care of the HTTPS portion of #2564.

@abh3
Copy link
Member

abh3 commented Jul 29, 2025

I think we have discussed this in issue 2564 and the bottom line is that if you call Link Close() on a TLS connection, the correct shutdown sequence happens. This code here simply duplicates the code in Link Close(). So, I propose we a) verify that this is true, and b) if true, delete the HTTP specific code to use the already implemented code for TLS connections. If that implementation is not correct then it should be fixed. In any case, having duplicate handling is not what we want here.

@ffurano ffurano self-assigned this Sep 8, 2025
@abh3
Copy link
Member

abh3 commented Sep 16, 2025

The whole point is to consolidate the code not to replicate things. What would be your suggestion to have this handled in one central place?

@amadio
Copy link
Member

amadio commented Sep 17, 2025

What would be your suggestion to have this handled in one central place?

I'd create a separate function and call it in both places. Right now since the code is inside a class it's kinda hard to share.

@amadio amadio force-pushed the xrdhttp_tls_shutdown branch from d43f943 to 6f325f8 Compare October 3, 2025 07:36
Unlike XrdTlsSocket, the HTTP protocol did a one-sided TLS shutdown.
This saved network a round-trip but at the cost of correctness: if
the server shut down the connection after its response while the client
was still sending data then the client may recieve a TCP reset prior
to reading out the response.

This exact behavior was observed in unit tests and the correct approach
is outlined in latest HTTP 1.1 RFC:

https://datatracker.ietf.org/doc/html/rfc9112#name-tls-connection-closure

Basically, we now do the same as `XrdTlsSocket` and perform a bidirectional
TLS shutdown.
@amadio amadio force-pushed the xrdhttp_tls_shutdown branch from 6f325f8 to 7f97d8a Compare October 3, 2025 07:58
@amadio
Copy link
Member

amadio commented Oct 3, 2025

Although we still need to address the non-blocking I/O case as I mentioned in my comment, what we have here is definitely an improvement over what is currently done, so I'm picking this up for XRootD 5.9.

@amadio amadio added this to the 5.9.0 milestone Oct 3, 2025
@amadio amadio merged commit 0ae52f7 into xrootd:master Oct 3, 2025
13 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants