Problems with ewgi_api:set_header

0 views
Skip to first unread message

Dmitrii Dimandt

unread,
Jul 17, 2009, 7:08:45 AM7/17/09
to ew...@googlegroups.com
Im trying to set a cookie:


run(Ctx) ->
{Header, Value} = {"Set-Cookie", "cookie_name=cookie_val; Version=1"},
ewgi_api:set_header(Header, Value, Ctx).

This fails in ewgi_api:t_enter_header/3 when trying to
gb_trees:enter(K, Pair, T).

The problem _may_ be that gb_tree expects a {Size, Tree} structure and
instead receives a

{ewgi_http_headers,"application/xml,application/xhtml+xml,text/
html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",

"__utma
=111872281.2422505602724073500.1246365803.1246451219.1246907734.3;
__utmz=111872281.1246365803.1.1.utmcsr=(direct)|utmccn=(direct)|
utmcmd=(none)",
"localhost:8000",undefined,
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X
10_5_7; en-us) AppleWebKit/530.19.2 (KHTML, like Gecko) Version/4.0.2
Safari/530.19",
undefined,
{4,
{"accept-encoding",
[{'Accept-Encoding',"gzip, deflate"}],
nil,
{"accept-language", ......


I currently run R12B

Hunter Morris

unread,
Jul 17, 2009, 10:33:05 AM7/17/09
to ew...@googlegroups.com
2009/7/17 Dmitrii Dimandt <dmit...@gmail.com>:

> Im trying to set a cookie:
>
>
> run(Ctx) ->
>        {Header, Value} = {"Set-Cookie", "cookie_name=cookie_val; Version=1"},
> ewgi_api:set_header(Header, Value, Ctx).

I've pushed two changes which should fix that bug. Let me know if you
encounter any more. I will start adding some unit tests to the
ewgi_api module in order to prevent things like this from happening
(yes, I should have been doing that from the start!).

Best,
Hunter

Dmitrii Dimandt

unread,
Jul 17, 2009, 10:50:08 AM7/17/09
to ew...@googlegroups.com
Ahh. The hindsight :)

In actuality, I doubt there are too many mistakes 'cause the code
looks very sound

Thank you for the update! I'll check it out
Reply all
Reply to author
Forward
0 new messages