]> git.proxmox.com Git - pve-common.git/commitdiff
add additional check for duplicate method definitions
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 27 May 2014 07:43:47 +0000 (09:43 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 27 May 2014 09:40:29 +0000 (11:40 +0200)
If we have a SUBCLASS, other methods are not allowed.

data/PVE/RESTHandler.pm

index 91b269ea2ab3d0d6ee6ac0b0ea219aaf027ae3b9..23a29ea73a5ac2de249102193c3c1522de19fdef 100644 (file)
@@ -218,6 +218,11 @@ sub register_method {
     die "$errprefix duplicate method definition\n" 
        if defined($path_lookup->{$method});
 
     die "$errprefix duplicate method definition\n" 
        if defined($path_lookup->{$method});
 
+    if ($method eq 'SUBCLASS') {
+       foreach my $m (qw(GET PUT POST DELETE)) {
+           die "$errprefix duplicate method definition SUBCLASS and $m\n" if $path_lookup->{$m};
+       }
+    }
     $path_lookup->{$method} = $info;
 
     $info->{match_re} = $match_re;
     $path_lookup->{$method} = $info;
 
     $info->{match_re} = $match_re;