HttpQuery: store peer address into query

GitOrigin-RevId: 00b1b116e508ab49d9cabc192f7999069fb3add1
This commit is contained in:
Arseny Smirnov 2020-07-13 15:23:03 +03:00
parent fee05df2cc
commit b5ae6b5b95
4 changed files with 8 additions and 1 deletions

View File

@ -65,7 +65,7 @@ FixNamespaceComments: true
ForEachMacros:
- Q_FOREACH_THIS_LIST_MUST_BE_NON_EMPTY
IncludeBlocks: Preserve
IndentCaseBlocks: false
#IndentCaseBlocks: false
IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: None

View File

@ -33,6 +33,7 @@ HttpConnectionBase::HttpConnectionBase(State state, SocketFd fd, SslStream ssl_s
read_source_ >> read_sink_;
write_source_ >> write_sink_;
}
peer_address_.init_peer_address(fd_).ignore();
}
void HttpConnectionBase::live_event() {
@ -123,6 +124,7 @@ void HttpConnectionBase::loop() {
state_ = State::Write;
LOG(DEBUG) << "Send query to handler";
live_event();
current_query_->peer_address_ = peer_address_;
on_query(std::move(current_query_));
} else {
want_read = true;

View File

@ -38,6 +38,7 @@ class HttpConnectionBase : public Actor {
State state_;
BufferedFd<SocketFd> fd_;
IPAddress peer_address_;
SslStream ssl_stream_;
ByteFlowSource read_source_{&fd_.input_buffer()};

View File

@ -13,6 +13,8 @@
#include "td/utils/Slice.h"
#include "td/utils/StringBuilder.h"
#include "td/utils/port/IPAddress.h"
#include <utility>
namespace td {
@ -33,6 +35,8 @@ class HttpQuery {
vector<HttpFile> files_;
MutableSlice content_;
IPAddress peer_address_;
Slice get_header(Slice key) const;
MutableSlice get_arg(Slice key) const;