Skip to content

Conversation

@bbockelm
Copy link
Collaborator

@bbockelm bbockelm commented Mar 1, 2025

When using X-Transfer-Status, there were three subtle HTTP protocol
errors:

  • The trailer contained a \n which is not a permitted character. This caused clients to view the last CRLF as leftover data on
    an idle TCP channel.
  • A trailer was sent but no Trailer header was sent in the response.
  • When the server said that the connection would be kept alive but an error occurred, it closed the TCP connection unexpectedly on the client. The server now keeps the TCP connection open if keepalive is enabled, provided the HTTP response was sent cleanly.

To prevent regressions, this adds the first unit test that injects read failures mid-transfer.

@bbockelm bbockelm force-pushed the http_error_handling branch from d6ca179 to 9e8fef6 Compare March 15, 2025 16:26
Copy link
Collaborator

@dynamic-entropy dynamic-entropy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Planning to build on the XrdOssTests to improve the webdav error messages. Left a request to rename the test file.

@bbockelm
Copy link
Collaborator Author

@amadio - I realized this PR was still open when rebasing branches. Certainly protocol errors are a bug -- was there a reason it didn't make it into 5.8.2? Just an oversight?

@amadio amadio force-pushed the http_error_handling branch from 3c7ab30 to 80516ee Compare May 10, 2025 14:24
@amadio
Copy link
Member

amadio commented May 10, 2025

Yes, oversight, sorry. There were still unresolved conversations, so I wasn't sure this was ready or not. We can add this to the next patch release in ~2 weeks. I will tag it so I don't forget.

@amadio amadio added this to the 5.8.3 milestone May 10, 2025
@bbockelm
Copy link
Collaborator Author

No worries! We carry this out-of-tree so it can wait until the next patch release. Just wanted to make sure there wasn't a deeper issue.

@amadio
Copy link
Member

amadio commented May 17, 2025

@bbockelm In order for us to be able to merge this, please rebase it on top of the current master branch. If CI is red I cannot merge. Thanks.

@bbockelm bbockelm force-pushed the http_error_handling branch from 80516ee to 7d9cc36 Compare May 18, 2025 21:32
bbockelm added 2 commits May 18, 2025 20:27
When using `X-Transfer-Status`, there were three subtle HTTP protocol
errors:
- The trailer contained a `\n` which is not a permitted character.
  This caused clients to view the last CRLF as leftover data on
  an idle TCP channel.
- A trailer was sent but no `Trailer` header was sent in the
  response.
- When the server said that the connection would be kept alive but
  an error occurred, it closed the TCP connection unexpectedly on
  the client.  The server now keeps the TCP connection open if
  keepalive is enabled, provided the HTTP response was sent cleanly.
This unit test (including an XrdOss wrapper to inject failures)
tests the behavior of the HTTP server when a read error occurs. The
server should either abruptly close the TCP connection or, if
Trailers are enabled, send an error message and keep the connection
alive.
@bbockelm bbockelm force-pushed the http_error_handling branch from 6dae5dd to 64847a8 Compare May 19, 2025 01:29
@bbockelm
Copy link
Collaborator Author

@amadio - fixed the underlying issue.

This PR introduces a small OSS for injecting failures in the unit tests. Some of the recent CMake changes caused the location of the built library to change and hence the generated test configs were incorrect. Easy fix - but I suppose it's one of the dangers of having it sit out on a branch for so long.

@amadio
Copy link
Member

amadio commented May 20, 2025

Libraries in configuration files should not use paths, just the library name. XRootD should always load the right library from the same place as the other ones (in this case, from the lib directory inside the binary directory). Thanks for fixing in any case. I'm merging it now.

@amadio amadio merged commit 1662cfa into xrootd:master May 20, 2025
20 of 21 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Release Planning May 20, 2025
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.

3 participants