【发布时间】:2019-07-27 05:14:49
【问题描述】:
代理原来没有设置,显示为未定义:
httpc:get_options(all).
{ok,[{proxy,{undefined,[]}},
{https_proxy,{undefined,[]}},
{pipeline_timeout,0},
{max_pipeline_length,2},
{max_keep_alive_length,5},
{keep_alive_timeout,120000},
{max_sessions,2},
{cookies,disabled},
{verbose,false},
{ipfamily,inet},
{ip,default},
{port,default},
{socket_opts,[]},
{unix_socket,undefined}]}
我可以毫无问题地设置代理选项:
httpc:set_options([{proxy, {{"www-proxy.mycompany.com", 8000},["localhost"]}}]).
当不需要代理时,如何将代理取消设置为未定义(或没有代理)?我试过了:
httpc:set_options([{proxy,{undefined, []}}]).
But it throws an exception:
** exception throw: {error,{bad_option,proxy,{undefined,[]}}}
in function httpc:bad_option/2 (httpc.erl, line 1102)
in call from httpc:validate_options/2 (httpc.erl, line 932)
in call from httpc:validate_options/1 (httpc.erl, line 922)
in call from httpc:set_options/2 (httpc.erl, line 236)
我做错了什么?
【问题讨论】:
-
好吧,我想我总是可以使用:exit(whereis(httpc_manager), kill)。并让主管做一个新的。但希望有办法清除代理信息而不必诉诸于杀死它。
标签: erlang http-proxy httpc