Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2acaa32
Cleanup: do not re-define _proxy_ssn variable in local
masaori335 Oct 9, 2019
8c758cf
Fix crash in MIMEScanner::append with std::string. See #5587.
SolidWallOfCode Jun 6, 2019
14baab7
Cleanup: VIO
masaori335 Sep 9, 2019
0d94a6b
Dechunk chunked contents on HttpTunnel if client protocol is HTTP/2 o…
masaori335 Sep 2, 2019
cf23f9d
Log H2 priority information
shinrich Sep 23, 2019
093e4e8
Add 100-continue expectation support on H2 connection
masaori335 Nov 20, 2019
1f01c2f
Address performance issue by removing use of read_avail
shinrich Feb 1, 2019
fbaa905
Set END_STREAM flag when write_vio ntodo is 0
masaori335 Nov 19, 2019
3fd64e3
Remove trailing white space from json formatter
masaori335 Jan 30, 2020
1db159d
Perf: Optimize sending HTTP/2 frame
masaori335 Jan 20, 2020
fd3e9ac
Add virtual destructors for Http2TxFrame, Http2FrequencyCounter
Jan 27, 2020
d842e54
Fix PUSH_PROMISE frame payload length
masaori335 Mar 26, 2020
345d163
Fix heap-use-after-free on Http2Stream::destroy()
masaori335 Jan 27, 2020
fab4a0a
Track scheduled events to (read|write)_vio.cont from Http2Stream
masaori335 Sep 13, 2019
0a5741c
Avoid unnecesarry copy on POST request over HTTP/2
masaori335 Sep 26, 2019
19e71d2
Signal VC_EVENT_READ_COMPLETE when ATS received END_STREAM flag
masaori335 Feb 7, 2020
61bb282
Fix crash when H2 client does not set End-of-data bit
shinrich Feb 11, 2020
2ad236b
Update inactive_timeout_at in Http2Stream::signal_read_event()
masaori335 Jan 30, 2020
6c26ba0
Remove unnecesary HttpSM handler call with VC_EVENT_ERROR
masaori335 Jan 31, 2020
b880f23
Another option to fix potential HTTP/2 vio stall
shinrich Feb 10, 2020
160893f
Adjust consume logic in data frame read
shinrich Feb 24, 2020
b002ae5
Remove update to unused variable
shinrich Mar 2, 2020
620ae63
Cleanup trailing whitespaces
masaori335 Mar 31, 2020
f174f08
Fix test_libhttp2 build issue of 8.1.x on Debian/Ubuntu
masaori335 Mar 31, 2020
f62edaf
Fix HTTP/2 AuTest for 8.1.x
masaori335 Apr 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ proxy/hdrs/test_mime
proxy/hdrs/test_Huffmancode
proxy/hdrs/test_XPACK
proxy/http/test_ForwardedConfig
proxy/http2/test_libhttp2
proxy/http2/test_Http2DependencyTree
proxy/http2/test_Http2FrequencyCounter
proxy/http2/test_HPACK
Expand Down
6 changes: 6 additions & 0 deletions doc/admin-guide/logging/formatting.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ Connections and Transactions
.. _sstc:
.. _ccid:
.. _ctid:
.. _ctpw:
.. _ctpd:

The following log fields are used to list various details of connections and
transactions between |TS| proxies and origin servers.
Expand All @@ -204,6 +206,10 @@ ctid Client Request Client Transaction ID, a non-negative number for a transact
which is different for all currently-active transactions on the
same client connection. For client HTTP/2 transactions, this
value is the stream ID for the transaction.
ctpw Client Request Client Transaction Priority Weight, the priority weight for the
underlying HTTP/2 protocol.
ctpd Client Request Client Transaction Priority Dependence, the transaction ID that
the current transaction depends on for HTTP/2 priority logic.
===== ============== ==================================================================

