Permalink
Browse files

Fixed URL parsing issue. Bumping up version number

  • Loading branch information...
1 parent eb8b62c commit 47cdce000de172e4291911030cbdbf651cc2b817 @cmullaparthi committed Mar 13, 2012
Showing with 56 additions and 2 deletions.
  1. +6 −0 CHANGELOG
  2. +2 −0 CONTRIBUTORS
  3. +1 −1 README.md
  4. +1 −1 src/ibrowse.app.src
  5. +46 −0 src/ibrowse_lib.erl
View
@@ -1,5 +1,11 @@
CONTRIBUTIONS & CHANGE HISTORY
==============================
+13-03-2012 - v3.0.3
+ * Fixes the following issues
+ https://github.com/cmullaparthi/ibrowse/issues/64
+ https://github.com/cmullaparthi/ibrowse/issues/63
+ https://github.com/cmullaparthi/ibrowse/issues/62
+
31-01-2012 - v3.0.2
* Fixed bug when stopping ibrowse. Not service affecting.
View
@@ -21,6 +21,7 @@ Jeroen Koops
Jo?o Lopes
Joseph Wayne Norton
Karol Skocik
+Konstantin Nikiforov
Kostis Sagonas
Matthew Reilly
Oscar Hellstr?m
@@ -37,4 +38,5 @@ Thomas Lindgren
Youn?s Hafri
fholzhauser (https://github.com/fholzhauser/)
hyperthunk (https://github.com/hyperthunk/)
+Mistagrooves (https://github.com/Mistagrooves/)
tholschuh (https://github.com/tholschuh/)
View
@@ -7,7 +7,7 @@ ibrowse is a HTTP client written in erlang.
**Comments to:** chandrashekhar.mullaparthi@gmail.com
-**Current Version:** 3.0.2
+**Current Version:** 3.0.3
**Latest Version:** git://github.com/cmullaparthi/ibrowse.git
View
@@ -1,6 +1,6 @@
{application, ibrowse,
[{description, "HTTP client application"},
- {vsn, "3.0.2"},
+ {vsn, "3.0.3"},
{modules, [ ibrowse,
ibrowse_http_client,
ibrowse_app,
View
@@ -12,6 +12,10 @@
-include("ibrowse.hrl").
+-ifdef(EUNIT).
+-include_lib("eunit/include/eunit.hrl").
+-endif.
+
-export([
get_trace_status/2,
do_trace/2,
@@ -191,6 +195,8 @@ parse_url(Url) ->
_ ->
UrlRec#url{host_type = hostname}
end;
+ #url{} = UrlRec ->
+ UrlRec;
_ ->
{error, invalid_uri}
end
@@ -393,3 +399,43 @@ do_trace(true, Fmt, Args) ->
do_trace(_, _, _) ->
ok.
-endif.
+
+-ifdef(EUNIT).
+
+parse_url_test() ->
+ Urls = [{"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html",
+ #url{abspath = "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html",
+ host = "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210",
+ port = 80, protocol = http, path = "/index.html",
+ host_type = ipv6_address}},
+ {"http://[1080:0:0:0:8:800:200C:417A]/index.html",
+ #url{abspath = "http://[1080:0:0:0:8:800:200C:417A]/index.html",
+ host_type = ipv6_address, port = 80, protocol = http,
+ host = "1080:0:0:0:8:800:200C:417A", path = "/index.html"}},
+ {"http://[3ffe:2a00:100:7031::1]",
+ #url{abspath = "http://[3ffe:2a00:100:7031::1]",
+ host_type = ipv6_address, port = 80, protocol = http,
+ host = "3ffe:2a00:100:7031::1", path = "/"}},
+ {"http://[1080::8:800:200C:417A]/foo",
+ #url{abspath = "http://[1080::8:800:200C:417A]/foo",
+ host_type = ipv6_address, port = 80, protocol = http,
+ host = "1080::8:800:200C:417A", path = "/foo"}},
+ {"http://[::192.9.5.5]/ipng",
+ #url{abspath = "http://[::192.9.5.5]/ipng",
+ host_type = ipv6_address, port = 80, protocol = http,
+ host = "::192.9.5.5", path = "/ipng"}},
+ {"http://[::FFFF:129.144.52.38]:80/index.html",
+ #url{abspath = "http://[::FFFF:129.144.52.38]:80/index.html",
+ host_type = ipv6_address, port = 80, protocol = http,
+ host = "::FFFF:129.144.52.38", path = "/index.html"}},
+ {"http://[2010:836B:4179::836B:4179]",
+ #url{abspath = "http://[2010:836B:4179::836B:4179]",
+ host_type = ipv6_address, port = 80, protocol = http,
+ host = "2010:836B:4179::836B:4179", path = "/"}}
+ ],
+ lists:foreach(
+ fun({Url, Expected_result}) ->
+ ?assertMatch(Expected_result, parse_url(Url))
+ end, Urls).
+
+-endif.

0 comments on commit 47cdce0

Please sign in to comment.