aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-10-26 15:24:50 -0300
committerSebastian <sebasjm@gmail.com>2023-10-26 15:24:50 -0300
commit4a0075084de92d34b83a88b2bcd69568c7b2bf7e (patch)
treeb03e5dc271bb24ecf6d4487527992d1bada6e666
parent089e995b319e238c79d25c61b0c7036c7e83539d (diff)
use x-forward-port in case base url is not on standard portlast-gnunet-0.20-compatible
-rw-r--r--src/backend/taler-merchant-httpd_helper.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/backend/taler-merchant-httpd_helper.c b/src/backend/taler-merchant-httpd_helper.c
index 3e525245..2e06a432 100644
--- a/src/backend/taler-merchant-httpd_helper.c
+++ b/src/backend/taler-merchant-httpd_helper.c
@@ -742,6 +742,7 @@ TMH_base_url_by_connection (struct MHD_Connection *connection,
{
const char *host;
const char *forwarded_host;
+ const char *forwarded_port;
const char *uri_path;
memset (buf,
@@ -773,6 +774,16 @@ TMH_base_url_by_connection (struct MHD_Connection *connection,
GNUNET_buffer_write_str (buf,
host);
}
+ forwarded_port = MHD_lookup_connection_value (connection,
+ MHD_HEADER_KIND,
+ "X-Forwarded-Port");
+ if (NULL != forwarded_port)
+ {
+ GNUNET_buffer_write_str (buf,
+ ":");
+ GNUNET_buffer_write_str (buf,
+ forwarded_port);
+ }
uri_path = MHD_lookup_connection_value (connection,
MHD_HEADER_KIND,
"X-Forwarded-Prefix");
@@ -799,6 +810,7 @@ TMH_taler_uri_by_connection (struct MHD_Connection *connection,
{
const char *host;
const char *forwarded_host;
+ const char *forwarded_port;
const char *uri_path;
memset (buf,
@@ -810,6 +822,9 @@ TMH_taler_uri_by_connection (struct MHD_Connection *connection,
forwarded_host = MHD_lookup_connection_value (connection,
MHD_HEADER_KIND,
"X-Forwarded-Host");
+ forwarded_port = MHD_lookup_connection_value (connection,
+ MHD_HEADER_KIND,
+ "X-Forwarded-Port");
uri_path = MHD_lookup_connection_value (connection,
MHD_HEADER_KIND,
"X-Forwarded-Prefix");
@@ -833,6 +848,13 @@ TMH_taler_uri_by_connection (struct MHD_Connection *connection,
"/");
GNUNET_buffer_write_str (buf,
host);
+ if (NULL != forwarded_port)
+ {
+ GNUNET_buffer_write_str (buf,
+ ":");
+ GNUNET_buffer_write_str (buf,
+ forwarded_port);
+ }
if (NULL != uri_path)
GNUNET_buffer_write_path (buf,
uri_path);