# File lib/client.rb, line 508
  def self.put_object(url, token=nil, container=nil, name=nil, contents=nil,
                 content_length=nil, etag=nil, chunk_size=nil,
                 content_type=nil, headers={}, http_conn=nil, proxy=nil)
    chunk_size ||= 65536
    if not http_conn
      http_conn = http_connection(url)
    end
    parsed = http_conn[0].clone
    conn = http_conn[1]
                  
    parsed.path += "/#{quote(container)}" if container
    parsed.path += "/#{quote(name)}" if name
    headers['x-auth-token'] = token if token
    headers['etag'] = etag if etag
    if content_length != nil
      headers['content-length'] = content_length.to_s
    else
      headers.each do |k,v|
        if k.downcase == 'content-length'
          content_length = v.to_i
        end
      end
    end
    headers['content-type'] = content_type if content_type
    headers['content-length'] = '0' if not contents  
    if contents.respond_to? :read
      request = Net::HTTP::Put.new(parsed.request_uri, headers)
      chunked = ChunkedConnectionWrapper.new(contents, chunk_size)
      if content_length == nil
        request['Transfer-Encoding'] = 'chunked'
        request.delete('content-length')
      end
      request.body_stream = chunked
      resp = conn.start do |http|
        http.request(request)
      end
    else
      conn.start if not conn.started?
      resp = conn.put(parsed.request_uri, contents, headers)
    end
    if resp.code.to_i < 200 or resp.code.to_i > 300
      raise ClientException.new('Object PUT failed', :http_scheme=>parsed.scheme,
                  :http_host=>conn.address, :http_port=>conn.port,
                  :http_path=>parsed.path, :http_status=>resp.code,
                  :http_reason=>resp.message)
    end
    resp.header['etag']
  end