Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Handle a bug in unicode module in releases R14B04 and previous
The code points 16#FFFE and 16#FFFF (not assigned but valid) are considered as
invalid in releases R14B04 and previous. So for these releases, the websockets
testsuite always failed. This commit worked around the bug.

It was fixed in OTP with the commit 34db767655:
   erlang/otp@34db767655
  • Loading branch information
Christopher Faulet committed Jul 7, 2014
1 parent 26badd6 commit 5f04abe
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
23 changes: 22 additions & 1 deletion configure.ac
Expand Up @@ -184,11 +184,32 @@ ERLANG_CHECK_ERTS
ERLANG_CHECK_RELEASE

dnl Check for bitstring support, introduced in R12B-5 (ERTS 5.6.5)
AC_MSG_CHECKING([for bits support])
AX_COMPARE_VERSION([${ERLANG_ERTS_VER}], [ge], [5.6.5],
[bits_support="yes"],
[bits_support="no"])
AM_CONDITIONAL(BITS_SUPPORT, [test "x${bits_support}" = "xyes"])
AC_MSG_RESULT([${bits_support}])

BITS_SUPPORT=false
if test "x${bits_support}" = "xyes"; then
BITS_SUPPORT=true
fi
AM_CONDITIONAL(BITS_SUPPORT, [test "x${BITS_SUPPORT}" = "xtrue"])
AC_SUBST(BITS_SUPPORT)

dnl Unicode module was buggy for R14B04 and previous (ERTS <= 5.8.5)
AC_MSG_CHECKING([for buggy unicode module])
AX_COMPARE_VERSION([${ERLANG_ERTS_VER}], [le], [5.8.5],
[bad_unicode="yes"],
[bad_unicode="no"])
AC_MSG_RESULT([${bad_unicode}])

HAVE_BAD_UNICODE=false
if test "x${bad_unicode}" = "xyes"; then
HAVE_BAD_UNICODE=true
fi
AM_CONDITIONAL(HAVE_BAD_UNICODE, [test "x$HAVE_BAD_UNICODE" = "xtrue"])
AC_SUBST(HAVE_BAD_UNICODE)

dnl Determine directories for installation.
if test "x${prefix}" != "xNONE" -a "x${ERLANG_INSTALL_LIB_DIR}" = "x"; then
Expand Down
4 changes: 4 additions & 0 deletions include.mk
Expand Up @@ -24,6 +24,10 @@ ifeq ($(HAVE_INET_PARSE_STRICT_ADDRESS),true)
ERLC_GENERIC_FLAGS += -DHAVE_INET_PARSE_STRICT_ADDRESS
endif

ifeq ($(HAVE_BAD_UNICODE),true)
ERLC_GENERIC_FLAGS += -DHAVE_BAD_UNICODE
endif

# Local Variables:
# tab-width: 8
# End:
13 changes: 12 additions & 1 deletion test/t10/app_test.erl
Expand Up @@ -976,6 +976,12 @@ test_advanced_unfragmented_valid_utf8_text(BlockSz) ->
do_test_unfragmented_valid_utf8("/websockets_autobahn_endpoint.yaws",
BlockSz).

-ifdef(HAVE_BAD_UNICODE).
-define(BAD_UNICODE, true).
-else.
-define(BAD_UNICODE, false).
-endif.

do_test_unfragmented_valid_utf8(WSPath, BlockSz) ->
Key = "dGhlIHNhbXBsZSBub25jZQ==",

Expand Down Expand Up @@ -1004,7 +1010,12 @@ do_test_unfragmented_valid_utf8(WSPath, BlockSz) ->
Fun(<<16#f0,16#90,16#80,16#80>>),
Fun(<<16#7f>>),
Fun(<<16#df,16#bf>>),
Fun(<<16#ef,16#bf,16#bf>>),

case ?BAD_UNICODE of
true -> ok;
false -> Fun(<<16#ef,16#bf,16#bf>>)
end,

Fun(<<16#f4,16#8f,16#bf,16#bf>>),
Fun(<<16#ed,16#9f,16#bf>>),
Fun(<<16#ee,16#80,16#80>>),
Expand Down

0 comments on commit 5f04abe

Please sign in to comment.