Changeset 226

Show
Ignore:
Timestamp:
05/01/07 11:51:13 (2 years ago)
Author:
e.@brainspl.at
Message:

Remove reference to fjson and just depend on the json gem directly, closes #39 . Applied patch to multi_part parsing so uploads with flash 8 and flash 9 will work properly, closes #40

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/README

    r216 r226  
    99mongrel 
    1010erubis 
    11 json or fjson 
     11json 
    1212mime-types 
    1313archive-tar-minitar 
  • trunk/Rakefile

    r225 r226  
    6767  s.add_dependency('erubis') 
    6868  s.add_dependency('json') 
     69  s.add_dependency('mime-types') 
     70  s.add_dependency('archive-tar-minitar')  
    6971  s.required_ruby_version = '>= 1.8.4' 
    7072 
  • trunk/lib/merb.rb

    r225 r226  
    1212require 'erubis' 
    1313require 'logger' 
    14  
    15 begin 
    16   require 'fjson' 
    17 rescue LoadError 
    18   require 'json' 
    19 end 
     14require 'json' 
    2015 
    2116 
  • trunk/lib/merb/mixins/controller_mixin.rb

    r216 r226  
    1919      raise EOFError, "bad content body"  unless status == boundary + EOL 
    2020      rx = /(?:#{EOL})?#{Regexp.quote(boundary,'n')}(#{EOL}|--)/ 
    21        
    2221      loop { 
    2322        head = nil 
    2423        body = '' 
    2524        filename = content_type = name = nil 
    26        
     25        read_size = 0 
    2726        until head && buf =~ rx 
    28           if !head && i = buf.index("\r\n\r\n") 
     27          i = buf.index("\r\n\r\n") 
     28          if( i == nil && read_size == 0 && content_length == 0 ) 
     29            content_length = -1 
     30            break 
     31          end 
     32          if !head && i 
    2933            head = buf.slice!(0, i+2) # First \r\n 
    3034            buf.slice!(0, 2)          # Second \r\n 
    31        
    3235            filename = head[FILENAME_REGEX, 1] 
    3336            content_type = head[CONTENT_TYPE_REGEX, 1] 
    3437            name = head[NAME_REGEX, 1] 
    3538             
    36             if filename && !filename.empty?       
     39            if filename && !filename.empty?     
    3740              body = Tempfile.new(:Merb) 
    3841              body.binmode if defined? body.binmode 
     
    4043            next 
    4144          end 
    42        
     45 
     46           
    4347          # Save the read body part. 
    4448          if head && (boundary_size+4 < buf.size) 
     
    4650          end 
    4751       
    48           c = input.read(bufsize < content_length ? bufsize : content_length) 
    49           raise EOFError, "bad content body"  if c.nil? || c.empty? 
    50           buf << c 
    51           content_length -= c.size 
     52          read_size = bufsize < content_length ? bufsize : content_length 
     53          if( read_size > 0 ) 
     54            c = input.read(read_size) 
     55            raise EOFError, "bad content body"  if c.nil? || c.empty? 
     56            buf << c 
     57            content_length -= c.size 
     58          end 
    5259        end 
    53        
     60 
    5461        # Save the rest. 
    5562        if i = buf.index(rx) 
     
    5966          content_length = -1  if $1 == "--" 
    6067        end 
    61        
     68         
    6269        if filename && !filename.empty?    
    6370          body.rewind 
  • trunk/lib/merb/mixins/view_context_mixin.rb

    r221 r226  
    3333    end 
    3434     
    35     # calls .to_json on data. This will use fjson if installed 
     35    # calls .to_json on data. 
    3636    # so it can be faster than escape_js 
    3737    def js(data)