Minor HTTP-proxy fixes.
GitOrigin-RevId: 03d1ca116707c358cd1a414046222236ee2d09b4
This commit is contained in:
parent
25826e253d
commit
c19ab1adbc
@ -70,6 +70,7 @@ void Transport::write(BufferWriter &&message, bool quick_ack) {
|
|||||||
auto r_head = hc.finish();
|
auto r_head = hc.finish();
|
||||||
CHECK(r_head.is_ok());
|
CHECK(r_head.is_ok());
|
||||||
Slice src = r_head.ok();
|
Slice src = r_head.ok();
|
||||||
|
// LOG(DEBUG) << src;
|
||||||
MutableSlice dst = message.prepare_prepend();
|
MutableSlice dst = message.prepare_prepend();
|
||||||
CHECK(dst.size() >= src.size()) << dst.size() << " >= " << src.size();
|
CHECK(dst.size() >= src.size()) << dst.size() << " >= " << src.size();
|
||||||
std::memcpy(dst.end() - src.size(), src.begin(), src.size());
|
std::memcpy(dst.end() - src.size(), src.begin(), src.size());
|
||||||
|
@ -631,7 +631,8 @@ void ConnectionCreator::disable_proxy_impl() {
|
|||||||
|
|
||||||
void ConnectionCreator::on_proxy_changed(bool from_db) {
|
void ConnectionCreator::on_proxy_changed(bool from_db) {
|
||||||
send_closure(G()->state_manager(), &StateManager::on_proxy,
|
send_closure(G()->state_manager(), &StateManager::on_proxy,
|
||||||
active_proxy_id_ != 0 && proxies_[active_proxy_id_].type() != Proxy::Type::Mtproto);
|
active_proxy_id_ != 0 && proxies_[active_proxy_id_].type() != Proxy::Type::Mtproto &&
|
||||||
|
proxies_[active_proxy_id_].type() != Proxy::Type::HttpCaching);
|
||||||
|
|
||||||
if (!from_db) {
|
if (!from_db) {
|
||||||
for (auto &child : children_) {
|
for (auto &child : children_) {
|
||||||
@ -989,6 +990,7 @@ void ConnectionCreator::client_loop(ClientInfo &client) {
|
|||||||
extra.stat);
|
extra.stat);
|
||||||
|
|
||||||
if (proxy.use_socks5_proxy() || proxy.use_http_tcp_proxy()) {
|
if (proxy.use_socks5_proxy() || proxy.use_http_tcp_proxy()) {
|
||||||
|
VLOG(connections) << "client_loop: create new transparent proxy connection " << extra.debug_str;
|
||||||
class Callback : public TransparentProxy::Callback {
|
class Callback : public TransparentProxy::Callback {
|
||||||
public:
|
public:
|
||||||
explicit Callback(Promise<ConnectionData> promise, std::unique_ptr<detail::StatsCallback> stats_callback)
|
explicit Callback(Promise<ConnectionData> promise, std::unique_ptr<detail::StatsCallback> stats_callback)
|
||||||
@ -1036,6 +1038,8 @@ void ConnectionCreator::client_loop(ClientInfo &client) {
|
|||||||
create_reference(token))};
|
create_reference(token))};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
VLOG(connections) << "client_loop: create new direct connection " << extra.debug_str;
|
||||||
|
|
||||||
ConnectionData data;
|
ConnectionData data;
|
||||||
data.socket_fd = std::move(socket_fd);
|
data.socket_fd = std::move(socket_fd);
|
||||||
data.stats_callback = std::move(stats_callback);
|
data.stats_callback = std::move(stats_callback);
|
||||||
|
@ -84,7 +84,7 @@ vector<DcOptionsSet::ConnectionInfo> DcOptionsSet::find_all_connections(DcId dc_
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (only_http) {
|
if (only_http) {
|
||||||
if (!option.is_obfuscated_tcp_only() && !option.is_static()) {
|
if (!option.is_obfuscated_tcp_only() && !option.is_static() && (prefer_ipv6 || !option.is_ipv6())) {
|
||||||
info.use_http = true;
|
info.use_http = true;
|
||||||
info.stat = &option_stat->http_stat;
|
info.stat = &option_stat->http_stat;
|
||||||
options.push_back(info);
|
options.push_back(info);
|
||||||
|
@ -666,6 +666,7 @@ Status HttpReader::parse_head(MutableSlice head) {
|
|||||||
query_->code_ = to_integer<int32>(parser.read_till(' '));
|
query_->code_ = to_integer<int32>(parser.read_till(' '));
|
||||||
parser.skip(' ');
|
parser.skip(' ');
|
||||||
query_->reason_ = parser.read_till('\r');
|
query_->reason_ = parser.read_till('\r');
|
||||||
|
LOG(DEBUG) << "Receive HTTP response " << query_->code_ << " " << query_->reason_;
|
||||||
} else {
|
} else {
|
||||||
auto url_version = parser.read_till('\r');
|
auto url_version = parser.read_till('\r');
|
||||||
auto space_pos = url_version.rfind(' ');
|
auto space_pos = url_version.rfind(' ');
|
||||||
|
Reference in New Issue
Block a user