@@ -107,6 +107,7 @@ namespace network {
107
107
// //response_promise_.set_value(v2::response());
108
108
// //write_request(ec);
109
109
// });
110
+ response_promise_.set_value (response ());
110
111
}
111
112
112
113
void client::impl::write_request (const boost::system::error_code &ec) {
@@ -166,49 +167,50 @@ namespace network {
166
167
request_stream << req;
167
168
if (!request_stream) {
168
169
// set error
169
- response_promise_.set_value (response ());
170
- return res;
171
170
}
172
171
173
- auto it = std::find_if (std::begin (req.headers ()), std::end (req.headers ()),
174
- [] (const std::pair<uri::string_type, uri::string_type> &header) {
175
- return (boost::iequals (header.first , " host" ));
176
- });
177
- if (it == std::end (req.headers ())) {
178
- // set error
179
- response_promise_.set_value (response ());
180
- return res;
181
- }
172
+ response_promise_.set_value (response ());
182
173
183
- uri_builder builder;
184
- builder
185
- .authority (it->second )
186
- ;
187
-
188
- auto auth = builder.uri ();
189
- auto host = auth.host ()?
190
- uri::string_type (std::begin (*auth.host ()), std::end (*auth.host ())) : uri::string_type ();
191
- auto port = auth.port <std::uint16_t >()? *auth.port <std::uint16_t >() : 80 ;
192
-
193
- resolver_.async_resolve (host, port,
194
- [=](const boost::system::error_code &ec,
195
- tcp::resolver::iterator endpoint_iterator) {
196
- if (ec) {
197
- if (endpoint_iterator == tcp::resolver::iterator ()) {
198
- response_promise_.set_exception (
199
- std::make_exception_ptr (
200
- connection_error (client_error::host_not_found)));
201
- return ;
202
- }
203
-
204
- response_promise_.set_exception (
205
- std::make_exception_ptr (
206
- boost::system::system_error (ec)));
207
- return ;
208
- }
209
-
210
- connect (ec, endpoint_iterator);
211
- });
174
+
175
+ // auto it = std::find_if(std::begin(req.headers()), std::end(req.headers()),
176
+ // [] (const std::pair<uri::string_type, uri::string_type> &header) {
177
+ // return (boost::iequals(header.first, "host"));
178
+ // });
179
+ // if (it == std::end(req.headers())) {
180
+ // // set error
181
+ // response_promise_.set_value(response());
182
+ // return res;
183
+ // }
184
+ //
185
+ // uri_builder builder;
186
+ // builder
187
+ // .authority(it->second)
188
+ // ;
189
+ //
190
+ // auto auth = builder.uri();
191
+ // auto host = auth.host()?
192
+ // uri::string_type(std::begin(*auth.host()), std::end(*auth.host())) : uri::string_type();
193
+ // auto port = auth.port<std::uint16_t>()? *auth.port<std::uint16_t>() : 80;
194
+ //
195
+ // resolver_.async_resolve(host, port,
196
+ // [=](const boost::system::error_code &ec,
197
+ // tcp::resolver::iterator endpoint_iterator) {
198
+ // if (ec) {
199
+ // if (endpoint_iterator == tcp::resolver::iterator()) {
200
+ // response_promise_.set_exception(
201
+ // std::make_exception_ptr(
202
+ // connection_error(client_error::host_not_found)));
203
+ // return;
204
+ // }
205
+ //
206
+ // response_promise_.set_exception(
207
+ // std::make_exception_ptr(
208
+ // boost::system::system_error(ec)));
209
+ // return;
210
+ // }
211
+ //
212
+ // connect(ec, endpoint_iterator);
213
+ // });
212
214
213
215
return res;
214
216
}
0 commit comments