HPCC-Platform icon indicating copy to clipboard operation
HPCC-Platform copied to clipboard

HPCC-34165 HTTPLIB add timeout to SSL_connect/accept

Open mckellyln opened this issue 9 months ago • 6 comments

Type of change:

  • [ ] This change is a bug fix (non-breaking change which fixes an issue).
  • [x] This change is a new feature (non-breaking change which adds functionality).
  • [ ] This change improves the code (refactor or other change that does not change the functionality)
  • [ ] This change fixes warnings (the fix does not alter the functionality or the generated code)
  • [ ] This change is a breaking change (fix or feature that will cause existing behavior to change).
  • [ ] This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • [x] My code follows the code style of this project.
    • [x] My code does not create any new warnings from compiler, build system, or lint.
  • [x] The commit message is properly formatted and free of typos.
    • [x] The commit message title makes sense in a changelog, by itself.
    • [x] The commit is signed.
  • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly, or...
    • [ ] I have created a JIRA ticket to update the documentation.
    • [ ] Any new interfaces or exported functions are appropriately commented.
  • [ ] I have read the CONTRIBUTORS document.
  • [ ] The change has been fully tested:
    • [ ] I have added tests to cover my changes.
    • [x] All new and existing tests passed.
    • [ ] I have checked that this change does not introduce memory leaks.
    • [ ] I have used Valgrind or similar tools to check for potential issues.
  • [ ] I have given due consideration to all of the following potential concerns:
    • [ ] Scalability
    • [ ] Performance
    • [ ] Security
    • [ ] Thread-safety
    • [ ] Cloud-compatibility
    • [ ] Premature optimization
    • [x] Existing deployed queries will not be broken
    • [x] This change fixes the problem, not just the symptom
    • [x] The target branch of this pull request is appropriate for such a change.
  • [x] There are no similar instances of the same problem that should be addressed
    • [ ] I have addressed them here
    • [ ] I have raised JIRA issues to address them separately
  • [ ] This is a user interface / front-end modification
    • [ ] I have tested my changes in multiple modern browsers
    • [ ] The component(s) render as expected

Smoketest:

  • [x] Send notifications about my Pull Request position in Smoketest queue.
  • [ ] Test my draft Pull Request.

Testing:

mckellyln avatar May 21 '25 12:05 mckellyln

Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-34165

Jirabot Action Result: Workflow Transition To: Merge Pending Additional PR: https://github.com/hpcc-systems/HPCC-Platform/pull/19895

github-actions[bot] avatar May 21 '25 12:05 github-actions[bot]

@jakesmith does this look correct ? We could probably also add the same non-blocking timeout support to SSL_read() and SSL_write().

mckellyln avatar May 21 '25 18:05 mckellyln

Should we add this ? Or look at alternatives ? @asselitx thoughts ?

mckellyln avatar May 28 '25 11:05 mckellyln

The change looks good, but if httplib is built expecting blocking sockets we may see other cases (like SSL_read and SSL_write that you pointed out) not handling timeouts. Also, I'm not sure- is there a danger of problems if the library doesn't support nonblocking anywhere else?

From what I see there have been few changes to lib over the last 5 years and its used only as a client for secrets and the elastic metrics sink. This is a good point where we either 'own it' and commit to customizing it or switch to another implementation.

Given that HTTP requires standards and security compliance would we want to keep our hands off the code and manage regular updates with perhaps vcpkg? If keeping current is important, then using microsoft/ccprestsdk might not be best.

boostorg/beast seems powerful, active and well supported but not terse - probably the best option if we really wanted to lean on the library and take upstream updates.

https://github.com/libcpr/cpr Could be a possibility if we only need clients and if we verify it does handle timeouts on accept/read/write

https://gitlab.com/eidheim/Simple-Web-Server Also has client support and seems pretty streamlined.

asselitx avatar May 28 '25 22:05 asselitx

@mckellyln @asselitx should we be using libcurl instead of http lib? Does it provide the same functionality? We already include it in the platform.

ghalliday avatar Oct 01 '25 09:10 ghalliday

We should look into libcurl. But this (updated and re-checked) should be considered for the platform, as well as the same functionality in jlib (in PR 19156) so that a slow TLS handshake for example does not take longer than the timeout provided. I will re-visit these PRs again so that they are current and correct.

mckellyln avatar Oct 15 '25 18:10 mckellyln