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

Prevents the tunnel from crashing when invalid headers are detected [Issue #425 fix] #426

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alwayshopeless
Copy link

@alwayshopeless alwayshopeless commented Oct 28, 2024

Handling exception of failed header parsing when logging a request.

Hotfix for an issue that prevents the tunnel from crashing when invalid headers are detected.

TODO: align error log output to your default logger.
Related to Issue #425

Handling exception of failed header parsing when logging a request.
Copy link

what-the-diff bot commented Oct 28, 2024

PR Summary

  • Included Additional Dependencies:
    New import statements have been added. These will allow the program to properly utilize functions from Illuminate\Support\Facades's Log, as well as Laminas\Http\Header\Exception's RuntimeException.

  • Improved Error Management and Tracking:
    The logRequest method has been wrapped within a try-catch block. This means that the program will actively try to execute the logRequest method, but if it encounters any errors (specifically a RuntimeException), it will "catch" this event and log the error message using Laravel's logging system. This enhancement improves the handling of unforeseen issues and makes it easier to identify and fix them down the line.

@alwayshopeless alwayshopeless changed the title Update HttpClient.php [Issue #425 fix] Prevents the tunnel from crashing when invalid headers are detected [Issue #425 fix] Oct 28, 2024
@mpociot
Copy link
Member

mpociot commented Oct 28, 2024

Do you know when exactly invalid headers are detected? Would be great to have a test case for this and handle this better in the logger

@alwayshopeless
Copy link
Author

alwayshopeless commented Oct 28, 2024

Do you know when exactly invalid headers are detected? Would be great to have a test case for this and handle this better in the logger

Please look at my issue #425, I have attached a stack trace and an example of how to reproduce the error

@alwayshopeless
Copy link
Author

Technically, we will 100% have a bunch of unhandled exceptions in the future for one reason or another if the request logger exceptions are not handled, this happens when parsing headers, getting domain names, etc., probably all of them cause the tunnel to crash (but this is my guess)

Until a better solution is thought out, it would be preferable for the invalid request to still be sent to the target server, but for the tunnel itself not to fail, but to log errors

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