Erlang/OTP Forums

Author Message

<  Erlang patches mailing list  ~  various fixes for http_uri.erl

Guest
Posted: Mon Jul 03, 2006 10:07 am Reply with quote
Guest
Hello.

Here are several improvements for URI parsing in http_uri.erl. First is
for handling data not only in US ASCII charset:

*** Before:
> http_uri:parse("http://www.google.com/search?hl=en&q=a%D1%85%D1%83%D0%B9&btnG=Google+Search").
{error,no_query}

*** After:
> http_uri:parse("http://www.google.com/search?hl=en&q=a%D1%85%D1%83%D0%B9&btnG=Google+Search").
{http,"www.google.com",
80,
"/search",
"?hl=en&q=a%d1%85%d1%83%d0%b9&btnG=Google+Search"}

Second allows to handle arbitary data:

*** Before:
> http_uri:parse("http://www.google.com/search?hl=en&q=%25%25").
=ERROR REPORT==== 3-Jul-2006::13:19:49 ===
Error in process <0.32.0> with exit value: {function_clause,[{http_uri,hex2dec,"%"},{http_uri,scan_query,2},{http_uri,scan_pathquery,1},{http_uri,parse_http,2},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}

** exited: {function_clause,[{http_uri,hex2dec,"%"},
{http_uri,scan_query,2},
{http_uri,scan_pathquery,1},
{http_uri,parse_http,2},
{erl_eval,do_apply,5},
{shell,exprs,6},
{shell,eval_loop,3}]} **

> http_uri:parse("http://www.google.com/search?hl=en&q=%foo").

=ERROR REPORT==== 3-Jul-2006::13:28:33 ===
Error in process <0.39.0> with exit value: {function_clause,[{http_uri,hex2dec,"o"},{http_uri,scan_query,2},{http_uri,scan_pathquery,1},{http_uri,parse_http,2},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}

** exited: {function_clause,[{http_uri,hex2dec,"o"},
{http_uri,scan_query,2},
{http_uri,scan_pathquery,1},
{http_uri,parse_http,2},
{erl_eval,do_apply,5},
{shell,exprs,6},
{shell,eval_loop,3}]} **


*** After:
> http_uri:parse("http://www.google.com/search?hl=en&q=%25%25").
{http,"www.google.com",80,"/search","?hl=en&q=%25%25"}

> http_uri:parse("http://www.google.com/search?hl=en&q=%foo").
{http,"www.google.com",80,"/search","?hl=en&q=%25foo"}




Post generated from www.trapexit.org

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