Spaces:
Sleeping
Sleeping
Dmitry Beresnev commited on
Commit ·
53e9f39
1
Parent(s): a4ee76d
fix proxied response in llm manager
Browse files305 unmodified lines3063073083093103113124 unmodified lines3173183193203213223233243253266 unmodified lines33333433533633733833934034194 unmodified lines436437438439440441442443444305 unmodified linesint status = 500;std::string body;std::string content_type = "text/plain; charset=utf-8";std::string content_encoding;};static ProxiedGetResult forward_get_to_worker(const WorkerInfo &worker,4 unmodified linesauto const results = resolver.resolve("127.0.0.1", std::to_string(worker.port));stream.connect(results);http::request<http::string_body> req{http::verb::get, target, 11};req.set(http::field::host, "127.0.0.1");req.set(http::field::user_agent, "llm-manager");http::write(stream, req);beast::flat_buffer buffer;http::response<http::string_body> res;6 unmodified linesif (res.base().find(http::field::content_type) != res.base().end()) {out.content_type = res.base()[http::field::content_type].to_string();}if (res.base().find(http::field::content_encoding) != res.base().end()) {out.content_encoding = res.base()[http::field::content_encoding].to_string();}return out;}94 unmodified lineshttp::response<http::string_body> res{static_cast<http::status>(upstream.status), req.version()};res.set(http::field::content_type, upstream.content_type);if (!upstream.content_encoding.empty()) {res.set(http::field::content_encoding, upstream.content_encoding);}res.set(http::field::server, "llm-manager");res.keep_alive(req.keep_alive());res.body() = upstream.body;305 unmodified lines3063073083093103114 unmodified lines3163173183193203213223233243253266 unmodified lines33333433533633733894 unmodified lines433434435436437438305 unmodified linesint status = 500;std::string body;std::string content_type = "text/plain; charset=utf-8";};static ProxiedGetResult forward_get_to_worker(const WorkerInfo &worker,4 unmodified linesauto const results = resolver.resolve("127.0.0.1", std::to_string(worker.port));stream.connect(results);http::request<http::string_body> req{http::verb::get, target, 11};req.set(http::field::host, "127.0.0.1");req.set(http::field::user_agent, "llm-manager");req.set(http::field::accept_encoding, "identity");http::write(stream, req);beast::flat_buffer buffer;http::response<http::string_body> res;6 unmodified linesif (res.base().find(http::field::content_type) != res.base().end()) {out.content_type = res.base()[http::field::content_type].to_string();}return out;}94 unmodified lineshttp::response<http::string_body> res{static_cast<http::status>(upstream.status), req.version()};res.set(http::field::content_type, upstream.content_type);res.set(http::field::server, "llm-manager");res.keep_alive(req.keep_alive());res.body() = upstream.body;
cpp/llm_manager.cpp+5-11