couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [26/31] mochiweb commit: updated refs/heads/upstream to 23dc119
Date Mon, 14 Aug 2017 15:38:36 GMT
Getong erlang 20 fix (#192)

* add 20 compile module option: nowarn_export_all

* crypto:rand_uniform/2 is deprecated and will be removed in a future release; use rand:uniform/1

* add 20

* otp20 cleanup

* remove nowarn_export_all

* correct off by one error in rand_uniform/2


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/commit/ae9c0766
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/tree/ae9c0766
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/diff/ae9c0766

Branch: refs/heads/upstream
Commit: ae9c0766b25af436265a2f88357de2cb96c9e99f
Parents: aacb8f2
Author: Bob Ippolito <bob@redivi.com>
Authored: Sat Aug 12 16:24:01 2017 -0700
Committer: GitHub <noreply@github.com>
Committed: Sat Aug 12 16:24:01 2017 -0700

----------------------------------------------------------------------
 .travis.yml                    |  1 +
 rebar.config                   |  1 +
 src/mochitemp.erl              |  2 +-
 src/mochiweb_html.erl          |  1 -
 src/mochiweb_multipart.erl     |  2 +-
 src/mochiweb_socket_server.erl |  4 ++--
 src/mochiweb_util.erl          |  9 +++++++++
 test/mochiweb_test_util.erl    | 12 ++++++++++--
 8 files changed, 25 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/ae9c0766/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 629003e..60783fd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,6 +3,7 @@ language: erlang
 notifications:
   email: false
 otp_release:
+  - 20.0
   - 19.0
   - 18.3
   - 17.5

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/ae9c0766/rebar.config
----------------------------------------------------------------------
diff --git a/rebar.config b/rebar.config
index 8fc1a14..adc1d78 100644
--- a/rebar.config
+++ b/rebar.config
@@ -3,6 +3,7 @@
             {platform_define, "^R15", 'gen_tcp_r15b_workaround'},
             {platform_define, "^(R14|R15|R16B-)", 'crypto_compatibility'},
             {platform_define, "^(R14|R15|R16B|17)", 'rand_mod_unavailable'},
+            {platform_define, "^(R14|R15|R16B|17)", 'sni_unavailable'},
             {platform_define, "^(R14|R15|R16)", 'map_unavailable'}]}.
 {cover_enabled, true}.
 {eunit_opts, [verbose, {report,{eunit_surefire,[{dir,"."}]}}]}.

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/ae9c0766/src/mochitemp.erl
----------------------------------------------------------------------
diff --git a/src/mochitemp.erl b/src/mochitemp.erl
index bd3c965..fe99cad 100644
--- a/src/mochitemp.erl
+++ b/src/mochitemp.erl
@@ -105,7 +105,7 @@ rngchars(N) ->
     [rngchar() | rngchars(N - 1)].
 
 rngchar() ->
-    rngchar(crypto:rand_uniform(0, tuple_size(?SAFE_CHARS))).
+    rngchar(mochiweb_util:rand_uniform(0, tuple_size(?SAFE_CHARS))).
 
 rngchar(C) ->
     element(1 + C, ?SAFE_CHARS).

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/ae9c0766/src/mochiweb_html.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb_html.erl b/src/mochiweb_html.erl
index 418f24c..df21a8f 100644
--- a/src/mochiweb_html.erl
+++ b/src/mochiweb_html.erl
@@ -23,7 +23,6 @@
 -module(mochiweb_html).
 -export([tokens/1, parse/1, parse_tokens/1, to_tokens/1, escape/1,
          escape_attr/1, to_html/1]).
--compile([export_all]).
 -ifdef(TEST).
 -export([destack/1, destack/2, is_singleton/1]).
 -endif.

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/ae9c0766/src/mochiweb_multipart.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb_multipart.erl b/src/mochiweb_multipart.erl
index 0d02bee..fd75443 100644
--- a/src/mochiweb_multipart.erl
+++ b/src/mochiweb_multipart.erl
@@ -336,7 +336,7 @@ with_socket_server(Transport, ServerFun, ClientFun) ->
         plain ->
             gen_tcp:connect("127.0.0.1", Port, ClientOpts);
         ssl ->
