lib/toycol/proxy.rb in toycol-0.1.0 vs lib/toycol/proxy.rb in toycol-0.2.0

- old
+ new

@@ -90,12 +90,14 @@ response_message = [] response_message << server.readpartial(CHUNK_SIZE) until server.eof? response_message = response_message.join puts "[Toycol] Received response message from server: #{response_message.lines.first}" - _, status_code, status_message = response_message.lines.first.split + response_line = response_message.lines.first + status_number = response_line[9..11] + status_message = response_line[12..].strip - if (custom_message = @protocol.status_message(status_code.to_i)) != status_message + if (custom_message = @protocol.status_message(status_number.to_i)) != status_message response_message = response_message.sub(status_message, custom_message) puts "[Toycol] Status message has been translated to custom status message: #{custom_message}" end @client.write response_message