[pve-devel] [PATCH http-server 1/2] store Host header in rpc environment

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Mar 27 11:16:26 CET 2019


Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 PVE/APIServer/AnyEvent.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/PVE/APIServer/AnyEvent.pm b/PVE/APIServer/AnyEvent.pm
index 1a01d17..151d1a1 100644
--- a/PVE/APIServer/AnyEvent.pm
+++ b/PVE/APIServer/AnyEvent.pm
@@ -1194,11 +1194,15 @@ sub unshift_read_header {
 
 		my $len = $r->header('Content-Length');
 
+		my $host_header = $r->header('Host');
+		my $rpcenv = $self->{rpcenv};
+		$rpcenv->set_request_host($host_header);
+
 		# header processing complete - authenticate now
 
 		my $auth = {};
 		if ($self->{spiceproxy}) {
-		    my $connect_str = $r->header('Host');
+		    my $connect_str = $host_header;
 		    my ($vmid, $node, $port) = $self->verify_spice_connect_url($connect_str);
 		    if (!(defined($vmid) && $node && $port)) {
 			$self->error($reqstate, HTTP_UNAUTHORIZED, "invalid ticket");
-- 
2.11.0




More information about the pve-devel mailing list