Changeset 189

Show
Ignore:
Timestamp:
03/22/2007 23:55:43 (20 months ago)
Author:
why
Message:
  • lib/camping.rb: fixing uploads with ticket #107, at long last, thankyou brmichel!
Location:
trunk/lib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/camping-unabridged.rb

    r188 r189  
    411411            fh="" 
    412412          end 
    413           while l=@in.read(16384) 
    414             if l=~b 
     413          s=8192  
     414          k=''  
     415          l=@in.read(s*2)  
     416          while l  
     417            if (k<<l)=~b  
    415418              o<<$`.chomp 
    416419              @in.seek(-$'.size,IO::SEEK_CUR) 
    417420              break 
    418421            end 
    419             o<<l 
     422            o<<k.slice!(0...s)  
     423            l=@in.read(s)  
    420424          end 
    421425          C.qsp(fn,'&;',fh,qs) if fn 
  • trunk/lib/camping.rb

    r188 r189  
    1919when/^Content-D.+?: form-data;/;fh.u H[*$'.scan(/(?:\s(\w+)="([^"]+)")/).flatten] 
    2020when/^Content-Type: (.+?)(\r$|\Z)/m;fh[:type]=$1;end;end;fn=fh[:name];o=if 
    21 fh[:filename];o=fh[:tempfile]=Tempfile.new(:C);o.binmode;else;fh=""end;while l=@in. 
    22 read(16384);if l=~b;o<<$`.chomp;@in.seek(-$'.size,IO::SEEK_CUR);break;end;o<<l 
     21fh[:filename];o=fh[:tempfile]=Tempfile.new(:C);o.binmode;else;fh=""end;s=8192;k= 
     22'';l=@in.read(s*2);while l;if(k<<l)=~b;o<<$`.chomp;@in.seek(-$'.size, 
     23IO::SEEK_CUR);break;end;o<<k.slice!(0...s);l=@in.read(s) 
    2324end;C.qsp(fn,'&;',fh,q) if fn;fh[:tempfile].rewind if fh.is_a?H;end;elsif@method== 
    2425"post" and e.CONTENT_TYPE == "application/x-www-form-urlencoded"