@@ -83,7 +83,7 @@ void HttpSession::HandleRequest() {
8383 ResponseUnprocessableEntity (" Without content type." );
8484 return ;
8585 } else {
86- content_type_ = req_[" Content-Type" ].to_string ( );
86+ content_type_. assign (req_[ " Content-Type " ]. begin (), req_[" Content-Type" ].size () );
8787 }
8888
8989 switch (req_.method ()) {
@@ -111,7 +111,7 @@ void HttpSession::HandlePostRequest() {
111111 peer->OnLocalSdp ([self = shared_from_this ()](const std::string &peer_id,
112112 const std::string &sdp,
113113 const std::string &type) {
114- std::string host = self->req_ [" Host" ].to_string ( );
114+ std::string host (self-> req_ [ " Host " ]. begin (), self->req_ [" Host" ].size () );
115115 std::string location = " https://" + host + " /resource/" + peer_id;
116116 self->res_ = std::make_shared<http::response<http::string_body>>(http::status::created,
117117 self->req_ .version ());
@@ -131,7 +131,7 @@ void HttpSession::HandlePostRequest() {
131131}
132132
133133void HttpSession::HandlePatchRequest () {
134- auto routes = ParseRoutes (req_.target ().to_string ( ));
134+ auto routes = ParseRoutes (std::string ( req_.target ().data (), req_. target (). size () ));
135135
136136 if (content_type_ != " application/trickle-ice-sdpfrag" ||
137137 (routes.size () < 2 && routes[0 ] != " resource" )) {
@@ -143,7 +143,7 @@ void HttpSession::HandlePatchRequest() {
143143 ResponsePreconditionFailed ();
144144 return ;
145145 }
146- auto if_match = req_[" If-Match" ].to_string ( );
146+ auto if_match = std::string ( req_[" If-Match" ].data (), req_[ " If-Match " ]. size () );
147147
148148 auto peer_id = routes[1 ];
149149 auto peer = http_service_->GetPeer (peer_id);
@@ -193,7 +193,7 @@ void HttpSession::HandleOptionsRequest() {
193193}
194194
195195void HttpSession::HandleDeleteRequest () {
196- auto routes = ParseRoutes (req_.target ().to_string ( ));
196+ auto routes = ParseRoutes (std::string ( req_.target ().data (), req_. target (). size () ));
197197
198198 if (routes.size () < 2 && routes[0 ] != " resource" ) {
199199 ResponseUnprocessableEntity (" The resource is not appplicable." );
0 commit comments