You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2023/09/13 22:34:15 UTC
[trafficserver] branch 9.2.x updated (e3919273fe -> cd76df8955)
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a change to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
from e3919273fe tls_verify4: Use traffic_manager for config reload (#10391)
new f6df310175 Don't set port number as part of hostname (#10386)
new cd76df8955 Preserve unmapped url regardless of need for remapping (#10304)
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
proxy/http/HttpSM.cc | 38 ++++++++++++++++++++++++++++++++++----
proxy/http/HttpTransact.cc | 4 ++++
2 files changed, 38 insertions(+), 4 deletions(-)
[trafficserver] 02/02: Preserve unmapped url regardless of need for remapping (#10304)
Posted by zw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit cd76df895587017fb2072806487984ca72bfbebf
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Tue Sep 12 08:14:04 2023 +0900
Preserve unmapped url regardless of need for remapping (#10304)
(cherry picked from commit 195275111242eff00428b595a78984a5a0c7c39a)
---
proxy/http/HttpSM.cc | 3 ---
proxy/http/HttpTransact.cc | 4 ++++
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index d63aeb1b87..6b3ef19a28 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -4224,9 +4224,6 @@ HttpSM::do_remap_request(bool run_inline)
check_sni_host();
- // Preserve effective url before remap
- t_state.unmapped_url.create(t_state.hdr_info.client_request.url_get()->m_heap);
- t_state.unmapped_url.copy(t_state.hdr_info.client_request.url_get());
// Depending on a variety of factors the HOST field may or may not have been promoted to the
// client request URL. The unmapped URL should always have that promotion done. If the HOST field
// is not already there, promote it only in the unmapped_url. This avoids breaking any logic that
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index b1095be30d..ea7b54c751 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -951,6 +951,10 @@ HttpTransact::HandleBlindTunnel(State *s)
void
HttpTransact::StartRemapRequest(State *s)
{
+ // Preserve effective url before remap, regardless of actual need for remap
+ s->unmapped_url.create(s->hdr_info.client_request.url_get()->m_heap);
+ s->unmapped_url.copy(s->hdr_info.client_request.url_get());
+
if (s->api_skip_all_remapping) {
TxnDebug("http_trans", "API request to skip remapping");
[trafficserver] 01/02: Don't set port number as part of hostname (#10386)
Posted by zw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit f6df3101753ae91bd53646d565ace2bd13957b13
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Tue Sep 12 00:42:07 2023 +0900
Don't set port number as part of hostname (#10386)
* Don't set port number as part of hostname
* Initialize host_len with 0
(cherry picked from commit 943358110b061a03a84b863260c5d99f29ff9c69)
---
proxy/http/HttpSM.cc | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 66dd58c135..d63aeb1b87 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -4234,10 +4234,43 @@ HttpSM::do_remap_request(bool run_inline)
if (!t_state.unmapped_url.m_url_impl->m_ptr_host) {
MIMEField *host_field = t_state.hdr_info.client_request.field_find(MIME_FIELD_HOST, MIME_LEN_HOST);
if (host_field) {
- int host_len;
+ int host_len = 0;
const char *host_name = host_field->value_get(&host_len);
if (host_name && host_len) {
+ int port = -1;
+ // Host header can contain port number, and if it does we need to set host and port separately to unmapped_url.
+ // If header value starts with '[', the value must contain an IPv6 address, and it may contain a port number as well.
+ if (host_name[0] == '[') { // IPv6
+ host_name = host_name + 1; // Skip '['
+ host_len--;
+ // If header value ends with ']', the value must only contain an IPv6 address (no port number).
+ if (host_name[host_len - 1] == ']') { // Without port number
+ host_len--; // Exclude ']'
+ } else { // With port number
+ for (int idx = host_len - 1; idx > 0; idx--) {
+ if (host_name[idx] == ':') {
+ port = ink_atoi(host_name + idx + 1, host_len - (idx + 1));
+ host_len = idx;
+ break;
+ }
+ }
+ }
+ } else { // Anything else (Hostname or IPv4 address)
+ // If the value contains ':' where it does not have IPv6 address, there must be port number
+ if (const char *colon = static_cast<const char *>(memchr(host_name, ':', host_len));
+ colon == nullptr) { // Without port number
+ // Nothing to adjust. Entire value should be used as hostname.
+ } else { // With port number
+ port = ink_atoi(colon + 1, host_len - ((colon + 1) - host_name));
+ host_len = colon - host_name;
+ }
+ }
+
+ // Set values
t_state.unmapped_url.host_set(host_name, host_len);
+ if (port >= 0) {
+ t_state.unmapped_url.port_set(port);
+ }
}
}
}