Thread: [Erlangweb-users] about set cookie
Brought to you by:
etcerlangweb,
paulgray
|
From: AndyChow <diu...@16...> - 2010-04-30 14:54:29
|
hi,
i want to set cookie in client, and add following code in my app, like this:
CookeName = test,
CookieValue = aaaa,
{headers, {cookies, CookeName, CookieValue, "/"}, {redirect, "/websso/register"}}.
after i rebuild and restart app, and view in browser, i get following error in console:
reason: {function_clause,[{e_mod_yaws,add_headers,
[{cookies,test,aaaa,"/"},[]]},
{e_mod_yaws,controller_exec,2},
{e_mod_yaws,with_formatted_error,1},
{e_mod_yaws,out,1},
{yaws_server,deliver_dyn_part,8},
{yaws_server,aloop,3},
{yaws_server,acceptor0,2},
{proc_lib,init_p_do_apply,3}]}
Is i use i wrong? please give me handle, thanks. :)
|
|
From: Michal P. <mic...@er...> - 2010-04-30 14:59:52
|
Hi,
----- "AndyChow" <diu...@16...> wrote:
> hi,
> i want to set cookie in client, and add following code in my app, like
> this:
>
> CookeName = test,
> CookieValue = aaaa,
> {headers, {cookies, CookeName, CookieValue, "/"}, {redirect,
> "/websso/register"}}.
You should probably use {cookie, Name, Val, Path}:
(http://wiki.erlang-web.org/Eptic/ServerTuples)
>
> after i rebuild and restart app, and view in browser, i get following
> error in console:
>
> reason: {function_clause,[{e_mod_yaws,add_headers,
> [{cookies,test,aaaa,"/"},[]]},
> {e_mod_yaws,controller_exec,2},
> {e_mod_yaws,with_formatted_error,1},
> {e_mod_yaws,out,1},
> {yaws_server,deliver_dyn_part,8},
> {yaws_server,aloop,3},
> {yaws_server,acceptor0,2},
> {proc_lib,init_p_do_apply,3}]}
Moreover, deducting from the stack trace of the crash, I think both cookie name
and cookie value should be strings (now they are atoms).
>
> Is i use i wrong? please give me handle, thanks. :)
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Erlangweb-users mailing list
> Erl...@li...
> https://lists.sourceforge.net/lists/listinfo/erlangweb-users
> http://www.erlang-web.org/
Best regards,
Michal Ptaszek
---------------------------------------------------
---------------------------------------------------
WE'VE CHANGED NAMES!
Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.
www.erlang-solutions.com
|
|
From: AndyChow <diu...@16...> - 2010-04-30 15:04:33
|
i change as following:
=====================
CookeName = "test",
CookieValue = "test111",
{headers, {cookie, CookeName, CookieValue}, {redirect, "/websso/register"}}.
same error happened.
=================
reason: {function_clause,[{e_mod_yaws,add_headers,
[{cookie,"test","test111"},[]]},
{e_mod_yaws,controller_exec,2},
{e_mod_yaws,with_formatted_error,1},
{e_mod_yaws,out,1},
{yaws_server,deliver_dyn_part,8},
{yaws_server,aloop,3},
{yaws_server,acceptor0,2},
{proc_lib,init_p_do_apply,3}]}
在2010-04-30,"Michal Ptaszek" <mic...@er...> 写道:
>Hi,
>
>----- "AndyChow" <diu...@16...> wrote:
>
>> hi,
>> i want to set cookie in client, and add following code in my app, like
>> this:
>>
>> CookeName = test,
>> CookieValue = aaaa,
>> {headers, {cookies, CookeName, CookieValue, "/"}, {redirect,
>> "/websso/register"}}.
>
>You should probably use {cookie, Name, Val, Path}:
>(http://wiki.erlang-web.org/Eptic/ServerTuples)
>
>>
>> after i rebuild and restart app, and view in browser, i get following
>> error in console:
>>
>> reason: {function_clause,[{e_mod_yaws,add_headers,
>> [{cookies,test,aaaa,"/"},[]]},
>> {e_mod_yaws,controller_exec,2},
>> {e_mod_yaws,with_formatted_error,1},
>> {e_mod_yaws,out,1},
>> {yaws_server,deliver_dyn_part,8},
>> {yaws_server,aloop,3},
>> {yaws_server,acceptor0,2},
>> {proc_lib,init_p_do_apply,3}]}
>
>Moreover, deducting from the stack trace of the crash, I think both cookie name
>and cookie value should be strings (now they are atoms).
>
>>
>> Is i use i wrong? please give me handle, thanks. :)
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Erlangweb-users mailing list
>> Erl...@li...
>> https://lists.sourceforge.net/lists/listinfo/erlangweb-users
>> http://www.erlang-web.org/
>
>Best regards,
>Michal Ptaszek
>---------------------------------------------------
>
>---------------------------------------------------
>
>WE'VE CHANGED NAMES!
>
>Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.
>
>www.erlang-solutions.com
> |
|
From: Michal P. <mic...@er...> - 2010-04-30 15:09:27
|
----- "AndyChow" <diu...@16...> wrote:
> i change as following:
> =====================
>
> CookeName = "test",
> CookieValue = "test111",
> {headers, {cookie, CookeName, CookieValue}, {redirect,
> "/websso/register"}}.
Oh, I just noticed that: second element of the tuple should be a list:
{headers, [{cookie, CookeName, CookieValue}], {redirect, "/websso/register"}}.
If that does not help - could you please let us know which EW version do
you use?
>
> same error happened.
> =================
> reason: {function_clause,[{e_mod_yaws,add_headers,
> [{cookie,"test","test111"},[]]},
> {e_mod_yaws,controller_exec,2},
> {e_mod_yaws,with_formatted_error,1},
> {e_mod_yaws,out,1},
> {yaws_server,deliver_dyn_part,8},
> {yaws_server,aloop,3},
> {yaws_server,acceptor0,2},
> {proc_lib,init_p_do_apply,3}]}
>
>
>
>
> 在2010-04-30,"Michal Ptaszek" <mic...@er...> 写道:
> >Hi,
> >
> >----- "AndyChow" <diu...@16...> wrote:
> >
> >> hi,
> >> i want to set cookie in client, and add following code in my app,
> like
> >> this:
> >>
> >> CookeName = test,
> >> CookieValue = aaaa,
> >> {headers, {cookies, CookeName, CookieValue, "/"}, {redirect,
> >> "/websso/register"}}.
> >
> >You should probably use {cookie, Name, Val, Path}:
> >(http://wiki.erlang-web.org/Eptic/ServerTuples)
> >
> >>
> >> after i rebuild and restart app, and view in browser, i get
> following
> >> error in console:
> >>
> >> reason: {function_clause,[{e_mod_yaws,add_headers,
> >>
> [{cookies,test,aaaa,"/"},[]]},
> >> {e_mod_yaws,controller_exec,2},
> >> {e_mod_yaws,with_formatted_error,1},
> >> {e_mod_yaws,out,1},
> >> {yaws_server,deliver_dyn_part,8},
> >> {yaws_server,aloop,3},
> >> {yaws_server,acceptor0,2},
> >> {proc_lib,init_p_do_apply,3}]}
> >
> >Moreover, deducting from the stack trace of the crash, I think both
> cookie name
> >and cookie value should be strings (now they are atoms).
> >
> >>
> >> Is i use i wrong? please give me handle, thanks. :)
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >>
> >> _______________________________________________
> >> Erlangweb-users mailing list
> >> Erl...@li...
> >> https://lists.sourceforge.net/lists/listinfo/erlangweb-users
> >> http://www.erlang-web.org/
> >
> >Best regards,
> >Michal Ptaszek
> >---------------------------------------------------
> >
> >---------------------------------------------------
> >
> >WE'VE CHANGED NAMES!
> >
> >Since January 1st 2010 Erlang Training and Consulting Ltd. has become
> ERLANG SOLUTIONS LTD.
> >
> >www.erlang-solutions.com
> >
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Erlangweb-users mailing list
> Erl...@li...
> https://lists.sourceforge.net/lists/listinfo/erlangweb-users
> http://www.erlang-web.org/
Kind regards,
Michal Ptaszek
---------------------------------------------------
---------------------------------------------------
WE'VE CHANGED NAMES!
Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.
www.erlang-solutions.com
|
|
From: AndyChow <diu...@16...> - 2010-04-30 15:14:16
|
hi,
I'm using erlangweb 1.4, i read the wiki page and tutorial pdf about cooke section, the method not same.
在2010-04-30,"Michal Ptaszek" <mic...@er...> 写道:
>
>----- "AndyChow" <diu...@16...> wrote:
>
>> i change as following:
>> =====================
>>
>> CookeName = "test",
>> CookieValue = "test111",
>> {headers, {cookie, CookeName, CookieValue}, {redirect,
>> "/websso/register"}}.
>
>Oh, I just noticed that: second element of the tuple should be a list:
>
>{headers, [{cookie, CookeName, CookieValue}], {redirect, "/websso/register"}}.
>
>If that does not help - could you please let us know which EW version do
>you use?
>
>
>>
>> same error happened.
>> =================
>> reason: {function_clause,[{e_mod_yaws,add_headers,
>> [{cookie,"test","test111"},[]]},
>> {e_mod_yaws,controller_exec,2},
>> {e_mod_yaws,with_formatted_error,1},
>> {e_mod_yaws,out,1},
>> {yaws_server,deliver_dyn_part,8},
>> {yaws_server,aloop,3},
>> {yaws_server,acceptor0,2},
>> {proc_lib,init_p_do_apply,3}]}
>>
>>
>>
>>
>> 在2010-04-30,"Michal Ptaszek" <mic...@er...> 写道:
>> >Hi,
>> >
>> >----- "AndyChow" <diu...@16...> wrote:
>> >
>> >> hi,
>> >> i want to set cookie in client, and add following code in my app,
>> like
>> >> this:
>> >>
>> >> CookeName = test,
>> >> CookieValue = aaaa,
>> >> {headers, {cookies, CookeName, CookieValue, "/"}, {redirect,
>> >> "/websso/register"}}.
>> >
>> >You should probably use {cookie, Name, Val, Path}:
>> >(http://wiki.erlang-web.org/Eptic/ServerTuples)
>> >
>> >>
>> >> after i rebuild and restart app, and view in browser, i get
>> following
>> >> error in console:
>> >>
>> >> reason: {function_clause,[{e_mod_yaws,add_headers,
>> >>
>> [{cookies,test,aaaa,"/"},[]]},
>> >> {e_mod_yaws,controller_exec,2},
>> >> {e_mod_yaws,with_formatted_error,1},
>> >> {e_mod_yaws,out,1},
>> >> {yaws_server,deliver_dyn_part,8},
>> >> {yaws_server,aloop,3},
>> >> {yaws_server,acceptor0,2},
>> >> {proc_lib,init_p_do_apply,3}]}
>> >
>> >Moreover, deducting from the stack trace of the crash, I think both
>> cookie name
>> >and cookie value should be strings (now they are atoms).
>> >
>> >>
>> >> Is i use i wrong? please give me handle, thanks. :)
>> >>
>> >>
>> >>
>> ------------------------------------------------------------------------------
>> >>
>> >> _______________________________________________
>> >> Erlangweb-users mailing list
>> >> Erl...@li...
>> >> https://lists.sourceforge.net/lists/listinfo/erlangweb-users
>> >> http://www.erlang-web.org/
>> >
>> >Best regards,
>> >Michal Ptaszek
>> >---------------------------------------------------
>> >
>> >---------------------------------------------------
>> >
>> >WE'VE CHANGED NAMES!
>> >
>> >Since January 1st 2010 Erlang Training and Consulting Ltd. has become
>> ERLANG SOLUTIONS LTD.
>> >
>> >www.erlang-solutions.com
>> >
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Erlangweb-users mailing list
>> Erl...@li...
>> https://lists.sourceforge.net/lists/listinfo/erlangweb-users
>> http://www.erlang-web.org/
>
>Kind regards,
>Michal Ptaszek
>---------------------------------------------------
>
>---------------------------------------------------
>
>WE'VE CHANGED NAMES!
>
>Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.
>
>www.erlang-solutions.com
> |
|
From: AndyChow <diu...@16...> - 2010-04-30 15:17:15
|
It works!
I want to know when erlangweb next new version will be release?
在2010-04-30,"Michal Ptaszek" <mic...@er...> 写道:
>
>----- "AndyChow" <diu...@16...> wrote:
>
>> i change as following:
>> =====================
>>
>> CookeName = "test",
>> CookieValue = "test111",
>> {headers, {cookie, CookeName, CookieValue}, {redirect,
>> "/websso/register"}}.
>
>Oh, I just noticed that: second element of the tuple should be a list:
>
>{headers, [{cookie, CookeName, CookieValue}], {redirect, "/websso/register"}}.
>
>If that does not help - could you please let us know which EW version do
>you use?
>
>
>>
>> same error happened.
>> =================
>> reason: {function_clause,[{e_mod_yaws,add_headers,
>> [{cookie,"test","test111"},[]]},
>> {e_mod_yaws,controller_exec,2},
>> {e_mod_yaws,with_formatted_error,1},
>> {e_mod_yaws,out,1},
>> {yaws_server,deliver_dyn_part,8},
>> {yaws_server,aloop,3},
>> {yaws_server,acceptor0,2},
>> {proc_lib,init_p_do_apply,3}]}
>>
>>
>>
>>
>> 在2010-04-30,"Michal Ptaszek" <mic...@er...> 写道:
>> >Hi,
>> >
>> >----- "AndyChow" <diu...@16...> wrote:
>> >
>> >> hi,
>> >> i want to set cookie in client, and add following code in my app,
>> like
>> >> this:
>> >>
>> >> CookeName = test,
>> >> CookieValue = aaaa,
>> >> {headers, {cookies, CookeName, CookieValue, "/"}, {redirect,
>> >> "/websso/register"}}.
>> >
>> >You should probably use {cookie, Name, Val, Path}:
>> >(http://wiki.erlang-web.org/Eptic/ServerTuples)
>> >
>> >>
>> >> after i rebuild and restart app, and view in browser, i get
>> following
>> >> error in console:
>> >>
>> >> reason: {function_clause,[{e_mod_yaws,add_headers,
>> >>
>> [{cookies,test,aaaa,"/"},[]]},
>> >> {e_mod_yaws,controller_exec,2},
>> >> {e_mod_yaws,with_formatted_error,1},
>> >> {e_mod_yaws,out,1},
>> >> {yaws_server,deliver_dyn_part,8},
>> >> {yaws_server,aloop,3},
>> >> {yaws_server,acceptor0,2},
>> >> {proc_lib,init_p_do_apply,3}]}
>> >
>> >Moreover, deducting from the stack trace of the crash, I think both
>> cookie name
>> >and cookie value should be strings (now they are atoms).
>> >
>> >>
>> >> Is i use i wrong? please give me handle, thanks. :)
>> >>
>> >>
>> >>
>> ------------------------------------------------------------------------------
>> >>
>> >> _______________________________________________
>> >> Erlangweb-users mailing list
>> >> Erl...@li...
>> >> https://lists.sourceforge.net/lists/listinfo/erlangweb-users
>> >> http://www.erlang-web.org/
>> >
>> >Best regards,
>> >Michal Ptaszek
>> >---------------------------------------------------
>> >
>> >---------------------------------------------------
>> >
>> >WE'VE CHANGED NAMES!
>> >
>> >Since January 1st 2010 Erlang Training and Consulting Ltd. has become
>> ERLANG SOLUTIONS LTD.
>> >
>> >www.erlang-solutions.com
>> >
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Erlangweb-users mailing list
>> Erl...@li...
>> https://lists.sourceforge.net/lists/listinfo/erlangweb-users
>> http://www.erlang-web.org/
>
>Kind regards,
>Michal Ptaszek
>---------------------------------------------------
>
>---------------------------------------------------
>
>WE'VE CHANGED NAMES!
>
>Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.
>
>www.erlang-solutions.com
> |