Class: HttpCrawler::Proxy::TestProxyApi::Client

Inherits:
Object
  • Object
show all
Includes:
Client, Client
Defined in:
lib/http_crawler/proxy/test_proxy_api/client.rb

Instance Attribute Summary

Attributes included from Client

#http, #uri

Instance Method Summary collapse

Methods included from Client

#add_error_url, #auto_proxy=, for, for_module, #header, #init_header, #init_http, #initialize, #update_header, #update_proxy, #validation_page?

Instance Method Details

#get_proxy(parameter = {}) ⇒ Object



24
25
26
27
# File 'lib/http_crawler/proxy/test_proxy_api/client.rb', line 24

def get_proxy(parameter = {})
  r = http.get_fetch("/api/get_proxy")
  r.extend(HttpCrawler::Proxy::TestProxyApi::Response::GetProxy)
end

#init_uriObject

这是个错误代码 http类不能唯一,如果唯一的话高并发情况下会导致前一个请求未结束,下一个请求已经在发送,会出现冲突class << self

def new(*args)
  @client ||= super(*args)
end

end



19
20
21
# File 'lib/http_crawler/proxy/test_proxy_api/client.rb', line 19

def init_uri
  @uri = URI("http://127.0.0.1:1111/")
end