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.
This pull request introduces a set of functional and structural enhancements to the existing script. The primary objective is to improve the visibility and diagnostic capability of HTTP(S) endpoint checks by incorporating IP:Port resolution and enhanced redirection tracing.
These features were developed as part of a task that required more granular visibility into the behavior and network characteristics of HTTP endpoints.
1) IP:Port Resolution
Introduced a utility function resolve_ip_and_port(url) that resolves the target hostname to its corresponding IP address and determines the port based on URL scheme (http → 80, https → 443, or custom port if specified).
This aids in understanding the actual network endpoint behind each domain and can assist in infrastructure debugging or penetration testing scenarios.
2) Redirection Chain Analysis
URLs that respond with a redirect (e.g., 3xx status codes) now include:
3) Final destination URL
Resolved IP:Port of the redirection target.
This is particularly useful for detecting CDN fronting, load balancing, or domain-level aliasing strategies.
4) Formatted Output Reporting
Output format has been augmented to show:
[Status: 301] [IP: 93.184.216.34:443] https://example.com [Redirect: https://www.example.com (93.184.216.36:443)]
This provides a concise but comprehensive summary per target.
5) Improved Asynchronous Flow
Maintains the use of httpx.AsyncClient with asyncio.as_completed() for efficient concurrent resolution of multiple URLs.
Ensures performance remains scalable with larger URL lists.
6) Graceful Degradation
Robust exception handling ensures that DNS resolution failures or network errors result in a fallback IP:Port Not Found, preserving output consistency without breaking execution.