]> git.proxmox.com Git - pve-manager.git/blobdiff - PVE/HTTPServer.pm
depend on pve-docs package
[pve-manager.git] / PVE / HTTPServer.pm
index b991fe942004dc7583c7f2a7e3e212b12e6eaeb5..fbf8cc53c2e7592a27ad797724b70b9976b39f5d 100755 (executable)
@@ -364,8 +364,17 @@ sub send_file_start {
            } elsif ($filename =~ m/\.woff$/) {
                $ct = 'application/font-woff';
                $nocomp = 1;
+           } elsif ($filename =~ m/\.woff2$/) {
+               $ct = 'application/font-woff2';
+               $nocomp = 1;
            } elsif ($filename =~ m/\.ttf$/) {
-               $ct = 'application/x-font-ttf';
+               $ct = 'application/font-snft';
+               $nocomp = 1;
+           } elsif ($filename =~ m/\.pdf$/) {
+               $ct = 'application/pdf';
+               $nocomp = 1;
+           } elsif ($filename =~ m/\.epub$/) {
+               $ct = 'application/epub+zip';
                $nocomp = 1;
            } else {
                die "unable to detect content type";
@@ -402,7 +411,7 @@ sub websocket_proxy {
        }
 
        if ($param->{port}) {
-           $remhost = '127.0.0.1';
+           $remhost = 'localhost';
            $remport = $param->{port};
        } elsif ($param->{socket}) {
            $remhost = 'unix/';
@@ -583,6 +592,8 @@ sub proxy_request {
            $target = "http://$host:85$uri";
            # keep alive for localhost is not worth (connection setup is about 0.2ms)
            $keep_alive = 0;
+       } elsif (Net::IP::ip_is_ipv6($host)) {
+           $target = "https://[$host]:8006$uri";
        } else {
            $target = "https://$host:8006$uri";
        }
@@ -833,7 +844,7 @@ sub handle_spice_proxy_request {
        $reqstate->{hdl}->timeout(0);
        $reqstate->{hdl}->wbuf_max(64*10*1024);
 
-       my $remhost = $remip ? $remip : "127.0.0.1";
+       my $remhost = $remip ? $remip : "localhost";
        my $remport = $remip ? 3128 : $spiceport;
 
        tcp_connect $remhost, $remport, sub {
@@ -1441,6 +1452,11 @@ sub wait_end_loop {
        return;
     }
 
+    # fork and exit, so that parent starts a new worker
+    if (fork()) {
+       exit(0);
+    }
+
     # else we need to wait until all open connections gets closed
     my $w; $w = AnyEvent->timer (after => 1, interval => 1, cb => sub {
        eval {