Skip to content

rfc3986_parser.rb:130:in `split': bad URI(is not URI?): "127.0.0.1:<my port>" (URI::InvalidURIError) #56

@erwin

Description

@erwin

Just an FYI, I was getting errors long the lines of:

bin/bundle exec ruby socks.rb
/home/erwin/.rbenv/versions/3.3.3/lib/ruby/3.3.0/uri/rfc3986_parser.rb:130:in `split': bad URI(is not URI?): "127.0.0.1:<my port>" (URI::InvalidURIError)
        from /home/erwin/.rbenv/versions/3.3.3/lib/ruby/3.3.0/uri/rfc3986_parser.rb:135:in `parse'
        from /home/erwin/.rbenv/versions/3.3.3/lib/ruby/3.3.0/uri/common.rb:185:in `parse'
        from /home/erwin/.rbenv/versions/3.3.3/lib/ruby/3.3.0/uri/generic.rb:1563:in `find_proxy'
        from /home/erwin/.rbenv/versions/3.3.3/lib/ruby/3.3.0/net/http.rb:1801:in `proxy_uri'
        from /home/erwin/.rbenv/versions/3.3.3/lib/ruby/3.3.0/net/http.rb:1786:in `proxy?'
        from /home/erwin/dev/awesome/localgems/ruby/3.3.0/bundler/gems/socksify-ruby-94cff4509997/lib/socksify/ruby3net_http_connectable.rb:13:in `connect' from /home/erwin/.rbenv/versions/3.3.3/lib/ruby/3.3.0/net/http.rb:1580:in `do_start'
        from /home/erwin/.rbenv/versions/3.3.3/lib/ruby/3.3.0/net/http.rb:1569:in `start'
        from /home/erwin/.rbenv/versions/3.3.3/lib/ruby/3.3.0/net/http.rb:1029:in `start'
        from socks.rb:7:in `<main>'

When I was running inside rails console I wasn't seeing the whole stack trace, so it took me an embarrassingly long time to get to the bottom of it...

But with the stacktrace in hand, you quickly figure out the issue is the in 'http.rb:1786' inside of 'def proxy?' where it's reading the values of HTTP_PROXY and http_proxy set in the environment.

Some tools can accept socks proxies for these, some can't... If you hit this error, you probably just need to unset HTTP_PROXY and unset http_proxy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions