Skip to content

Commit

Permalink
Fixed URL parsing issue. Bumping up version number
Browse files Browse the repository at this point in the history
  • Loading branch information
cmullaparthi committed Mar 13, 2012
1 parent eb8b62c commit 47cdce0
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Jeroen Koops
Jo?o Lopes
Joseph Wayne Norton
Karol Skocik
Konstantin Nikiforov
Kostis Sagonas
Matthew Reilly
Oscar Hellstr?m
Expand All @@ -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/)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/ibrowse.app.src
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
46 changes: 46 additions & 0 deletions src/ibrowse_lib.erl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

-include("ibrowse.hrl").

-ifdef(EUNIT).
-include_lib("eunit/include/eunit.hrl").
-endif.

-export([
get_trace_status/2,
do_trace/2,
Expand Down Expand Up @@ -191,6 +195,8 @@ parse_url(Url) ->
_ ->
UrlRec#url{host_type = hostname}
end;
#url{} = UrlRec ->
UrlRec;
_ ->
{error, invalid_uri}
end
Expand Down Expand Up @@ -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.