<commit_before>module Strawman
  class Proxy
  end

  class GlypeProxy < Proxy
    def initialize(url)
      @root_url = url
      @valid = false
    end

    def valid?
      @valid
    end

    def validate(verification_url)
      url = proxy_url(verification_url)
      # FIXME: This only validate proxies that don't require a unique session
      # cookie which is retrieved by going to the root page and looking for the
      # s cookie.
      http = EventMachine::HttpRequest.new(url).get :head => {'referer' => @root_url}
      http.callback {
        @valid = true if http.response_header.status == 200
      }

      http
    end

    def to_s
      "<GlypeProxy #{@root_url}>"
    end

    def referer
      @root_url
    end

    def proxy_url(url)
      URI.join @root_url, proxy_path(url)
    end

    def proxy_path(url)
      encoded_url = CGI.escape(Base64.encode64(url[4..-1]))
      "/browse.php?u=#{encoded_url}&f=norefer"
    end
  end
  
  class PhpProxy < Proxy
    def valid?
      false
    end
  end
end<commit_msg>Removed phpproxy for now.<commit_after>module Strawman
  class Proxy
  end

  class GlypeProxy < Proxy
    def initialize(url)
      @root_url = url
      @valid = false
    end

    def valid?
      @valid
    end

    def validate(verification_url)
      url = proxy_url(verification_url)
      # FIXME: This only validate proxies that don't require a unique session
      # cookie which is retrieved by going to the root page and looking for the
      # s cookie.
      http = EventMachine::HttpRequest.new(url).get :head => {'referer' => @root_url}
      http.callback {
        @valid = true if http.response_header.status == 200
      }

      http
    end

    def to_s
      "<GlypeProxy #{@root_url}>"
    end

    def referer
      @root_url
    end

    def proxy_url(url)
      URI.join @root_url, proxy_path(url)
    end

    def proxy_path(url)
      encoded_url = CGI.escape(Base64.encode64(url[4..-1]))
      "/browse.php?u=#{encoded_url}&f=norefer"
    end
  end
end
{'fraction_non_alphanumeric': 0.09045971329708354, 'fraction_numerical': 0.008897676717745922, 'mean_word_length': 2.2910569105691057, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1318600', 'n_tokens_mistral': 697, 'n_tokens_neox': 662, 'n_words': 182}