Erlang/OTP Forums

Author Message

<  Erlang  ~  SSL using ibrowse or httpc

argvader
Posted: Wed Jun 09, 2010 9:36 pm Reply with quote
Joined: 09 Jun 2010 Posts: 4
I am working on an http client which has to connect to a service over SSL. I have tried using http and ibrowse but I cannot get it to work. I am sure I am missing a simple step. Below is a snippet of my code:

Code:

postData(Data) ->
   ssl:start(),
   ibrowse:start(),
   Reply = ibrowse:send_req(?HOST,
                      [{'Content-Type', 'application/x-www-form-urlencoded'}],
                      post,
                      Data,
                      [{is_ssl, true},
                       {basic_auth, {"blah,blah"}},
                       {ssl_options,
                        [{verify, 0},
                        {cacertfile, "c:\\temp\\certs.pem"}]}]),
   case Reply of
      {ok, "200", Headers, Body } ->
         io:format("CTB Headers : ~p~n",[Headers]),
         io:format("CTB BODY : ~p~n", [Body]);
      {error, Error} ->
         io:format("ERROR : ~p~n", [Error])
   end,
   ibrowse:stop().


I get the following error:

ERROR : {'EXIT',
{no_ssl_server,
{gen_server,call,
View user's profile Send private message
Michal Ptaszek
Posted: Thu Jun 10, 2010 10:39 am Reply with quote
User Joined: 01 May 2008 Posts: 35 Location: Krakow
Could you please provide us a value returned from ssl:start() function?

It looks like ssl application has not started properly.
View user's profile Send private message
argvader
Posted: Thu Jun 10, 2010 2:15 pm Reply with quote
Joined: 09 Jun 2010 Posts: 4
when i type ssl:start().

I get 'ok' as the response.

If i type application:start(ssl) after that it says its already started

I thought it might be something with openssl because I am on windows but i recently downloaded it and put the bin and lib on my path.
View user's profile Send private message
argvader
Posted: Thu Jun 10, 2010 3:16 pm Reply with quote
Joined: 09 Jun 2010 Posts: 4
I am past the no_ssl_server error and now i get the following:


Code:

{function_clause,[{gen_tcp,send,
                              [{sslsocket,160,<0.164.0>},
                               ["POST"," ",
                                "/ctbservice/content?collection_id=csprodperf&validate=false&mode=update&docidattr=contentid",
                                " ","HTTP/1.1","\r\n",
                                [["Content-Type",": ",
                                  "application/x-www-form-urlencoded","\r\n"],
                                 ["Authorization",": ",
                                  ["Basic ","Y29udGVudG1ncjpjb250ZW50bWdy"],
                                  "\r\n"],
                                 ["Host",": ","Chrome 1.0","\r\n"]],
                                "\r\n"]]},
                     {ibrowse_http_client,send_req_1,8},
                     {gen_server,handle_msg,5},
                     {proc_lib,init_p_do_apply,3}]}
View user's profile Send private message
cmullaparthi
Posted: Thu Jun 10, 2010 9:57 pm Reply with quote
Joined: 10 Jun 2010 Posts: 1
argvader wrote:
I am past the no_ssl_server error and now i get the following:


Code:

{function_clause,[{gen_tcp,send,
                              [{sslsocket,160,<0.164.0>},
                               ["POST"," ",
                                "/ctbservice/content?collection_id=csprodperf&validate=false&mode=update&docidattr=contentid",
                                " ","HTTP/1.1","\r\n",
                                [["Content-Type",": ",
                                  "application/x-www-form-urlencoded","\r\n"],
                                 ["Authorization",": ",
                                  ["Basic ","Y29udGVudG1ncjpjb250ZW50bWdy"],
                                  "\r\n"],
                                 ["Host",": ","Chrome 1.0","\r\n"]],
                                "\r\n"]]},
                     {ibrowse_http_client,send_req_1,8},
                     {gen_server,handle_msg,5},
                     {proc_lib,init_p_do_apply,3}]}


This was a bug in ibrowse. I've pushed a patch to github. Please update your installation and try again.

cheers
Chandru
View user's profile Send private message
argvader
Posted: Fri Jun 11, 2010 5:48 pm Reply with quote
Joined: 09 Jun 2010 Posts: 4
I downloaded the patch you submitted and its all working. Thanks a lot.
View user's profile Send private message
yeti
Posted: Sat Sep 01, 2012 6:03 am Reply with quote
User Joined: 01 Sep 2012 Posts: 17 Location: fgf
discount designer *beep* come in different shapes and styles such as The HOBO, Satchel, and Tote bag. With all these shapes and sizes you are sure to find the one that suits you best, whether it be a celebrity fashion discount *beep* or a tote bag. Fashion bags come in a variety of sizes so you are able to put what you need in your bag or even just carry it around for that great new look.
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
dongdongwu
Posted: Thu Sep 20, 2012 2:08 am Reply with quote
User Joined: 19 Sep 2012 Posts: 236
His good friend Diane said: "Christian Louboutin Men Shoes was a magician, he make shoes is immediately put his female people with legs and advantage. He understands women wanted to do and can make them into beautiful Cinderella." Madonna often in its concert wearing Christian louboutin high heels , and some famous superstar like Angelina jolie, mariah Carey, beyonce Knowles, the famous Japanese singer YaYouMei Hamasaki helps Christian Louboutin Men Shoes set up its powerful position. The youngest customers will count Tom cruise's daughter sully cruz. Louboutin made for only a pair of handmade Christian Louboutin high heel Shoes! Want to be more fashion? Put on Christian Louboutin Outlet !
Candy colors of the chalaza high-heeled shoes with lolita type allure, set full finely gem blue "neon shoes" is to need to use "sexy" to describe. Each pair are worth careful appreciation of lithe and graceful fairy ludaoli, what kind of most let you move?Christian Louboutin Men Shoes that one brush red is always cannot resist the temptation, Christian Louboutin men outlet continue to use the days of high 8cm above slender heel proclaim the sexy and luxuriant. The bowknot on black pointed high-heeled shoes with sharp rivet concomitant, wild python met enchanting color printing grain, It is that pairs of high-heeled shoes lets Carrie more feminine flavour. Like Christian Louboutin for men her word.
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum