diff --git a/camping.gemspec b/camping.gemspec deleted file mode 100644 index 35c728b..0000000 --- a/camping.gemspec +++ /dev/null @@ -1,33 +0,0 @@ -require 'rubygems' -spec = Gem::Specification.new do |s| - s.name = 'camping' - s.version = "1.4" - s.platform = Gem::Platform::RUBY - s.summary = "miniature rails for stay-at-home moms" - s.add_dependency('activerecord', '>=1.14.0') - s.add_dependency('markaby', '>=0.4') - s.add_dependency('metaid') - s.has_rdoc = true - s.files = ['README', 'CHANGELOG', 'examples/**/*', 'lib/**/*', 'bin/**/*', 'extras/**/*'].collect do |dirglob| - Dir.glob(dirglob) - end.flatten.delete_if {|item| item.include?(".svn")} - s.extra_rdoc_files = ['README', 'CHANGELOG'] - s.rdoc_options << "--quiet" << - "--title" << "Camping, the Documentation" << - "--template" << "extras/flipbook_rdoc.rb" << - "--opname" << "index.html" << - "--line-numbers" << - "--main" << "README" << - "--inline-source" << - "--exclude" << "^(examples|extras)\/" << - "--exclude" << "lib/camping.rb" - s.require_path = 'lib' - s.executables << 'camping' - s.author = "why the lucky stiff" - s.email = "why@ruby-lang.org" - s.rubyforge_project = "camping" - s.homepage = "http://code.whytheluckystiff.net/camping/" -end -if $0==__FILE__ - Gem::Builder.new(spec).build -end diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb index b78b035..4731485 100644 --- a/lib/camping-unabridged.rb +++ b/lib/camping-unabridged.rb @@ -357,23 +357,38 @@ def initialize(r, e, m) #:nodoc: qs = C.qs_parse(e.QUERY_STRING) @in = r if %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)|n.match(e.CONTENT_TYPE) - b = "--#$1" - @in.read.split(/(?:\r?\n|\A)#{ Regexp::quote( b ) }(?:--)?\r\n/m).each { |pt| - h,v=pt.split("\r\n\r\n",2);fh={} - [:name, :filename].each { |x| - fh[x] = $1 if h =~ /^Content-Disposition: form-data;.*(?:\s#{x}="([^"]+)")/m - } - fn = fh[:name] - if fh[:filename] - fh[:type]=$1 if h =~ /^Content-Type: (.+?)(\r\n|\Z)/m - fh[:tempfile]=Tempfile.new(:C).instance_eval {binmode;write v;rewind;self} + b = /(?:\r?\n|\A)#{Regexp::quote("--#$1")}(?:--)?\r$/ + until @in.eof? + fh=H[] + for l in @in + case l + when "\r\n": break + when /^Content-Disposition: form-data;/ + fh.u H[*$'.scan(/(?:\s(\w+)="([^"]+)")/).flatten] + when /^Content-Type: (.+?)(\r$|\Z)/m + puts "=> fh[type] = #$1" + fh[:type] = $1 + end + end + fn=fh[:name] + o=if fh[:filename] + fh[:tempfile]=Tempfile.new(:C).binmode else - fh=v + fh="" + end + while l=@in.read(16384) + if l=~b + o<<$`.chomp + @in.seek(-$'.size,IO::SEEK_CUR) + break + end + o<"text/htm\ l"},e.SCRIPT_NAME.sub(/\/$/,'');@k=C.kp e.HTTP_COOKIE;q=C.qs_parse e.QUERY_STRING @in=r;if %r|\Amultipart/form-.*boundary=\"?([^\";,]+)|n.match e.CONTENT_TYPE;b= -"--#$1";@in.read.split(/(?:\r?\n|\A)#{Regexp.quote b}(?:--)?\r\n/m).map{|y|h,v=y. -split "\r\n\r\n",2;fh={};[:name,:filename].map{|x|fh[x]=$1 if h=~/^Content-Di.+\ -: form-data;.*(?:\s#{x}="([^"]+)")/m};fn=fh[:name];if fh[:filename];fh[:type]= -$1 if h=~/^Content-Type: (.+?)(\r\n|\Z)/m;fh[:tempfile]=Tempfile.new(:C). -instance_eval{binmode;write v;rewind;self}else;fh=v end;q[fn]=fh if fn}elsif -@method=="post";q.u C.qs_parse(@in.read) end;@cookies,@input= +/(?:\r?\n|\A)#{Regexp::quote("--#$1")}(?:--)?\r$/;until @in.eof?;fh=H[];for l in +@in;case l;when "\r\n":break;when /^Content-Disposition: form-data;/:fh.u H[*$'. +scan(/(?:\s(\w+)="([^"]+)")/).flatten];when /^Content-Type: (.+?)(\r$|\Z)/m;fh[ +:type]=$1;end;end;fn=fh[:name];o=if fh[:filename];fh[:tempfile]=Tempfile.new(:C). +binmode;else;fh="";end;while l=@in.read(16384);if l=~b;o<<$`.chomp;@in.seek(-$'. +size,IO::SEEK_CUR);break;end;o<