diff --git a/src/nghttp.cc b/src/nghttp.cc index a65aa6eb..08d7ecb8 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -871,7 +871,7 @@ void submit_request(HttpClient *client, std::string content_length_str; if(req->data_prd) { - content_length_str = std::to_string(req->data_length); + content_length_str = util::utos(req->data_length); nv[pos++] = "content-length"; nv[pos++] = content_length_str.c_str(); } diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index 0e24b4eb..5eafdf10 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -680,7 +680,7 @@ void spdy_downstream_eventcb(bufferevent *bev, short events, void *ptr) if(downstream->get_response_state() == Downstream::HEADER_COMPLETE) { upstream->rst_stream(downstream, NGHTTP2_INTERNAL_ERROR); } else { - int status; + unsigned int status; if(events & BEV_EVENT_TIMEOUT) { status = 504; } else { @@ -771,7 +771,8 @@ ssize_t spdy_data_read_callback(nghttp2_session *session, } } // namespace -int Http2Upstream::error_reply(Downstream *downstream, int status_code) +int Http2Upstream::error_reply(Downstream *downstream, + unsigned int status_code) { int rv; auto html = http::create_error_html(status_code); @@ -789,7 +790,7 @@ int Http2Upstream::error_reply(Downstream *downstream, int status_code) data_prd.read_callback = spdy_data_read_callback; auto content_length = util::utos(html.size()); - auto status_code_str = std::to_string(status_code); + auto status_code_str = util::utos(status_code); const char *nv[] = { ":status", status_code_str.c_str(), "content-type", "text/html; charset=UTF-8", @@ -861,8 +862,7 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) auto nv = util::make_unique(nheader * 2 + 4 + 1); size_t hdidx = 0; std::string via_value; - auto response_status = - std::to_string(downstream->get_response_http_status()); + auto response_status = util::utos(downstream->get_response_http_status()); nv[hdidx++] = ":status"; nv[hdidx++] = response_status.c_str(); diff --git a/src/shrpx_http2_upstream.h b/src/shrpx_http2_upstream.h index 19a5dea6..916d7c74 100644 --- a/src/shrpx_http2_upstream.h +++ b/src/shrpx_http2_upstream.h @@ -57,7 +57,7 @@ public: int rst_stream(Downstream *downstream, nghttp2_error_code error_code); int window_update(Downstream *downstream); - int error_reply(Downstream *downstream, int status_code); + int error_reply(Downstream *downstream, unsigned int status_code); virtual void pause_read(IOCtrlReason reason); virtual int resume_read(IOCtrlReason reason, Downstream *downstream);