Spaces:
Sleeping
Sleeping
Dmitry Beresnev commited on
Commit ·
53e9f39
1
Parent(s): a4ee76d
fix proxied response in llm manager
Browse files- cpp/llm_manager.cpp +5 -11
cpp/llm_manager.cpp
CHANGED
|
@@ -306,7 +306,6 @@ struct ProxiedGetResult {
|
|
| 306 |
int status = 500;
|
| 307 |
std::string body;
|
| 308 |
std::string content_type = "text/plain; charset=utf-8";
|
| 309 |
-
std::string content_encoding;
|
| 310 |
};
|
| 311 |
|
| 312 |
static ProxiedGetResult forward_get_to_worker(const WorkerInfo &worker,
|
|
@@ -317,10 +316,11 @@ static ProxiedGetResult forward_get_to_worker(const WorkerInfo &worker,
|
|
| 317 |
auto const results = resolver.resolve("127.0.0.1", std::to_string(worker.port));
|
| 318 |
stream.connect(results);
|
| 319 |
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
|
|
|
| 324 |
|
| 325 |
beast::flat_buffer buffer;
|
| 326 |
http::response<http::string_body> res;
|
|
@@ -333,9 +333,6 @@ static ProxiedGetResult forward_get_to_worker(const WorkerInfo &worker,
|
|
| 333 |
if (res.base().find(http::field::content_type) != res.base().end()) {
|
| 334 |
out.content_type = res.base()[http::field::content_type].to_string();
|
| 335 |
}
|
| 336 |
-
if (res.base().find(http::field::content_encoding) != res.base().end()) {
|
| 337 |
-
out.content_encoding = res.base()[http::field::content_encoding].to_string();
|
| 338 |
-
}
|
| 339 |
return out;
|
| 340 |
}
|
| 341 |
|
|
@@ -436,9 +433,6 @@ http::response<http::string_body> handle_request(
|
|
| 436 |
http::response<http::string_body> res{
|
| 437 |
static_cast<http::status>(upstream.status), req.version()};
|
| 438 |
res.set(http::field::content_type, upstream.content_type);
|
| 439 |
-
if (!upstream.content_encoding.empty()) {
|
| 440 |
-
res.set(http::field::content_encoding, upstream.content_encoding);
|
| 441 |
-
}
|
| 442 |
res.set(http::field::server, "llm-manager");
|
| 443 |
res.keep_alive(req.keep_alive());
|
| 444 |
res.body() = upstream.body;
|
|
|
|
| 306 |
int status = 500;
|
| 307 |
std::string body;
|
| 308 |
std::string content_type = "text/plain; charset=utf-8";
|
|
|
|
| 309 |
};
|
| 310 |
|
| 311 |
static ProxiedGetResult forward_get_to_worker(const WorkerInfo &worker,
|
|
|
|
| 316 |
auto const results = resolver.resolve("127.0.0.1", std::to_string(worker.port));
|
| 317 |
stream.connect(results);
|
| 318 |
|
| 319 |
+
http::request<http::string_body> req{http::verb::get, target, 11};
|
| 320 |
+
req.set(http::field::host, "127.0.0.1");
|
| 321 |
+
req.set(http::field::user_agent, "llm-manager");
|
| 322 |
+
req.set(http::field::accept_encoding, "identity");
|
| 323 |
+
http::write(stream, req);
|
| 324 |
|
| 325 |
beast::flat_buffer buffer;
|
| 326 |
http::response<http::string_body> res;
|
|
|
|
| 333 |
if (res.base().find(http::field::content_type) != res.base().end()) {
|
| 334 |
out.content_type = res.base()[http::field::content_type].to_string();
|
| 335 |
}
|
|
|
|
|
|
|
|
|
|
| 336 |
return out;
|
| 337 |
}
|
| 338 |
|
|
|
|
| 433 |
http::response<http::string_body> res{
|
| 434 |
static_cast<http::status>(upstream.status), req.version()};
|
| 435 |
res.set(http::field::content_type, upstream.content_type);
|
|
|
|
|
|
|
|
|
|
| 436 |
res.set(http::field::server, "llm-manager");
|
| 437 |
res.keep_alive(req.keep_alive());
|
| 438 |
res.body() = upstream.body;
|