Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fail on hostnames with '_' in them #759

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Don't fail on hostnames with '_' in them #759

wants to merge 1 commit into from

Conversation

l8nite
Copy link

@l8nite l8nite commented Jan 30, 2016

At work today, we had a SOLR instance running on a domain name with an underscore in it:

URI::InvalidComponentError: bad component(expected host component): int-geocodes_domain-solr.practicefusion.net
/var/www/geocode_domain/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.0/lib/sunspot/rails.rb:61:in `slave_config'
/var/www/geocode_domain/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.0/lib/sunspot/rails.rb:38:in `build_session'

While unconventional, the RFCS do seem to support this. There's even an old thread on ruby-forum. discussing this.

This fix works by skipping URI::HTTP.build in favor of simply setting the values on an existing URI object.

I couldn't get specs to run locally (something in my environment), but I'll try again next week unless someone else can run them for me before then.

@bragboy
Copy link
Collaborator

bragboy commented Mar 14, 2016

can you write a new spec with a dummy hostname with an _ in it ?

@l8nite
Copy link
Author

l8nite commented Mar 14, 2016

@bragboy I can't seem to get the specs to work right, something might be up with my local rbenv installation, but I keep running into failures with finding rsolr (even though the gem is installed).

@serggl
Copy link
Collaborator

serggl commented Jul 5, 2019

@l8nite any chance this can have specs?

@l8nite
Copy link
Author

l8nite commented Jul 15, 2019

@serggl I'll see if I can get it to work

Edit: So I can't seem to even run rspec for sunspot_rails on a fresh clone from master:

sguth@S806394-W10:~/github/sunspot/sunspot_rails$ rspec
-- create_table(:posts, {:force=>:cascade})
   -> 0.0059s
-- create_table(:locations, {:force=>:cascade})
   -> 0.0005s
-- create_table(:blogs, {:force=>:cascade})
   -> 0.0005s
-- create_table(:writers, {:force=>:cascade, :primary_key=>:writer_id})
   -> 0.0004s

An error occurred while loading ./spec/server_spec.rb.
Failure/Error:
  describe Sunspot::Rails::Server do
    before :each do
      @server = Sunspot::Rails::Server.new
      @config = Sunspot::Rails::Configuration.new
      allow(@server).to receive(:configuration){ @config }
      @solr_home = File.join(@config.solr_home)
    end

    it "sets the correct Solr home" do
      expect(@server.solr_home).to eq(@solr_home)

NameError:
  uninitialized constant Sunspot::Rails::Server
  Did you mean?  TCPServer

@l8nite l8nite closed this Jul 17, 2019
@l8nite l8nite reopened this Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants