We discovered this while testing message delivery receipts, which
fortunately included the word "Gajim" in the messages in our tests,
causing Goliath to bail with an HTTP 400 error, indicating bad JSON.
Which was correct, since we would only have been sending the JSON part
before the 'G' in Gajim, due to incorrectly failing to limit the
number of splits being done by the split that is fixed here.
That will teach me to parse JSON without a JSON parser, or not...
@@ -91,7 +91,7 @@ while true
uri = URI("http://#{ARGV[1]}:#{ARGV[2]}/")
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
- req.body = new_json_blob.split('G')[1][2..-1] # only use MSG part
+ req.body = new_json_blob.split('G', 2)[1][2..-1] # only use MSG part
begin
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
http.request(req)