Skip to content

Instantly share code, notes, and snippets.

View digitalextremist's full-sized avatar
🏴
demonstrate freedom

//de digitalextremist

🏴
demonstrate freedom
  • .*
  • Northwest
View GitHub Profile
@digitalextremist
digitalextremist / 01E.ru
Last active December 15, 2015 16:49
Rack routing. Updated to show wildcarding.
map "/.conference" do; run Mu::Conference end
map "/.documentation" do; run Mu::Documentation end
map "/.development" do; run Mu::Development end
map "/.sources" do; run Mu::Sourcing end
@digitalextremist
digitalextremist / reel.rb
Created April 5, 2013 02:41
Sample Reel server, to cause reproducible error.
require 'rubygems'
require 'bundler/setup'
require 'reel'
class MyServer < Reel::Server
def initialize(host = "0.0.0.0", port = 80)
super(host, port, &method(:on_connection))
end
def on_connection(connection)
@digitalextremist
digitalextremist / reel-nosubclass.rb
Created April 5, 2013 02:58
Demonstrating same crash, except without subclass.
require 'rubygems'
require 'bundler/setup'
require 'reel'
puts "Starting test server //"
Reel::Server.supervise("0.0.0.0", 80) do |connection|
while request = connection.request
case request
when Reel::Request
@digitalextremist
digitalextremist / 01E.rb
Created April 7, 2013 01:47
Working version of Reel demo; using Reel::App, including Octarine.
require 'rubygems'
require "bundler/setup"
require 'reel/app'
class Wu
include Reel::App
get '/' do |request|
puts "Request came in //"
[200, {}, "hello world"]
end
@digitalextremist
digitalextremist / norack-01E.rb
Last active December 16, 2015 00:58
Reproducible crashing of Reel, run as a Rack handler, being asked for a MultiPart hash of POST variables.
require 'rubygems'
require "bundler/setup"
require 'reel/app'
MU_BASE = File.expand_path( File.dirname( __FILE__ ) )
class Wu
include Reel::App
get '/' do |request|
puts "Request came in //"
@digitalextremist
digitalextremist / 01E.rb
Last active December 16, 2015 05:08
Test application for Reel::Request::Parser abstraction layer.
MU_BASE = File.expand_path( File.dirname( __FILE__ ) )
require 'rubygems'
require "bundler/setup"
REEL_PARSER = :puma_http11
require ( REEL_LIB = ( LIB_BASE = "/mu/tweaking" ) + "/reel/lib/" ) + 'reel/app'
require 'rack'
@digitalextremist
digitalextremist / Gemfile
Last active December 16, 2015 08:19
Breaking Request.params; unable to parse multipart POST
source "http://rubygems.org"
#de ruby '1.9.3', :engine => 'jruby', :engine_version => '1.7.2'
gem "rack", :github => 'digitalextremist/rack', :branch => 'master'
gem 'rack-contrib', '1.1.0'
gem 'rack-jsonp', "1.3.1"
gem 'rack-protection', "1.5.0"
gem 'rack-cache'
@digitalextremist
digitalextremist / concurrent_nested_hash.rb
Last active December 16, 2015 08:29 — forked from tarcieri/concurrent_nested_hash.rb
Oldie but a goodie, with more of the standard methods.
require 'celluloid'
class ConcurrentNestedHash
include Celluloid
def initialize( starting = {} ); @outer = starting end
def [](*keys); keys.inject(@outer) { |h,k| h[k] } end
def []=(*args)
@digitalextremist
digitalextremist / rack-reel.rb
Last active December 16, 2015 10:59
Test case for http_parser.rb under jRuby. Multipart POST requests will either fail or be corrupt.
require 'rubygems'
require "bundler/setup"
MU_BASE = File.expand_path( File.dirname( __FILE__ ) )
MU_UPLOADS = "/mu/rack-reel/uploads/"
require 'rack'
require 'reel'
require 'sinatra'
require "sinatra/multi_route"
@digitalextremist
digitalextremist / spec.output.txt
Created April 22, 2013 23:19
http_parser.rb test failures
Failures:
1) HTTP::Parser should implement basic api
Failure/Error: Unable to find matching line from backtrace
Java::JavaLang::ClassCastException:
org.jruby.RubyNil cannot be cast to org.jruby.RubyString
# org.ruby_http_parser.RubyHttpParser$2.cb(RubyHttpParser.java:110)
# http_parser.lolevel.ParserSettings.call_on(ParserSettings.java:80)
# http_parser.lolevel.ParserSettings.call_on_url(ParserSettings.java:64)
# http_parser.lolevel.HTTPParser.execute(HTTPParser.java:697)