inets

Erlang: when to perform `inets:start()`?

无人久伴 提交于 2019-12-20 01:46:28
问题 What is the appropriate place for performing inets:start() ? in `applicationname_app' module? in applicationname_sup supervisor module? in a child process hanging from the supervisor?\ someplace else? (I am still struggling with inets:httpd ) Note : the answer cannot be to the tune " use a boot file " , please. 回答1: inets is a "stand-alone" Erlang application; inets:start() is just an alias to application:start(inets) . I guess the answer pretty much depends on how you maintain your code. If

I cannot access to nitrogen/inets server from any machine but the localhost

自作多情 提交于 2019-12-13 17:59:57
问题 Thanks to many discussions in this forum, I found that I should be able to build the application I was planning to do for home usage based on Nitrogen. So I ran into Nitrogen tutorials, Demo and docs, and start to do some tests based on the self contained inets/nitrogen site. Everything was going well until I wanted to try to access my new website from another PC. Of course I had to tune my box first in order to route wan requests to lan... But after a day searching, reading and testing, I am

inets httpd cgi script: How do you retrieve json data?

孤街醉人 提交于 2019-12-13 08:21:34
问题 The cgi scripts that I have tried are unable to retrieve json data from my inets httpd server. In order to retrieve json data in a cgi script, you need to be able to read the body of the request, which will contain something like: {"a": 1, "b": 2} With a perl cgi script, I can read the body of a request like this: my $cgi = CGI->new; my $req_body = $cgi->param('POSTDATA'); I assume that is an indirect way of reading what the server pipes to the script's stdin because in a python cgi script I

inets httpd: server configuration file syntax (proplist_file)

空扰寡人 提交于 2019-12-11 15:49:38
问题 What is the syntax for the configuration file when you start an httpd server like this: inets:start(httpd, [{proplist_file, "./server_config.txt"}] ). The httpd docs say: {proplist_file, path()} If this property is defined, Inets expects to find all other properties defined in this file. And: the properties are to be fetched from a configuration file that can consist of a regular Erlang property list But with this file: server_config.txt: [ {port, 0}, {server_name, "httpd_test"}, {server_root

inets httpc: client example in User's Guide not working

安稳与你 提交于 2019-12-08 10:43:31
问题 I copied the following code from the inets User's Guide: $ erl Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] Eshell V8.2 (abort with ^G) 1> inets:start(). ok 2> httpc:set_options([{proxy, {{"www-proxy.mycompany.com", 8000}, ["localhost"]}}]). ok 3> {ok, {{Version, 200, ReasonPhrase}, Headers, Body}} = httpc:request("http://www.erlang.org"). * exception error: no match of right hand side value {error, {failed_connect, [{to_address,{"www

Elixir - problems with https URLs

大憨熊 提交于 2019-12-01 03:56:32
I'm new to Elixir and Erlang and having some issues with accessing https URLs. I've tried the Elixir-specific HTTPotion and Erlang's :inets module. So from the iex console (Interactive Elixir): With HTTPotion: HTTPotion.start HTTPotion.get("https://api.github.com") With :inets: :inets.start :ssl.start :httpc.request('https://api.github.com') In both cases I get a giant stacktrace that essential says there is a bad match somewhere and that a state machine is terminating. I don't get this when accessing http URLs. What am I missing? Thanks. Edit - here is the error message from HTTPotion: iex(40

How do I do an HTTPS request with Erlang?

故事扮演 提交于 2019-11-30 03:08:16
I tried the inets library but it times out. I don't think it supports HTTPS. I am trying to use ibrowse, but it isn't working. Yasir Arsanukaev This works fine for me: 1> application:start(inets). ok 2> application:start(ssl). ok 3> http:request(head, {"https://example.com", []}, [{ssl,[{verify,0}]}], []). {ok,{{"HTTP/1.1",200,"OK"}, [{"cache-control","max-age=0, proxy-revalidate"}, {"date","Sun, 23 May 2010 00:38:33 GMT"}, {"server","BAIDA/1.0.0"}, {"content-type","text/html; charset=windows-1251"}, {"expires","Sun, 23 May 2010 00:38:33 GMT"}, {"set-cookie", "uid=9041986921274575113; domain=

How do I do an HTTPS request with Erlang?

醉酒当歌 提交于 2019-11-29 00:44:43
问题 I tried the inets library but it times out. I don't think it supports HTTPS. I am trying to use ibrowse, but it isn't working. 回答1: This works fine for me: 1> application:start(inets). ok 2> application:start(ssl). ok 3> http:request(head, {"https://example.com", []}, [{ssl,[{verify,0}]}], []). {ok,{{"HTTP/1.1",200,"OK"}, [{"cache-control","max-age=0, proxy-revalidate"}, {"date","Sun, 23 May 2010 00:38:33 GMT"}, {"server","BAIDA/1.0.0"}, {"content-type","text/html; charset=windows-1251"}, {