fix:http logic errors fixed #376
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #375
Fix HTTP status code checking bugs and code quality issues in info.py
Changes Proposed
resp.text.__contains__("404")withresp.status_code != 404inget_dot_git()function (line 155)resp.text.__contains__("404")withresp.status_code != 404inget_dot_svn()function (line 186)resp.text.__contains__("403")withresp.status_code == 403inget_dot_htaccess()function (line 204)resp.text.__contains__("404")andresp.text.__contains__("500")with proper status code checks inget_dot_htaccess()function (line 206)get_dot_gitfunction call from validation_functions list (line 73)httpx.get()calls withclient.get()to use proper proxy configuration (lines 185, 203)Explanation of Changes
HTTP Status Code Fixes:
The original code was checking if the response text contained status code strings like "404" or "403", which is unreliable because:
The fix uses
resp.status_codewhich provides the actual HTTP status code returned by the server, ensuring accurate detection of file accessibility.Duplicate Function Call Fix:
The
get_dot_gitfunction was listed twice in the validation_functions list, causing unnecessary duplicate execution and potential duplicate output.Hardcoded Proxy Fix:
The functions were using hardcoded proxy URLs instead of the client's configured proxy settings, which could cause issues when:
The fix uses
client.get()which respects the client's proxy configuration.Screenshots of new feature/change
N/A - These are code fixes that improve reliability and accuracy of existing functionality. No visual changes to the user interface.
Before (Buggy Code):
After (Fixed Code):
Files Changed:
src/torbot/modules/info.pyType of Change:
Testing:
Related Issues:
Fixes #375