Diff
Not logged in

Differences From:

File src/zip.c part of check-in [dead090c0b] - Update the ZIP archiver to include date information. Provide a function that constructs a ZIP archive from manifest. by drh on 2007-07-31 20:20:40. [view]

To:

File src/zip.c part of check-in [6dab6149b1] - From the vinfo webpage, provide a hyperlink to download a ZIP archive the version. by drh on 2007-08-01 13:32:11. [view]

@@ -314,5 +314,38 @@
   db_must_be_within_tree();
   rid = name_to_rid(g.argv[2]);
   zip_of_baseline(rid, &zip);
   blob_write_to_file(&zip, g.argv[3]);
+}
+
+/*
+** WEBPAGE: zip
+**
+** Generate a ZIP archive for the baseline specified by g.zExtra
+** and return that ZIP archive as the HTTP reply content.
+*/
+void baseline_zip_page(void){
+  int rid;
+  char *zName;
+  int i;
+  Blob zip;
+
+  login_check_credentials();
+  if( !g.okRead || !g.okHistory ){ login_needed(); return; }
+  zName = mprintf("%s", g.zExtra);
+  i = strlen(zName);
+  for(i=strlen(zName)-1; i>5; i--){
+    if( zName[i]=='.' ){
+      zName[i] = 0;
+      break;
+    }
+  }
+  rid = name_to_rid(zName);
+  if( rid==0 ){
+    @ Not found
+    return;
+  }
+  zip_of_baseline(rid, &zip);
+  cgi_set_content(&zip);
+  cgi_set_content_type("application/zip");
+  cgi_reply();
 }