From: Eric Wong <e@80x24.org> To: raindrops-public@bogomips.org Subject: [PATCH] drop Rack::Utils.bytesize dependency Date: Wed, 27 Jul 2016 22:51:55 +0000 Message-ID: <20160727225155.30453-1-e@80x24.org> (raw) rack 2.0 removes this method, but we actually don't need it since any strings we generate are binary and Aggregate#to_s output is 7-bit clean. --- lib/raindrops/watcher.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/raindrops/watcher.rb b/lib/raindrops/watcher.rb index fb2df5b..f0abd1d 100644 --- a/lib/raindrops/watcher.rb +++ b/lib/raindrops/watcher.rb @@ -244,10 +244,10 @@ def agg_to_hash(reset_at, agg, current, peak) def histogram_txt(agg) updated_at, reset_at, agg, current, peak = *agg headers = agg_to_hash(reset_at, agg, current, peak) - body = agg.to_s + body = agg.to_s # 7-bit ASCII-clean headers["Content-Type"] = "text/plain" headers["Expires"] = (updated_at + @delay).httpdate - headers["Content-Length"] = bytesize(body).to_s + headers["Content-Length"] = body.size.to_s [ 200, headers, [ body ] ] end @@ -265,7 +265,7 @@ def histogram_html(agg, addr) "</body>" headers["Content-Type"] = "text/html" headers["Expires"] = (updated_at + @delay).httpdate - headers["Content-Length"] = bytesize(body).to_s + headers["Content-Length"] = body.size.to_s [ 200, headers, [ body ] ] end @@ -364,7 +364,7 @@ def index "for more information and options." \ "</p>" \ "</body></html>" - headers["Content-Length"] = bytesize(body).to_s + headers["Content-Length"] = body.size.to_s [ 200, headers, [ body ] ] end @@ -382,7 +382,7 @@ def initialize(rdmon, addr, env) # :nodoc: q = Rack::Utils.parse_query env["QUERY_STRING"] @active_min = q["active_min"].to_i @queued_min = q["queued_min"].to_i - len = Rack::Utils.bytesize(addr) + len = addr.size len = 35 if len > 35 @fmt = "%20s % #{len}s % 10u % 10u\n" case env["HTTP_VERSION"] -- EW
reply other threads:[~2016-07-27 22:51 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://yhbt.net/raindrops/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20160727225155.30453-1-e@80x24.org \ --to=e@80x24.org \ --cc=raindrops-public@bogomips.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
raindrops RubyGem user+dev discussion/patches/pulls/bugs/help This inbox may be cloned and mirrored by anyone: git clone --mirror https://yhbt.net/raindrops-public git clone --mirror http://ou63pmih66umazou.onion/raindrops-public # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V1 raindrops-public raindrops-public/ https://yhbt.net/raindrops-public \ raindrops-public@yhbt.net raindrops-public@bogomips.org raindrops@librelist.org raindrops@librelist.com public-inbox-index raindrops-public Example config snippet for mirrors. Newsgroups are available over NNTP: nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops note: .onion URLs require Tor: https://www.torproject.org/ code repositories for the project(s) associated with this inbox: ../../raindrops.git AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git