Skip to content

Preserve non-default ports in Host headers - #6171

Merged
stamparm merged 1 commit into
sqlmapproject:masterfrom
bingdongni:fix/host-header-scheme-port
Nov 3, 2026
Merged

stamparm merged 1 commit into
sqlmapproject:masterfrom
bingdongni:fix/host-header-scheme-port

Conversation

@bingdongni

Copy link
Copy Markdown
Contributor

getHostHeader strips both :80 and :443 regardless of the URL scheme. For example, http://example.com:443/ generates Host: example.com instead of Host: example.com:443, which can route requests incorrectly on port-aware virtual hosts. HTTPS on port 80 has the same problem.

Strip only the default port for the URL scheme, retaining non-default ports for hostnames and IPv6 addresses.

Tests:

  • Python 3.12: 2,742 tests run, 15 skipped.
  • PyPy 2.7 on Windows: 2,734 tests run, 34 skipped, excluding test_replication. Its six SQLite teardown errors also reproduce on unmodified master.
  • Pyflakes and git diff --check on the changed files.

@stamparm
stamparm merged commit 3130623 into sqlmapproject:master Nov 3, 2026
stamparm added a commit that referenced this pull request Nov 3, 2026
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