Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

0.9.9/client.rb: Catch empty version responses.

Sometimes sphinx will reply with an empty version (for unknown reasons).
The exception raised is a "undefined method `<' for nil:NilClass" which
is both confusing and inconvenient to target for rescuing.

This patch catches such errors and raises a proper Riddle exception
instead.
  • Loading branch information...
commit 956d7f40441fbb380b990ff2b07c16f22a054047 1 parent 4dc5b9e
@sce authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/riddle/0.9.9/client.rb
View
6 lib/riddle/0.9.9/client.rb
@@ -12,7 +12,11 @@ def initialise_connection
socket.send [1].pack('N'), 0
# Checking version
- version = socket.recv(4).unpack('N*').first
+ unless version = socket.recv(4).unpack('N*').first
+ socket.close
+ raise ResponseError, "No response from searchd when checking version."
+ end
+
if version < 1
socket.close
raise VersionError, "Can only connect to searchd version 1.0 or better, not version #{version}"
Please sign in to comment.
Something went wrong with that request. Please try again.