]> matita.cs.unibo.it Git - helm.git/commitdiff
Added "/getempty" method.
authorStefano Zacchiroli <zack@upsilon.cc>
Sun, 11 Nov 2001 14:09:35 +0000 (14:09 +0000)
committerStefano Zacchiroli <zack@upsilon.cc>
Sun, 11 Nov 2001 14:09:35 +0000 (14:09 +0000)
----
Syntax: "/getempty".
Answer: a minimal valid XML document.
Currently, the returned document is as follows:

  <?xml version="1.0"?>
  <!DOCTYPE empty [
    <!ELEMENT empty EMPTY>
  ]>
  <empty />

----

helm/http_getter/http_getter.pl.in

index fd88194bf417b1860a675cd7c094cd5405cd1cae..e1546733e4c71aaa452e0a172d110a9bc0b1c377 100755 (executable)
@@ -227,24 +227,25 @@ while (my $c = $d->accept) {
           answer($c,$cont,"text/xml","");
 
         } elsif ($http_method eq 'GET' and $http_path eq "/getdtd") {
-            my $filename = $inputuri;
-            $filename = $dtd_dir."/".$filename;
-            print "DTD: $inputuri ==> ($filename)\n";
-            if (stat($filename)) {
-               print "Using local copy\n";
-               open(FD, $filename) or die "Cannot open $filename\n";
-               $cont = "";
-               while(<FD>) {
-                # Vary bad heuristic for substituion of absolute URLs
-                # for relative ones
-               s/ENTITY (.*) SYSTEM\s+"/ENTITY $1 SYSTEM "$myownurl\/getdtd?uri=/g;
-               $cont .= $_;
-              }
-               close(FD);
-               answer($c,$cont,"text/xml","");
-            } else {
-               die "Could not find DTD!";
-            }
+
+#             my $filename = $inputuri;
+#             $filename = $dtd_dir."/".$filename;
+#             print "DTD: $inputuri ==> ($filename)\n";
+#             if (stat($filename)) {
+#                print "Using local copy\n";
+#                open(FD, $filename) or die "Cannot open $filename\n";
+#                $cont = "";
+#                while(<FD>) {
+#                 # Vary bad heuristic for substituion of absolute URLs
+#                 # for relative ones
+#              s/ENTITY (.*) SYSTEM\s+"/ENTITY $1 SYSTEM "$myownurl\/getdtd?uri=/g;
+#              $cont .= $_;
+#             }
+#                close(FD);
+#                answer($c,$cont,"text/xml","");
+#             } else {
+#                die "Could not find DTD!";
+#             }
 
         } elsif ($http_method eq 'GET' and $http_path eq "/getstyleconf") {
             my $filename = $inputuri;
@@ -337,6 +338,17 @@ while (my $c = $d->accept) {
            print "Help requested!\n";
            html_nice_answer($c,"HTTP Getter Version: $VERSION");
 
+        } elsif ($http_method eq 'GET' and $http_path eq "/getempty") {
+          # return an empty, but valid, xml document
+          my $emptyxml = <<EOXML;
+<?xml version="1.0"?>
+<!DOCTYPE empty [
+  <!ELEMENT empty EMPTY>
+]>
+<empty />
+EOXML
+          answer($c, $emptyxml, "", "");
+
         } elsif ($http_method eq 'GET' and $http_path =~ /\.cgi$/) {
           # cgi handling
            print "CGI requested!\n";