Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for latest afs trimmed changes #100

Merged
merged 1 commit into from
Oct 11, 2024
Merged

Update for latest afs trimmed changes #100

merged 1 commit into from
Oct 11, 2024

Conversation

maxisoft
Copy link
Owner

@maxisoft maxisoft commented Oct 11, 2024

Use SocketsHttpHandler & Implement property access with reflection for resiliency (fix #99)

Change HttpClientHandler to SocketsHttpHandler to match ArchiSteamFarm upstream code This commit addresses the issue raised in #99 by using reflection to set properties on SocketsHttpHandler and HttpClient. This ensures that our code continues to function even if the property names are changed or deleted in a future trimmed binary.

Changes:

  • Modified SimpleHttpClient constructor to use reflection-based property setting for:
    • AutomaticDecompression
    • MaxConnectionsPerServer
    • EnableMultipleHttp2Connections
  • Added a new helper method SetPropertyValue for generic property access with logging.
  • Updated SetExpectContinueProperty to use reflection as well.
  • Introduced a new method SetPropertyWithLogging to handle potential exceptions and log warnings if property access fails.
  • Updated Directory.Build.props to increment the version to 1.7.1.0.

Additional Notes:

  • Reflection can be slightly slower than direct property access. However, this approach offers greater flexibility and resilience to potential changes in the underlying libraries.

This commit is related to issue #99.

…r resiliency (fix #99)

Change HttpClientHandler to SocketsHttpHandler to match ArchiSteamFarm upstream code
This commit addresses the issue raised in #99 by using reflection to set properties on `SocketsHttpHandler` and `HttpClient`.
This ensures that our code continues to function even if the property names are changed in a future trimmed binary.

**Changes:**

* Modified `SimpleHttpClient` constructor to use reflection-based property setting for:
    * `AutomaticDecompression`
    * `MaxConnectionsPerServer`
    * `EnableMultipleHttp2Connections`
* Added a new helper method `SetPropertyValue` for generic property access with logging.
* Updated `SetExpectContinueProperty` to use reflection as well.
* Introduced a new method `SetPropertyWithLogging` to handle potential exceptions and log warnings if property access fails.
* Updated `Directory.Build.props` to increment the version to `1.7.1.0`.

**Additional Notes:**

* Reflection can be slightly slower than direct property access. However, this approach offers greater flexibility and resilience to potential changes in the underlying libraries.

**This commit is related to issue #99.**
@maxisoft maxisoft self-assigned this Oct 11, 2024
@maxisoft maxisoft merged commit bdcdf3d into main Oct 11, 2024
24 of 27 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.

Plugin throws error with Docker
1 participant