Skip to content

-pr (--protocol) flag does not assign value to Options.Protocol #2233

Closed

Description

@khs-alt

httpx version: v1.7.1 (latest)

Current Behavior:

the -pr flag (protocol) has no effect because the value is never assigned to httpx.Options.Protocol.

add fmt.print code at common/httpx/httpx.go for debug
run go run cmd/httpx/httpx.go -pr http11 -u example.com

        //... 155 line
	if httpx.Options.Protocol == "http11" {
		// disable http2
		os.Setenv("GODEBUG", "http2client=0")
		transport.TLSNextProto = map[string]func(string, *tls.Conn) http.RoundTripper{}
	}
	fmt.Printf("httpx.Options.Protocol: %+v\n", httpx.Options.Protocol)
        fmt.Printf("Protocol == \"http11\": %t\n", httpx.Options.Protocol == "http11")
        //...

and the result is blow

% go run cmd/httpx/httpx.go -pr http11 -u example.com

    __    __  __       _  __
   / /_  / /_/ /_____ | |/ /
  / __ \/ __/ __/ __ \|   /
 / / / / /_/ /_/ /_/ /   |
/_/ /_/\__/\__/ .___/_/|_|
             /_/

                projectdiscovery.io

[INF] Current httpx version v1.7.1 (latest)
[WRN] UI Dashboard is disabled, Use -dashboard option to enable
httpx.Options.Protocol: 
Protocol == "http11": false

The protocol value is not set because there is no code assigning the -pr flag value to Options.Protocol

Expected Behavior:

% go run cmd/httpx/httpx.go -pr http11 -u example.com

    __    __  __       _  __
   / /_  / /_/ /_____ | |/ /
  / __ \/ __/ __/ __ \|   /
 / / / / /_/ /_/ /_/ /   |
/_/ /_/\__/\__/ .___/_/|_|
             /_/

                projectdiscovery.io

[INF] Current httpx version v1.7.1 (latest)
[WRN] UI Dashboard is disabled, Use -dashboard option to enable
httpx.Options.Protocol: http11
Protocol == "http11": true

Steps To Reproduce:

  1. Add the debug fmt.Print lines above
  2. Run go run cmd/httpx/httpx.go -pr http11 -u example.com
  3. See that the value is not set

Activity

  1. added
    Type: Bug
    on Aug 6, 2025
  2. added theissue type on Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type: Bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions