Changeset 230
- Timestamp:
- 09/28/2007 16:07:35 (14 months ago)
- Location:
- trunk/lib
- Files:
-
- 2 modified
-
camping-unabridged.rb (modified) (2 diffs)
-
camping.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/camping-unabridged.rb
r229 r230 354 354 355 355 def initialize(r, e, m) #:nodoc: 356 e = H[e.to_hash]357 356 @status, @method, @env, @headers, @root = 200, m.downcase, e, 358 357 {'Content-Type'=>'text/html'}, e.SCRIPT_NAME.sub(/\/$/,'') … … 653 652 def run(r=$stdin,e=ENV) 654 653 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) 657 657 rescue=>x 658 658 X::ServerError.new(r,e,'get').service(k,m,x) -
trunk/lib/camping.rb
r229 r230 12 12 send(:layout){s}}if /^_/!~a[0].to_s and m.respond_to?:layout;s end;def 13 13 redirect*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,{ 14 merge!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,{ 16 15 'Content-Type'=>"text/html"},e.SCRIPT_NAME.sub(/\/$/,'');@k=C.kp e.HTTP_COOKIE 17 16 q=C.qsp e.QUERY_STRING;@in=r;if%r|\Amultipart/form-.*boundary=\"?([^\";,]+)|n. … … 43 42 inject((b,z=z,H[])[0]){|h,p|k,v=un(p).split('=',2);h.u k.split(/[\]\[]+/). 44 43 reverse.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(44 run r=$stdin,e=ENV;X.M;e=H[e.to_hash];k,a=X.D un("/#{e.PATH_INFO}".gsub(/\/+/,'/'));k.new( 45 r,e,(m=e.REQUEST_METHOD||"GET")).Y.service(*a);rescue=>x;X::ServerError.new( 47 46 r,e,'get').service(k,m,x)end;def method_missing m,c,*a;X.M;k=X.const_get(c). 48 47 new(StringIO.new,H['HTTP_HOST','','SCRIPT_NAME','','HTTP_COOKIE',''],m.to_s);H.
