[pve-devel] [PATCH common 2/2] add request host to RESTEnvironment

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


Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 src/PVE/RESTEnvironment.pm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm
index b32c452..64c622f 100644
--- a/src/PVE/RESTEnvironment.pm
+++ b/src/PVE/RESTEnvironment.pm
@@ -231,6 +231,20 @@ sub get_u2f_challenge {
     die "no active u2f challenge\n";
 }
 
+sub set_request_host {
+    my ($self, $host) = @_;
+
+    $self->{request_host} = $host;
+}
+
+sub get_request_host {
+    my ($self, $noerr) = @_;
+
+    return $self->{request_host} if defined($self->{request_host}) || $noerr;
+
+    die "no hostname available in current environment\n";
+}
+
 sub is_worker {
     my ($class) = @_;
 
-- 
2.11.0





More information about the pve-devel mailing list