public Method

HTTPUtils.parse_form_data(io, boundary)

There's no documentation for this item.

Source Code

# File webrick/httputils.rb, line 314
def parse_form_data(io, boundary)
  boundary_regexp = /\A--#{boundary}(--)?#{CRLF}\z/
  form_data = Hash.new
  return form_data unless io
  data = nil
  io.each{|line|
    if boundary_regexp =~ line
      if data
        data.chop!
        key = data.name
        if form_data.has_key?(key)
          form_data[key].append_data(data)
        else
          form_data[key] = data 
        end
      end
      data = FormData.new
      next
    else
      if data
        data << line
      end
    end
  }
  return form_data
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.