-            ClientOpts1 = [{ssl_imp, new} | ClientOpts],
+            ClientOpts1 = mochiweb_test_util:ssl_client_opts(ClientOpts),
             {ok, SslSocket} = ssl:connect("127.0.0.1", Port, ClientOpts1),
             {ok, {ssl, SslSocket}}
     end,

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/ae9c0766/src/mochiweb_socket_server.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb_socket_server.erl b/src/mochiweb_socket_server.erl
index fd5e382..7a9b0d3 100644
--- a/src/mochiweb_socket_server.erl
+++ b/src/mochiweb_socket_server.erl
@@ -128,7 +128,7 @@ parse_options([{recbuf, RecBuf} | Rest], State) when is_integer(RecBuf)
orelse
     %% and this doubled value is returned by getsockopt(2).
     %%
     %% See: man 7 socket | grep SO_RCVBUF
-    %% 
+    %%
     %% In case undefined is passed instead of the default buffer
     %% size ?RECBUF_SIZE, no size is set and the OS can control it dynamically
     parse_options(Rest, State#mochiweb_socket_server{recbuf=RecBuf});
@@ -200,7 +200,7 @@ init(State=#mochiweb_socket_server{ip=Ip, port=Port, backlog=Backlog,
         {_, _, _, _, _, _, _, _} -> % IPv6
             [inet6, {ip, Ip} | BaseOpts]
     end,
-    OptsBuf=case RecBuf of 
+    OptsBuf=case RecBuf of
         undefined ->
             Opts;
         _ ->

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/ae9c0766/src/mochiweb_util.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb_util.erl b/src/mochiweb_util.erl
index 2acd436..dde2962 100644
--- a/src/mochiweb_util.erl
+++ b/src/mochiweb_util.erl
@@ -15,6 +15,7 @@
 -export([parse_qvalues/1, pick_accepted_encodings/3]).
 -export([make_io/1]).
 -export([normalize_path/1]).
+-export([rand_uniform/2]).
 
 -define(PERCENT, 37).  % $\%
 -define(FULLSTOP, 46). % $\.
@@ -601,6 +602,14 @@ normalize_path("/" ++ Path, "/" ++ _ = Acc) ->
 normalize_path([C|Path], Acc) ->
         normalize_path(Path, [C|Acc]).
 
+-ifdef(rand_mod_unavailable).
+rand_uniform(Start, End) ->
+    crypto:rand_uniform(Start, End).
+-else.
+rand_uniform(Start, End) ->
+    Start + rand:uniform(End - Start) - 1.
+-endif.
+
 %%
 %% Tests
 %%

http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/ae9c0766/test/mochiweb_test_util.erl
----------------------------------------------------------------------
diff --git a/test/mochiweb_test_util.erl b/test/mochiweb_test_util.erl
index a0bf11a..c4feaed 100644
--- a/test/mochiweb_test_util.erl
+++ b/test/mochiweb_test_util.erl
@@ -1,6 +1,6 @@
 -module(mochiweb_test_util).
 -export([with_server/3, client_request/4, sock_fun/2,
-         read_server_headers/1, drain_reply/3]).
+         read_server_headers/1, drain_reply/3, ssl_client_opts/1]).
 -include("mochiweb_test_util.hrl").
 -include_lib("eunit/include/eunit.hrl").
 
@@ -25,6 +25,14 @@ with_server(Transport, ServerFun, ClientFun) ->
     mochiweb_http:stop(Server),
     Res.
 
+-ifdef(sni_unavailable).
+ssl_client_opts(Opts) ->
+  [{ssl_imp, new} | Opts].
+-else.
+ssl_client_opts(Opts) ->
+  [{server_name_indication, disable} | Opts].
+-endif.
+
 sock_fun(Transport, Port) ->
     Opts = [binary, {active, false}, {packet, http}],
     case Transport of
@@ -42,7 +50,7 @@ sock_fun(Transport, Port) ->
                     Socket
             end;
         ssl ->
-            {ok, Socket} = ssl:connect("127.0.0.1", Port, [{ssl_imp, new} | Opts]),
+            {ok, Socket} = ssl:connect("127.0.0.1", Port, ssl_client_opts(Opts)),
             fun (recv) ->
                     ssl:recv(Socket, 0);
                 ({recv, Length}) ->


Mime
View raw message