Changeset 230

Show
Ignore:
Timestamp:
09/28/2007 16:07:35 (14 months ago)
Author:
zimbatm
Message:

Early ENV to H transformation. 7 octets gained (and no regression I hope)

Location:
trunk/lib
Files:
2 modified

Legend:

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

    r229 r230  
    354354 
    355355    def initialize(r, e, m) #:nodoc: 
    356       e = H[e.to_hash] 
    357356      @status, @method, @env, @headers, @root = 200, m.downcase, e,  
    358357          {'Content-Type'=>'text/html'}, e.SCRIPT_NAME.sub(/\/$/,'') 
     
    653652    def run(r=$stdin,e=ENV) 
    654653      X.M 
    655       k,a=X.D un("/#{e['PATH_INFO']}".gsub(/\/+/,'/')) 
    656       k.new(r,e,(m=e['REQUEST_METHOD']||"GET")).Y.service(*a) 
     654      e = H[e.to_hash] 
     655      k,a=X.D un("/#{e.PATH_INFO}".gsub(/\/+/,'/')) 
     656      k.new(r,e,(m=e.REQUEST_METHOD||"GET")).Y.service(*a) 
    657657    rescue=>x 
    658658      X::ServerError.new(r,e,'get').service(k,m,x) 
  • trunk/lib/camping.rb

    r229 r230  
    1212send(:layout){s}}if /^_/!~a[0].to_s and m.respond_to?:layout;s end;def 
    1313redirect*a;r 302,'','Location'=>URL(*a)end;def r s,b,h={};@status=s;headers. 
    14 merge!h;@body=b end;def to_a;[status,body,headers]end;def initialize r,e,m;e=H[ 
    15 e.to_hash];@status,@method,@env,@headers,@root=200,m.downcase,e,{ 
     14merge!h;@body=b end;def to_a;[status,body,headers]end;def initialize r,e,m;@status,@method,@env,@headers,@root=200,m.downcase,e,{ 
    1615'Content-Type'=>"text/html"},e.SCRIPT_NAME.sub(/\/$/,'');@k=C.kp e.HTTP_COOKIE 
    1716q=C.qsp e.QUERY_STRING;@in=r;if%r|\Amultipart/form-.*boundary=\"?([^\";,]+)|n. 
     
    4342inject((b,z=z,H[])[0]){|h,p|k,v=un(p).split('=',2);h.u k.split(/[\]\[]+/). 
    4443reverse.inject(y||v){|x,i|H[i,x]},&m}end;def kp s;c=qsp(s,';,')end;def 
    45 run r=$stdin,e=ENV;X.M;k,a=X.D un("/#{e['PATH_INFO']}".gsub(/\/+/,'/'));k.new( 
    46 r,e,(m=e['REQUEST_METHOD']||"GET")).Y.service(*a);rescue=>x;X::ServerError.new( 
     44run r=$stdin,e=ENV;X.M;e=H[e.to_hash];k,a=X.D un("/#{e.PATH_INFO}".gsub(/\/+/,'/'));k.new( 
     45r,e,(m=e.REQUEST_METHOD||"GET")).Y.service(*a);rescue=>x;X::ServerError.new( 
    4746r,e,'get').service(k,m,x)end;def method_missing m,c,*a;X.M;k=X.const_get(c). 
    4847new(StringIO.new,H['HTTP_HOST','','SCRIPT_NAME','','HTTP_COOKIE',''],m.to_s);H.