Check-in [f5e8b1d736]
Not logged in
Overview

SHA1 Hash:f5e8b1d736ab0c00b43e04cb5e15cbb5752ca39c
Date: 2007-08-04 00:08:17
User: drh
Comment:Merge in and correct the changes to the new repository initialization. Also fix other misc bugs seen while testing.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/cgi.c from [90e1185c4a] to [f25a72aeb6].

@@ -76,10 +76,17 @@
 /*
 ** Reset the HTTP reply text to be an empty string.
 */
 void cgi_reset_content(void){
   blob_reset(&cgiContent);
+}
+
+/*
+** Return a pointer to the CGI output blob.
+*/
+Blob *cgi_output_blob(void){
+  return &cgiContent;
 }
 
 /*
 ** Return a pointer to the HTTP reply text.
 */

Modified src/db.c from [acf733f759] to [98de757440].

@@ -664,24 +664,31 @@
   db_open_repository(g.argv[2]);
   db_open_config();
   db_begin_transaction();
   db_set("content-schema", CONTENT_SCHEMA);
   db_set("aux-schema", AUX_SCHEMA);
+  db_set_int("authenticate-localhost", 0);
   db_multi_exec(
     "INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));"
     "INSERT INTO config(name,value) VALUES('project-code',hex(randomblob(20)));"
   );
   zUser = db_global_get("default-user", 0);
   if( zUser==0 ){
     zUser = getenv("USER");
   }
   if( zUser==0 ){
-    zUser = "anonymous";
+    zUser = "root";
   }
   db_multi_exec(
      "INSERT INTO user(login, pw, cap, info)"
      "VALUES(%Q,'','s','')", zUser
+  );
+  db_multi_exec(
+     "INSERT INTO user(login,pw,cap,info)"
+     "   VALUES('anonymous','anonymous','hjkorw','Anon');"
+     "INSERT INTO user(login,pw,cap,info)"
+     "   VALUES('nobody','','jor','Nobody');"
   );
   user_select();
   blob_zero(&manifest);
   blob_appendf(&manifest, "C initial\\sempty\\sbaseline\n");
   zDate = db_text(0, "SELECT datetime('now')");

Modified src/main.c from [67d59cdc12] to [18f71690c1].

@@ -545,10 +545,11 @@
 */
 void cmd_http(void){
   if( g.argc!=2 && g.argc!=3 ){
     cgi_panic("no repository specified");
   }
+  g.cgiPanic = 1;
   if( g.argc==3 ){
     db_open_repository(g.argv[2]);
   }else{
     db_must_be_within_tree();
   }
@@ -574,17 +575,22 @@
     iPort = atoi(zPort);
   }else{
     iPort = 8080;
   }
   if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
+  if( g.argc==2 ){
+    db_must_be_within_tree();
+    db_close();
+  }
   cgi_http_server(iPort);
   if( g.fHttpTrace ){
     fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
   }
+  g.cgiPanic = 1;
   if( g.argc==2 ){
     db_must_be_within_tree();
   }else{
     db_open_repository(g.argv[2]);
   }
   cgi_handle_http_request();
   process_one_web_page();
 }

Modified src/timeline.c from [c9c7c2c04a] to [01eff99510].

@@ -129,10 +129,11 @@
     }
   }
   zSQL = mprintf("%z ORDER BY event.mtime DESC LIMIT %d", zSQL, nEntry);
   db_prepare(&q, zSQL);
   free(zSQL);
+  zDate[0] = 0;
   www_print_timeline(&q, zDate);
   db_finalize(&q);
   if( zStart==0 ){
     zStart = zDate;
   }