The current version will be found at https://gist.github.com/mike-bourgeous/2be6c8900bf624887fe5fee4f28552ef
Please make all comments, stars, forks, etc. there.
The current version will be found at https://gist.github.com/mike-bourgeous/2be6c8900bf624887fe5fee4f28552ef
Please make all comments, stars, forks, etc. there.
The current version will be found at https://gist.github.com/mike-bourgeous/a48f8e8c87be9f0875bed16980ab1775
Please make all comments, stars, forks, etc. there.
# Monkey patch exception logging into async_sinatra | |
# | |
# This is a workaround for the lack of error handling/logging on asynchronous | |
# requests (e.g. aget, apost) when using async_sinatra 0.5.0, sinatra 1.2.6, | |
# thin 1.2.11, and rack 1.3.0. | |
# | |
# See http://stackoverflow.com/questions/6427033/how-do-i-log-asynchronous-thinsinatrarack-requests | |
module Sinatra::Async | |
alias :oldaroute :aroute |
def self.simple_parse(data) | |
Hash[*data.split(/}\n?/).map {|v| | |
bl = v.split("\n{\n") | |
bl[1] = Hash[*bl[1].split("\n").map {|v2| | |
pair = v2.split(/[=!]/, 2) | |
pair[1] = [pair[1]].pack 'H*' if v2 =~ /^[^=!]+!/ | |
pair | |
}.flatten!] | |
bl | |
}.flatten!(1)] |
The current version will be found at https://gist.github.com/mike-bourgeous/f9d6bfc34ae4e3f123e08fce5037f73b
Please make all comments, stars, forks, etc. there.
The current version will be found at https://gist.github.com/mike-bourgeous/bd58056617e1922ecba72abc58de94fc
Please make all comments, stars, forks, etc. there.