diff options
author | Stefan Bühler <stbuehler@web.de> | 2015-02-08 19:10:46 +0000 |
---|---|---|
committer | Stefan Bühler <stbuehler@web.de> | 2015-02-08 19:10:46 +0000 |
commit | 91a9a6b3910df8be3936ed0a70b0ac6cbdc10079 (patch) | |
tree | 4b5aecbe0e29aed0c8a1178215c11f73fb069a6c /src/http_chunk.c | |
parent | ad3e93ea96d1cbaab00d07245dbd02f790060f85 (diff) | |
download | lighttpd-git-91a9a6b3910df8be3936ed0a70b0ac6cbdc10079.tar.gz |
rename buffer_append_long_hex to buffer_append_uint_hex
* takes uintmax_t now
* use in http_chunk_append_len
From: Stefan Bühler <stbuehler@web.de>
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2980 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/http_chunk.c')
-rw-r--r-- | src/http_chunk.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/src/http_chunk.c b/src/http_chunk.c index 79e4586a..45db56c4 100644 --- a/src/http_chunk.c +++ b/src/http_chunk.c @@ -21,31 +21,15 @@ #include <string.h> static void http_chunk_append_len(server *srv, connection *con, size_t len) { - size_t i, olen = len, j; buffer *b; force_assert(NULL != srv); b = srv->tmp_chunk_len; - if (len == 0) { - buffer_copy_string_len(b, CONST_STR_LEN("0\r\n")); - } else { - for (i = 0; i < 8 && len; i++) { - len >>= 4; - } - - /* i is the number of hex digits we have, + \r\n */ - buffer_string_prepare_copy(b, i + 2); - - for (j = i-1, len = olen; j+1 > 0; j--) { - b->ptr[j] = (len & 0xf) + (((len & 0xf) <= 9) ? '0' : 'a' - 10); - len >>= 4; - } - buffer_commit(b, i); - - buffer_append_string_len(b, CONST_STR_LEN("\r\n")); - } + buffer_string_set_length(b, 0); + buffer_append_uint_hex(b, len); + buffer_append_string_len(b, CONST_STR_LEN("\r\n")); chunkqueue_append_buffer(con->write_queue, b); } |