From ef0a3d6e6cfec529c646e190d36e702bbeb81f2f Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 21 Mar 2018 23:20:33 -0700 Subject: [PATCH] ircd::http: Write fixed sized integer for chunk size. --- include/ircd/http.h | 4 ++-- ircd/http.cc | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/ircd/http.h b/include/ircd/http.h index 0a7fe483b..7d98cba52 100644 --- a/include/ircd/http.h +++ b/include/ircd/http.h @@ -32,8 +32,8 @@ namespace ircd::http void write(window_buffer &, const vector_view &); size_t serialized(const vector_view &); std::string strung(const vector_view &); - void writechunk(window_buffer &, const size_t &size); - const_buffer writechunk(const mutable_buffer &, const size_t &size); + void writechunk(window_buffer &, const uint32_t &size); + const_buffer writechunk(const mutable_buffer &, const uint32_t &size); } // diff --git a/ircd/http.cc b/ircd/http.cc index a34572b47..5f5d6477f 100644 --- a/ircd/http.cc +++ b/ircd/http.cc @@ -598,7 +598,7 @@ ircd::http::parser::content_length(const string_view &str) ircd::const_buffer ircd::http::writechunk(const mutable_buffer &buf, - const size_t &chunk_size) + const uint32_t &chunk_size) { window_buffer wb{buf}; writechunk(wb, chunk_size); @@ -607,11 +607,11 @@ ircd::http::writechunk(const mutable_buffer &buf, void ircd::http::writechunk(window_buffer &buf, - const size_t &chunk_size) + const uint32_t &chunk_size) { writeline(buf, [&chunk_size](const mutable_buffer &out) -> size_t { - return ::snprintf(data(out), size(out), "%lx", chunk_size); + return ::snprintf(data(out), size(out), "%08x", chunk_size); }); }