Search Results

Search found 8 results on 1 pages for 'inets'.

Page 1/1 | 1 

  • Handling Erlang inets http client errors

    - by Justin
    I have an Erlang app which makes a large number of http calls to external sites using inets, using the code below case http:request(get, {Url, []}, [{autoredirect, false}], []) of {ok, {{_, Code, _}, _, Body}}-> case Code of 200 -> HandlerFn(Body); _ -> {error, io:format("~s returned HTTP ~p", [Broker, Code])} end; Response -> %% block to handle unexpected responses from inets {error, io:format("~s returned ~p", [Broker, Response])} end. There is an explicit block to handle anything strange inets might return [Response]. Despite this, I still get what look like inets error reports dumped to the console [sample below]. What am I doing wrong here ? Do I need to configure some kind of inets error handler elsewhere ? Thanks. -- =ERROR REPORT==== 24-Apr-2010::06:49:47 === ** Generic server <0.6618.0 terminating ** Last message in was {connect_and_send, {request,#Ref<0.0.0.139358,<0.6613.0,0,http, {"***",80}, "****************", [],get, {http_request_h,undefined,"keep-alive", undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,undefined,"news.bbc.co.uk", undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,[],undefined,undefined,undefined, undefined,"0",undefined,undefined, undefined,undefined,undefined,undefined,[]}, {[],[]}, {http_options,"HTTP/1.1",infinity,false,[], undefined,false,infinity}, "*******************", [],none,[],1272088179114,undefined,undefined}} * When Server state == {state, {request,#Ref<0.0.0.139358,<0.6613.0,0,http, {"********",80}, "***************", [],get, {http_request_h,undefined,"keep-alive", undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,undefined,"news.bbc.co.uk", undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,[],undefined,undefined, undefined,undefined,"0",undefined, undefined,undefined,undefined,undefined, undefined,[]}, {[],[]}, {http_options,"HTTP/1.1",infinity,false,[], undefined,false,infinity}, "**********************", [],none,[],1272088179114,undefined,undefined}, undefined,undefined,undefined,undefined,undefined, {[],[]}, {[],[]}, undefined,[],nolimit,nolimit, {options, {undefined,[]}, 0,2,5,120000,2,disabled,false,inet,default, default,[]}, {timers,[],undefined}, httpc_manager,undefined} ** Reason for termination == ** {error,{connect_failed,{#Ref<0.0.0.139358,{error,nxdomain}}}} =ERROR REPORT==== 24-Apr-2010::06:49:47 === HTTPC-MANAGER handler (<0.6618.0, started) failed to connect and/or send request #Ref<0.0.0.139358 Result: {error,{connect_failed,{#Ref<0.0.0.139358,{error,nxdomain}}}}

    Read the article

  • Erlang: HTTP Accept Header with Inets

    - by Ted Karmel
    I am trying to do the equivalent of the following curl command : curl -H "Accept: text/plain" http://127.0.0.1:8033/stats I tried with an Inets simple http request. But, it isn't processed. How can I specify in Inets (or some other Erlang http client for that matter) the accept header requirement?

    Read the article

  • Erlang: HTTP GET Parameters with Inets

    - by Ted Karmel
    The following post indicates how to make a simple get http request with Erlang's inets. exploring erlang's http client Sometimes, URLs have GET parameters: http://example.net/item?parameter1=12&parameter2=1431&parameter3=8765 Besides including the parameters in the URL itself, is there a way to create variables and then send them with the request? Example appreciated.

    Read the article

  • Starting inets/httpd with custom application

    - by williamstw
    I've got a module that I'm attempting to turn into a proper OTP application. Currently, the module has start/0 which starts a genserver which supplies configuration data read from a config file. It then calls inets:start(httpd,config:lookup(httpd_conf)). I gather that I need to move the starting of these out into the .app file's (application list) but I'm not sure how to get my config data into the inets:start function (or pass in httpd)? Thanks, --tim

    Read the article

  • Erlang : Handling HTTP Requests and Responses

    - by Ted Karmel
    What is the best erlang library for processing http requests and responses from within an erlang application? I have taken a look at inets but as a standalone application, it seems more like a replacement for curl. I would like to access external APIs from within the erlang application so would need to parse responses and be able to make subsequent requests with cookies generated from the response.

    Read the article

  • How to mark dependencies as solved?

    - by joo
    On my Ubuntu I needed to install a newer version of erlang. Then I installed rabbitmq-server with dpkg --force-depends -i rabbitmq-server_2.1.1-1_all.deb And everything worked fine, till... Now I have the following problem when doing an apt-get install or upgrade: rabbitmq-server: Depends: erlang-base (>= 1:12.b.3) but it is not installable or erlang-base-hipe (>= 1:12.b.3) but it is not installable Depends: erlang-ssl which is a virtual package. or erlang-nox (< 1:13.b-dfsg1-1) but it is not installable Depends: erlang-os-mon which is a virtual package. or erlang-nox (< 1:13.b-dfsg1-1) but it is not installable Depends: erlang-mnesia which is a virtual package. or erlang-nox (< 1:13.b-dfsg1-1) but it is not installable Depends: erlang-inets which is a virtual package. or erlang-nox (< 1:13.b-dfsg1-1) but it is not installable Remove the following packages: rabbitmq-server Score is 121 Accept this solution? [Y/n/q/?] What command tells apt to resolve dependencies without removing the package? Thanks a lot in advance...

    Read the article

  • Erlang OTP application design

    - by Toby Hede
    I am struggling a little coming to grips with the OTP development model as I convert some code into an OTP app. I am essentially making a web crawler and I just don't quite know where to put the code that does the actual work. I have a supervisor which starts my worker: -behaviour(supervisor). -define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}). init(_Args) -> Children = [ ?CHILD(crawler, worker) ], RestartStrategy = {one_for_one, 0, 1}, {ok, {RestartStrategy, Children}}. In this design, the Crawler Worker is then responsible for doing the actual work: -behaviour(gen_server). start_link() -> gen_server:start_link(?MODULE, [], []). init([]) -> inets:start(), httpc:set_options([{verbose_mode,true}]), % gen_server:cast(?MODULE, crawl), % ok = do_crawl(), {ok, #state{}}. do_crawl() -> % crawl! ok. handle_cast(crawl}, State) -> ok = do_crawl(), {noreply, State}; do_crawl spawns a fairly large number of processes and requests that handle the work of crawling via http. Question, ultimately is: where should the actual crawl happen? As can be seen above I have been experimenting with different ways of triggering the actual work, but still missing some concept essential for grokering the way things fit together. Note: some of the OTP plumbing is left out for brevity - the plumbing is all there and the system all hangs together

    Read the article

1