Changeset 2695 for lang/ruby/ssb

Show
Ignore:
Timestamp:
12/07/07 07:38:52 (13 months ago)
Author:
coji
Message:

lang/ruby/ssb: remove trashes

Location:
lang/ruby/ssb/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/ssb/trunk/libs/ssb.rb

    r2694 r2695  
    126126 
    127127    def output_template(request_uri, response, term, page, source, res) 
    128       ssb = '' 
    129128      tpl_file = 'ssb.rhtml' 
    130129      template = open(File.join(SSB::CONFIG[:template_dir], tpl_file)).read.untaint 
     
    136135      end 
    137136 
    138       page = SSB::Application.filter_html(page, request_uri, term, ssb, response) 
     137      page = SSB::Application.filter_html(page, request_uri, term, response) 
    139138 
    140139      page = NKF::nkf('-w', page) 
     
    158157    end 
    159158 
    160     def self.filter_html(page, request_uri, term, ssb, response) 
     159    def self.filter_html(page, request_uri, term, response) 
    161160      # <?xml をけす。IEのバグ対応 
    162161      page.gsub!(/<\?([^\?]+)\?>/) { |s| 
     
    173172              %Q! #{tag}="#{$2}"#{$3} target="_top" >! 
    174173            elsif $2.index('/') == 0 
    175               %Q! #{tag}="./#{ssb}?ssb_q=#{CGI.escape(('http://' + request_uri.host + ':' + request_uri.port.to_s + $2).to_s)}"#{$3} target="_top" >! 
     174              %Q! #{tag}="./?ssb_q=#{CGI.escape(('http://' + request_uri.host + ':' + request_uri.port.to_s + $2).to_s)}"#{$3} target="_top" >! 
    176175            else 
    177               %Q! #{tag}="./#{ssb}?ssb_q=#{CGI.escape((request_uri + $2).to_s)}"#{$3} target="_top" >! 
     176              %Q! #{tag}="./?ssb_q=#{CGI.escape((request_uri + $2).to_s)}"#{$3} target="_top" >! 
    178177            end 
    179178          when 'action' 
  • lang/ruby/ssb/trunk/libs/ssb/request.rb

    r2653 r2695  
    2424 
    2525    def initialize(method, in_query, in_cookie) 
    26       case method.upcase 
    27       when 'POST', 'GET' 
    28         @method = method.upcase.dup.untaint 
    29       else 
    30         raise ArgumentError 
    31       end 
     26      @method = method 
    3227      @term = SSB::Misc.load_terminal_info(in_cookie) 
    3328      @http_proxy = ENV['HTTP_PROXY'] || ENV['http_proxy'] 
     
    4540      uri = URI.parse(http_proxy) 
    4641      user, pass = uri.userinfo.split(/:/) if uri.userinfo 
    47       address = uri.host.untaint 
    48       port = uri.port.untaint 
     42      address = uri.host 
     43      port = uri.port 
    4944      Net::HTTP.Proxy(address, port, user, pass) 
    5045    end 
     
    6156      response = nil 
    6257 
    63       http = http_class(@http_proxy).new(@uri.host.untaint, @uri.port.untaint) 
     58      http = http_class(@http_proxy).new(@uri.host, @uri.port) 
    6459      if @uri.scheme == 'https' 
    6560        http.use_ssl = true 
     
    9085      in_query.each do |key,value| 
    9186        value = value.to_s unless value.instance_of?(String) 
    92         if key == 'ssb_q'           # request URI 
     87        if key == 'ssb_q'       # request URI 
    9388          uri_base = value.dup.untaint 
    9489        else                    # passing parameters 
    95           uri_params[NKF::nkf('-s', key)] = CGI.escape(NKF::nkf('-s', value)) 
     90          uri_params[NKF::nkf('-s', key.dup.untaint)] = CGI.escape(NKF::nkf('-s', value.dup.untaint)) 
    9691        end 
    9792      end 
  • lang/ruby/ssb/trunk/test/filter_test.rb

    r2404 r2695  
    2020  test 'filter a tag' do 
    2121    assert_equal( 
    22         SSB::Application.filter_html("<a href='/bar'>foo</a>", URI.parse('http://example.com/foo'), Term.new(SSB::KtaiSpec::CARRIER_DOCOMO), '', ''), 
     22        SSB::Application.filter_html("<a href='/bar'>foo</a>", URI.parse('http://example.com/foo'), Term.new(SSB::KtaiSpec::CARRIER_DOCOMO), ''), 
    2323        %Q{<a href=\"./?ssb_q=http%3A%2F%2Fexample.com%3A80%2Fbar\" target=\"_top\" >foo</a>} 
    2424    ) 
  • lang/ruby/ssb/trunk/test/request_test.rb

    r2404 r2695  
    6363  end 
    6464 
    65   test 'request_uri_should_not_taintedx' do 
    66     assert(!@request.uri.tainted?) 
     65  test 'request_uri_should_not_tainted' do 
     66    assert(!@request.uri.to_s.tainted?) 
    6767  end 
    6868