.. _admin-logging-fields-content-type:
Expand Down
4 changes: 2 additions & 2 deletions iocore/eventsystem/I_IOBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -1184,13 +1184,13 @@ class MIOBuffer
*/
struct MIOBufferAccessor {
IOBufferReader *
reader()
reader() const
{
return entry;
}

MIOBuffer *
writer()
writer() const
{
return mbuf;
}
Expand Down
26 changes: 9 additions & 17 deletions iocore/eventsystem/I_VIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,12 @@
#pragma once
#define I_VIO_h

#include "tscore/ink_platform.h"
#include "I_EventSystem.h"
#if !defined(I_IOBuffer_h)
#error "include I_IOBuffer.h"
---include I_IOBuffer.h
#endif
#include "tscore/ink_apidefs.h"
class Continuation;

class Continuation;
class VConnection;
class IOVConnection;
class MIOBuffer;
class ProxyMutex;

/**
Expand Down Expand Up @@ -73,9 +68,12 @@ class ProxyMutex;
class VIO
{
public:
explicit VIO(int aop);
VIO();
~VIO() {}

/** Interface for the VConnection that owns this handle. */
Continuation *get_continuation();
Continuation *get_continuation() const;
void set_continuation(Continuation *cont);

/**
Expand All @@ -102,8 +100,8 @@ class VIO
/////////////////////
void set_writer(MIOBuffer *writer);
void set_reader(IOBufferReader *reader);
MIOBuffer *get_writer();
IOBufferReader *get_reader();
MIOBuffer *get_writer() const;
IOBufferReader *get_reader() const;

/**
Reenable the IO operation.
Expand Down Expand Up @@ -140,10 +138,7 @@ class VIO
inkcoreapi void reenable_re();

void disable();
bool is_disabled();

VIO(int aop);
VIO();
bool is_disabled() const;

enum {
NONE = 0,
Expand All @@ -160,7 +155,6 @@ class VIO
STAT,
};

public:
/**
Continuation to callback.

Expand Down Expand Up @@ -225,5 +219,3 @@ class VIO
private:
bool _disabled = false;
};

#include "I_VConnection.h"
34 changes: 10 additions & 24 deletions iocore/eventsystem/P_VIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,45 @@
TS_INLINE
VIO::VIO(int aop) : cont(nullptr), nbytes(0), ndone(0), op(aop), buffer(), vc_server(nullptr), mutex(nullptr) {}

/////////////////////////////////////////////////////////////
//
// VIO::VIO()
//
/////////////////////////////////////////////////////////////
TS_INLINE
VIO::VIO() : cont(nullptr), nbytes(0), ndone(0), op(VIO::NONE), buffer(), vc_server(nullptr), mutex(nullptr) {}

TS_INLINE Continuation *
VIO::get_continuation()
VIO::get_continuation() const
{
return cont;
}

TS_INLINE void
VIO::set_writer(MIOBuffer *writer)
{
buffer.writer_for(writer);
}

TS_INLINE void
VIO::set_reader(IOBufferReader *reader)
{
buffer.reader_for(reader);
}

TS_INLINE MIOBuffer *
VIO::get_writer()
VIO::get_writer() const
{
return buffer.writer();
}

TS_INLINE IOBufferReader *
VIO::get_reader()
VIO::get_reader() const
{
return (buffer.reader());
}

TS_INLINE int64_t
VIO::ntodo() const
{
return nbytes - ndone;
}

TS_INLINE void
VIO::done()
{
Expand All @@ -75,11 +76,6 @@ VIO::done()
}
}

/////////////////////////////////////////////////////////////
//
// VIO::set_continuation()
//
/////////////////////////////////////////////////////////////
TS_INLINE void
VIO::set_continuation(Continuation *acont)
{
Expand All @@ -96,11 +92,6 @@ VIO::set_continuation(Continuation *acont)
return;
}

/////////////////////////////////////////////////////////////
//
// VIO::reenable()
//
/////////////////////////////////////////////////////////////
TS_INLINE void
VIO::reenable()
{
Expand All @@ -110,11 +101,6 @@ VIO::reenable()
}
}

/////////////////////////////////////////////////////////////
//
// VIO::reenable_re()
//
/////////////////////////////////////////////////////////////
TS_INLINE void
VIO::reenable_re()
{
Expand All @@ -131,7 +117,7 @@ VIO::disable()
}

TS_INLINE bool
VIO::is_disabled()
VIO::is_disabled() const
{
return this->_disabled;
}
12 changes: 12 additions & 0 deletions proxy/ProxyClientTransaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,15 @@ ProxyClientTransaction::set_tx_error_code(ProxyError e)
this->current_reader->t_state.client_info.tx_error_code = e;
}
}

int
ProxyClientTransaction::get_transaction_priority_weight() const
{
return 0;
}

int
ProxyClientTransaction::get_transaction_priority_dependence() const
{
return 0;
}
2 changes: 2 additions & 0 deletions proxy/ProxyClientTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ class ProxyClientTransaction : public VConnection
return current_reader;
}

virtual int get_transaction_priority_weight() const;
virtual int get_transaction_priority_dependence() const;
virtual bool allow_half_open() const = 0;

virtual const char *
Expand Down
23 changes: 21 additions & 2 deletions proxy/hdrs/HTTP.h
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ class HTTPHdr : public MIMEHdr
/// header internals, they must be able to do this.
void mark_target_dirty() const;

HTTPStatus status_get();
HTTPStatus status_get() const;
void status_set(HTTPStatus status);

const char *reason_get(int *length);
Expand All @@ -635,6 +635,7 @@ class HTTPHdr : public MIMEHdr
bool is_cache_control_set(const char *cc_directive_wks);
bool is_pragma_no_cache_set();
bool is_keep_alive_set() const;
bool expect_final_response() const;
HTTPKeepAlive keep_alive_get() const;

protected:
Expand Down Expand Up @@ -1004,6 +1005,24 @@ HTTPHdr::is_keep_alive_set() const
return this->keep_alive_get() == HTTP_KEEPALIVE;
}

/**
Check the status code is informational and expecting final response
- e.g. "100 Continue", "103 Early Hints"

Please note that "101 Switching Protocol" is not included.
*/
inline bool
HTTPHdr::expect_final_response() const
{
switch (this->status_get()) {
case HTTP_STATUS_CONTINUE:
case HTTP_STATUS_EARLY_HINTS:
return true;
default:
return false;
}
}

/*-------------------------------------------------------------------------
-------------------------------------------------------------------------*/

Expand Down Expand Up @@ -1154,7 +1173,7 @@ http_hdr_status_get(HTTPHdrImpl *hh)
-------------------------------------------------------------------------*/

inline HTTPStatus
HTTPHdr::status_get()
HTTPHdr::status_get() const
{
ink_assert(valid());

Expand Down
13 changes: 8 additions & 5 deletions proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,9 @@ HttpSM::attach_client_session(ProxyClientTransaction *client_vc, IOBufferReader
// It seems to be possible that the ua_txn pointer will go stale before log entries for this HTTP transaction are
// generated. Therefore, collect information that may be needed for logging from the ua_txn object at this point.
//
_client_transaction_id = ua_txn->get_transaction_id();
_client_transaction_id = ua_txn->get_transaction_id();
_client_transaction_priority_weight = ua_txn->get_transaction_priority_weight();
_client_transaction_priority_dependence = ua_txn->get_transaction_priority_dependence();
{
auto p = ua_txn->get_parent();

Expand Down Expand Up @@ -2694,6 +2696,8 @@ HttpSM::tunnel_handler_post(int event, void *data)
handle_post_failure();
break;
case HTTP_SM_POST_UA_FAIL:
// Client side failed. Shutdown and go home. No need to communicate back to UA
terminate_sm = true;
break;
case HTTP_SM_POST_SUCCESS:
// It's time to start reading the response
Expand Down Expand Up @@ -3439,9 +3443,7 @@ HttpSM::tunnel_handler_post_ua(int event, HttpTunnelProducer *p)
hsm_release_assert(ua_entry->in_tunnel == true);
if (p->consumer_list.head && p->consumer_list.head->vc_type == HT_TRANSFORM) {
hsm_release_assert(post_transform_info.entry->in_tunnel == true);
} else if (server_entry != nullptr) {
hsm_release_assert(server_entry->in_tunnel == true);
}
} // server side may have completed before the user agent side, so it may no longer be in tunnel
break;

case VC_EVENT_READ_COMPLETE:
Expand Down Expand Up @@ -3578,7 +3580,8 @@ HttpSM::tunnel_handler_post_server(int event, HttpTunnelConsumer *c)

case VC_EVENT_WRITE_COMPLETE:
// Completed successfully
c->write_success = true;
c->write_success = true;
server_entry->in_tunnel = false;
break;
default:
ink_release_assert(0);
Expand Down
13 changes: 13 additions & 0 deletions proxy/http/HttpSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,22 @@ class HttpSM : public Continuation
return _client_transaction_id;
}

int
client_transaction_priority_weight() const
{
return _client_transaction_priority_weight;
}

int
client_transaction_priority_dependence() const
{
return _client_transaction_priority_dependence;
}

private:
PostDataBuffers _postbuf;
int _client_connection_id = -1, _client_transaction_id = -1;
int _client_transaction_priority_weight = -1, _client_transaction_priority_dependence = -1;
};

// Function to get the cache_sm object - YTS Team, yamsat
Expand Down
17 changes: 9 additions & 8 deletions proxy/http/HttpTransact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6833,10 +6833,10 @@ HttpTransact::handle_response_keep_alive_headers(State *s, HTTPVersion ver, HTTP
// to the client to keep the connection alive.
// Insert a Transfer-Encoding header in the response if necessary.

// check that the client is HTTP 1.1 and the conf allows chunking or the client
// protocol unchunks before returning to the user agent (i.e. is http/2)
if (s->client_info.http_version == HTTPVersion(1, 1) && s->txn_conf->chunking_enabled == 1 &&
s->state_machine->ua_txn->is_chunked_encoding_supported() &&
// check that the client protocol is HTTP/1.1 and the conf allows chunking or
// the client protocol doesn't support chunked transfer coding (i.e. HTTP/1.0, HTTP/2)
if (s->state_machine->ua_txn && s->state_machine->ua_txn->is_chunked_encoding_supported() &&
s->client_info.http_version == HTTPVersion(1, 1) && s->txn_conf->chunking_enabled == 1 &&
// if we're not sending a body, don't set a chunked header regardless of server response
!is_response_body_precluded(s->hdr_info.client_response.status_get(), s->method) &&
// we do not need chunked encoding for internal error messages
Expand Down Expand Up @@ -6868,12 +6868,13 @@ HttpTransact::handle_response_keep_alive_headers(State *s, HTTPVersion ver, HTTP
}

// Close the connection if client_info is not keep-alive.
// Otherwise, if we cannot trust the content length and the client process chunked encoding, we will close the connection
// unless we are going to use chunked encoding or the client issued
// a PUSH request
// Otherwise, if we cannot trust the content length, we will close the connection
// unless we are going to use chunked encoding on HTTP/1.1 or the client issued a PUSH request
if (s->client_info.keep_alive != HTTP_KEEPALIVE) {
ka_action = KA_DISABLED;
} else if (s->hdr_info.trust_response_cl == false && s->state_machine->ua_txn->is_chunked_encoding_supported() &&
} else if (s->state_machine->client_protocol && (strncmp(s->state_machine->client_protocol, "http/2", 6) == 0)) {
ka_action = KA_CONNECTION;
} else if (s->hdr_info.trust_response_cl == false &&
!(s->client_info.receive_chunked_response == true ||
(s->method == HTTP_WKSIDX_PUSH && s->client_info.keep_alive == HTTP_KEEPALIVE))) {
ka_action = KA_CLOSE;
Expand Down
Loading