tikh-klarlack 0.0.9 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/klarlack.rb +1 -1
- data/lib/varnish/client.rb +10 -8
- metadata +3 -3
data/lib/klarlack.rb
CHANGED
data/lib/varnish/client.rb
CHANGED
@@ -228,16 +228,21 @@ module Varnish
|
|
228
228
|
|
229
229
|
private
|
230
230
|
|
231
|
+
def cmd_without_lock(name, *params)
|
232
|
+
@conn.write "#{name} #{params.join(' ').gsub('\\', '\\\\\\')}\n"
|
233
|
+
status, length = conn_gets.split # <status> <content_length>\n
|
234
|
+
content = conn_read(length.to_i + 1) # +1 = \n
|
235
|
+
content.chomp!
|
236
|
+
[status, content]
|
237
|
+
end
|
238
|
+
|
231
239
|
# Sends a command to varnishd.
|
232
240
|
# Raises a Varnish::CommandFailed error when a non-200 status is returned
|
233
241
|
# Returns the response text
|
234
242
|
def cmd(name, *params)
|
235
243
|
@mutex.synchronize do
|
236
244
|
connect unless connected?
|
237
|
-
|
238
|
-
status, length = conn_gets.split # <status> <content_length>\n
|
239
|
-
content = conn_read(length.to_i + 1) # +1 = \n
|
240
|
-
content.chomp!
|
245
|
+
status, content = *cmd_without_lock(name, *params)
|
241
246
|
raise CommandFailed, "Command #{name} returned with status #{status}: #{content}" if status.to_i != 200
|
242
247
|
content
|
243
248
|
end
|
@@ -247,10 +252,7 @@ module Varnish
|
|
247
252
|
status, length = conn_gets.split # <status> <content_length>\n
|
248
253
|
content = conn_read(length.to_i + 1) # +1 = \n
|
249
254
|
if status.to_i == 107
|
250
|
-
|
251
|
-
status, length = conn_gets.split # <status> <content_length>\n
|
252
|
-
content = conn_read(length.to_i + 1) # +1 = \n
|
253
|
-
content.chomp!
|
255
|
+
status, content = *cmd_without_lock('auth', auth_response(content[0,32]))
|
254
256
|
raise CommandFailed, "Command #{name} returned with status #{status}: #{content}" if status.to_i != 200
|
255
257
|
end
|
256
258
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tikh-klarlack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 11
|
10
|
+
version: 0.0.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Max Sch\xC3\xB6fmann"
|