Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


bad dec2hex implementation #20

fdmanana opened this Issue · 7 comments

2 participants


Hi Chandru. The commit message explains it all:


Found this issue when trying to send a chunk with size > 65535 bytes.
Replaced the implementation of dec2hex with a call to io_lib:format/2. Also we don't need the width anywhere in current ibrowse's code (and chunk headers don't apply restrictions to the size's width).



An ever simpler conversion:


Should probably be better to replace the function with a macro like:

-define(dec2hex(N), integer_to_list(N, 16)).

Anyway, it's up to you :)


Just in case:


Hi Filipe,

I like the macro suggestion. integer_to_list/2 seems to be supported only in R14. I want to be able to support older releases of Erlang/OTP as well.

Thanks much!


Hum didn't notice that. I found out about integer_to_list/2 today.
But erldocs says it's in R13B03?

nevertheless the io_lib:format should work even on R12

thanks Chandru


Actually erlang:linteger_to_list/2 exists in R13 (B03 at least) but not integer_to_list/2:

Erlang R13B03 (erts-5.7.4) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.7.4 (abort with ^G)
1> erlang:integer_to_list(128, 16).
2> integer_to_list(128, 16).

** exception error: undefined shell command integer_to_list/2


I tested on R11B-5 just now and you're right. It works even on R9C. That is good enough for me. I'll use this - thanks much.



Fixed in release 2.1.1

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.