Fossil SCM

Merge in and correct the changes to the new repository initialization. Also fix other misc bugs seen while testing.

drh 2007-08-04 00:08 trunk merge
Commit f5e8b1d736ab0c00b43e04cb5e15cbb5752ca39c
+7
--- src/cgi.c
+++ src/cgi.c
@@ -77,10 +77,17 @@
7777
** Reset the HTTP reply text to be an empty string.
7878
*/
7979
void cgi_reset_content(void){
8080
blob_reset(&cgiContent);
8181
}
82
+
83
+/*
84
+** Return a pointer to the CGI output blob.
85
+*/
86
+Blob *cgi_output_blob(void){
87
+ return &cgiContent;
88
+}
8289
8390
/*
8491
** Return a pointer to the HTTP reply text.
8592
*/
8693
char *cgi_extract_content(int *pnAmt){
8794
--- src/cgi.c
+++ src/cgi.c
@@ -77,10 +77,17 @@
77 ** Reset the HTTP reply text to be an empty string.
78 */
79 void cgi_reset_content(void){
80 blob_reset(&cgiContent);
81 }
 
 
 
 
 
 
 
82
83 /*
84 ** Return a pointer to the HTTP reply text.
85 */
86 char *cgi_extract_content(int *pnAmt){
87
--- src/cgi.c
+++ src/cgi.c
@@ -77,10 +77,17 @@
77 ** Reset the HTTP reply text to be an empty string.
78 */
79 void cgi_reset_content(void){
80 blob_reset(&cgiContent);
81 }
82
83 /*
84 ** Return a pointer to the CGI output blob.
85 */
86 Blob *cgi_output_blob(void){
87 return &cgiContent;
88 }
89
90 /*
91 ** Return a pointer to the HTTP reply text.
92 */
93 char *cgi_extract_content(int *pnAmt){
94
+8 -1
--- src/db.c
+++ src/db.c
@@ -664,25 +664,32 @@
664664
db_open_repository(g.argv[2]);
665665
db_open_config();
666666
db_begin_transaction();
667667
db_set("content-schema", CONTENT_SCHEMA);
668668
db_set("aux-schema", AUX_SCHEMA);
669
+ db_set_int("authenticate-localhost", 0);
669670
db_multi_exec(
670671
"INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));"
671672
"INSERT INTO config(name,value) VALUES('project-code',hex(randomblob(20)));"
672673
);
673674
zUser = db_global_get("default-user", 0);
674675
if( zUser==0 ){
675676
zUser = getenv("USER");
676677
}
677678
if( zUser==0 ){
678
- zUser = "anonymous";
679
+ zUser = "root";
679680
}
680681
db_multi_exec(
681682
"INSERT INTO user(login, pw, cap, info)"
682683
"VALUES(%Q,'','s','')", zUser
683684
);
685
+ db_multi_exec(
686
+ "INSERT INTO user(login,pw,cap,info)"
687
+ " VALUES('anonymous','anonymous','hjkorw','Anon');"
688
+ "INSERT INTO user(login,pw,cap,info)"
689
+ " VALUES('nobody','','jor','Nobody');"
690
+ );
684691
user_select();
685692
blob_zero(&manifest);
686693
blob_appendf(&manifest, "C initial\\sempty\\sbaseline\n");
687694
zDate = db_text(0, "SELECT datetime('now')");
688695
zDate[10]='T';
689696
--- src/db.c
+++ src/db.c
@@ -664,25 +664,32 @@
664 db_open_repository(g.argv[2]);
665 db_open_config();
666 db_begin_transaction();
667 db_set("content-schema", CONTENT_SCHEMA);
668 db_set("aux-schema", AUX_SCHEMA);
 
669 db_multi_exec(
670 "INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));"
671 "INSERT INTO config(name,value) VALUES('project-code',hex(randomblob(20)));"
672 );
673 zUser = db_global_get("default-user", 0);
674 if( zUser==0 ){
675 zUser = getenv("USER");
676 }
677 if( zUser==0 ){
678 zUser = "anonymous";
679 }
680 db_multi_exec(
681 "INSERT INTO user(login, pw, cap, info)"
682 "VALUES(%Q,'','s','')", zUser
683 );
 
 
 
 
 
 
684 user_select();
685 blob_zero(&manifest);
686 blob_appendf(&manifest, "C initial\\sempty\\sbaseline\n");
687 zDate = db_text(0, "SELECT datetime('now')");
688 zDate[10]='T';
689
--- src/db.c
+++ src/db.c
@@ -664,25 +664,32 @@
664 db_open_repository(g.argv[2]);
665 db_open_config();
666 db_begin_transaction();
667 db_set("content-schema", CONTENT_SCHEMA);
668 db_set("aux-schema", AUX_SCHEMA);
669 db_set_int("authenticate-localhost", 0);
670 db_multi_exec(
671 "INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));"
672 "INSERT INTO config(name,value) VALUES('project-code',hex(randomblob(20)));"
673 );
674 zUser = db_global_get("default-user", 0);
675 if( zUser==0 ){
676 zUser = getenv("USER");
677 }
678 if( zUser==0 ){
679 zUser = "root";
680 }
681 db_multi_exec(
682 "INSERT INTO user(login, pw, cap, info)"
683 "VALUES(%Q,'','s','')", zUser
684 );
685 db_multi_exec(
686 "INSERT INTO user(login,pw,cap,info)"
687 " VALUES('anonymous','anonymous','hjkorw','Anon');"
688 "INSERT INTO user(login,pw,cap,info)"
689 " VALUES('nobody','','jor','Nobody');"
690 );
691 user_select();
692 blob_zero(&manifest);
693 blob_appendf(&manifest, "C initial\\sempty\\sbaseline\n");
694 zDate = db_text(0, "SELECT datetime('now')");
695 zDate[10]='T';
696
+8 -1
--- src/db.c
+++ src/db.c
@@ -664,25 +664,32 @@
664664
db_open_repository(g.argv[2]);
665665
db_open_config();
666666
db_begin_transaction();
667667
db_set("content-schema", CONTENT_SCHEMA);
668668
db_set("aux-schema", AUX_SCHEMA);
669
+ db_set_int("authenticate-localhost", 0);
669670
db_multi_exec(
670671
"INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));"
671672
"INSERT INTO config(name,value) VALUES('project-code',hex(randomblob(20)));"
672673
);
673674
zUser = db_global_get("default-user", 0);
674675
if( zUser==0 ){
675676
zUser = getenv("USER");
676677
}
677678
if( zUser==0 ){
678
- zUser = "anonymous";
679
+ zUser = "root";
679680
}
680681
db_multi_exec(
681682
"INSERT INTO user(login, pw, cap, info)"
682683
"VALUES(%Q,'','s','')", zUser
683684
);
685
+ db_multi_exec(
686
+ "INSERT INTO user(login,pw,cap,info)"
687
+ " VALUES('anonymous','anonymous','hjkorw','Anon');"
688
+ "INSERT INTO user(login,pw,cap,info)"
689
+ " VALUES('nobody','','jor','Nobody');"
690
+ );
684691
user_select();
685692
blob_zero(&manifest);
686693
blob_appendf(&manifest, "C initial\\sempty\\sbaseline\n");
687694
zDate = db_text(0, "SELECT datetime('now')");
688695
zDate[10]='T';
689696
--- src/db.c
+++ src/db.c
@@ -664,25 +664,32 @@
664 db_open_repository(g.argv[2]);
665 db_open_config();
666 db_begin_transaction();
667 db_set("content-schema", CONTENT_SCHEMA);
668 db_set("aux-schema", AUX_SCHEMA);
 
669 db_multi_exec(
670 "INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));"
671 "INSERT INTO config(name,value) VALUES('project-code',hex(randomblob(20)));"
672 );
673 zUser = db_global_get("default-user", 0);
674 if( zUser==0 ){
675 zUser = getenv("USER");
676 }
677 if( zUser==0 ){
678 zUser = "anonymous";
679 }
680 db_multi_exec(
681 "INSERT INTO user(login, pw, cap, info)"
682 "VALUES(%Q,'','s','')", zUser
683 );
 
 
 
 
 
 
684 user_select();
685 blob_zero(&manifest);
686 blob_appendf(&manifest, "C initial\\sempty\\sbaseline\n");
687 zDate = db_text(0, "SELECT datetime('now')");
688 zDate[10]='T';
689
--- src/db.c
+++ src/db.c
@@ -664,25 +664,32 @@
664 db_open_repository(g.argv[2]);
665 db_open_config();
666 db_begin_transaction();
667 db_set("content-schema", CONTENT_SCHEMA);
668 db_set("aux-schema", AUX_SCHEMA);
669 db_set_int("authenticate-localhost", 0);
670 db_multi_exec(
671 "INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));"
672 "INSERT INTO config(name,value) VALUES('project-code',hex(randomblob(20)));"
673 );
674 zUser = db_global_get("default-user", 0);
675 if( zUser==0 ){
676 zUser = getenv("USER");
677 }
678 if( zUser==0 ){
679 zUser = "root";
680 }
681 db_multi_exec(
682 "INSERT INTO user(login, pw, cap, info)"
683 "VALUES(%Q,'','s','')", zUser
684 );
685 db_multi_exec(
686 "INSERT INTO user(login,pw,cap,info)"
687 " VALUES('anonymous','anonymous','hjkorw','Anon');"
688 "INSERT INTO user(login,pw,cap,info)"
689 " VALUES('nobody','','jor','Nobody');"
690 );
691 user_select();
692 blob_zero(&manifest);
693 blob_appendf(&manifest, "C initial\\sempty\\sbaseline\n");
694 zDate = db_text(0, "SELECT datetime('now')");
695 zDate[10]='T';
696
+6
--- src/main.c
+++ src/main.c
@@ -545,10 +545,11 @@
545545
*/
546546
void cmd_http(void){
547547
if( g.argc!=2 && g.argc!=3 ){
548548
cgi_panic("no repository specified");
549549
}
550
+ g.cgiPanic = 1;
550551
if( g.argc==3 ){
551552
db_open_repository(g.argv[2]);
552553
}else{
553554
db_must_be_within_tree();
554555
}
@@ -574,17 +575,22 @@
574575
iPort = atoi(zPort);
575576
}else{
576577
iPort = 8080;
577578
}
578579
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
580
+ if( g.argc==2 ){
581
+ db_must_be_within_tree();
582
+ db_close();
583
+ }
579584
cgi_http_server(iPort);
580585
if( g.fHttpTrace ){
581586
fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
582587
}
588
+ g.cgiPanic = 1;
583589
if( g.argc==2 ){
584590
db_must_be_within_tree();
585591
}else{
586592
db_open_repository(g.argv[2]);
587593
}
588594
cgi_handle_http_request();
589595
process_one_web_page();
590596
}
591597
--- src/main.c
+++ src/main.c
@@ -545,10 +545,11 @@
545 */
546 void cmd_http(void){
547 if( g.argc!=2 && g.argc!=3 ){
548 cgi_panic("no repository specified");
549 }
 
550 if( g.argc==3 ){
551 db_open_repository(g.argv[2]);
552 }else{
553 db_must_be_within_tree();
554 }
@@ -574,17 +575,22 @@
574 iPort = atoi(zPort);
575 }else{
576 iPort = 8080;
577 }
578 if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
 
 
 
 
579 cgi_http_server(iPort);
580 if( g.fHttpTrace ){
581 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
582 }
 
583 if( g.argc==2 ){
584 db_must_be_within_tree();
585 }else{
586 db_open_repository(g.argv[2]);
587 }
588 cgi_handle_http_request();
589 process_one_web_page();
590 }
591
--- src/main.c
+++ src/main.c
@@ -545,10 +545,11 @@
545 */
546 void cmd_http(void){
547 if( g.argc!=2 && g.argc!=3 ){
548 cgi_panic("no repository specified");
549 }
550 g.cgiPanic = 1;
551 if( g.argc==3 ){
552 db_open_repository(g.argv[2]);
553 }else{
554 db_must_be_within_tree();
555 }
@@ -574,17 +575,22 @@
575 iPort = atoi(zPort);
576 }else{
577 iPort = 8080;
578 }
579 if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
580 if( g.argc==2 ){
581 db_must_be_within_tree();
582 db_close();
583 }
584 cgi_http_server(iPort);
585 if( g.fHttpTrace ){
586 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
587 }
588 g.cgiPanic = 1;
589 if( g.argc==2 ){
590 db_must_be_within_tree();
591 }else{
592 db_open_repository(g.argv[2]);
593 }
594 cgi_handle_http_request();
595 process_one_web_page();
596 }
597
+6
--- src/main.c
+++ src/main.c
@@ -545,10 +545,11 @@
545545
*/
546546
void cmd_http(void){
547547
if( g.argc!=2 && g.argc!=3 ){
548548
cgi_panic("no repository specified");
549549
}
550
+ g.cgiPanic = 1;
550551
if( g.argc==3 ){
551552
db_open_repository(g.argv[2]);
552553
}else{
553554
db_must_be_within_tree();
554555
}
@@ -574,17 +575,22 @@
574575
iPort = atoi(zPort);
575576
}else{
576577
iPort = 8080;
577578
}
578579
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
580
+ if( g.argc==2 ){
581
+ db_must_be_within_tree();
582
+ db_close();
583
+ }
579584
cgi_http_server(iPort);
580585
if( g.fHttpTrace ){
581586
fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
582587
}
588
+ g.cgiPanic = 1;
583589
if( g.argc==2 ){
584590
db_must_be_within_tree();
585591
}else{
586592
db_open_repository(g.argv[2]);
587593
}
588594
cgi_handle_http_request();
589595
process_one_web_page();
590596
}
591597
--- src/main.c
+++ src/main.c
@@ -545,10 +545,11 @@
545 */
546 void cmd_http(void){
547 if( g.argc!=2 && g.argc!=3 ){
548 cgi_panic("no repository specified");
549 }
 
550 if( g.argc==3 ){
551 db_open_repository(g.argv[2]);
552 }else{
553 db_must_be_within_tree();
554 }
@@ -574,17 +575,22 @@
574 iPort = atoi(zPort);
575 }else{
576 iPort = 8080;
577 }
578 if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
 
 
 
 
579 cgi_http_server(iPort);
580 if( g.fHttpTrace ){
581 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
582 }
 
583 if( g.argc==2 ){
584 db_must_be_within_tree();
585 }else{
586 db_open_repository(g.argv[2]);
587 }
588 cgi_handle_http_request();
589 process_one_web_page();
590 }
591
--- src/main.c
+++ src/main.c
@@ -545,10 +545,11 @@
545 */
546 void cmd_http(void){
547 if( g.argc!=2 && g.argc!=3 ){
548 cgi_panic("no repository specified");
549 }
550 g.cgiPanic = 1;
551 if( g.argc==3 ){
552 db_open_repository(g.argv[2]);
553 }else{
554 db_must_be_within_tree();
555 }
@@ -574,17 +575,22 @@
575 iPort = atoi(zPort);
576 }else{
577 iPort = 8080;
578 }
579 if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
580 if( g.argc==2 ){
581 db_must_be_within_tree();
582 db_close();
583 }
584 cgi_http_server(iPort);
585 if( g.fHttpTrace ){
586 fprintf(stderr, "====== SERVER pid %d =======\n", getpid());
587 }
588 g.cgiPanic = 1;
589 if( g.argc==2 ){
590 db_must_be_within_tree();
591 }else{
592 db_open_repository(g.argv[2]);
593 }
594 cgi_handle_http_request();
595 process_one_web_page();
596 }
597
--- src/timeline.c
+++ src/timeline.c
@@ -129,10 +129,11 @@
129129
}
130130
}
131131
zSQL = mprintf("%z ORDER BY event.mtime DESC LIMIT %d", zSQL, nEntry);
132132
db_prepare(&q, zSQL);
133133
free(zSQL);
134
+ zDate[0] = 0;
134135
www_print_timeline(&q, zDate);
135136
db_finalize(&q);
136137
if( zStart==0 ){
137138
zStart = zDate;
138139
}
139140
--- src/timeline.c
+++ src/timeline.c
@@ -129,10 +129,11 @@
129 }
130 }
131 zSQL = mprintf("%z ORDER BY event.mtime DESC LIMIT %d", zSQL, nEntry);
132 db_prepare(&q, zSQL);
133 free(zSQL);
 
134 www_print_timeline(&q, zDate);
135 db_finalize(&q);
136 if( zStart==0 ){
137 zStart = zDate;
138 }
139
--- src/timeline.c
+++ src/timeline.c
@@ -129,10 +129,11 @@
129 }
130 }
131 zSQL = mprintf("%z ORDER BY event.mtime DESC LIMIT %d", zSQL, nEntry);
132 db_prepare(&q, zSQL);
133 free(zSQL);
134 zDate[0] = 0;
135 www_print_timeline(&q, zDate);
136 db_finalize(&q);
137 if( zStart==0 ){
138 zStart = zDate;
139 }
140
--- src/timeline.c
+++ src/timeline.c
@@ -129,10 +129,11 @@
129129
}
130130
}
131131
zSQL = mprintf("%z ORDER BY event.mtime DESC LIMIT %d", zSQL, nEntry);
132132
db_prepare(&q, zSQL);
133133
free(zSQL);
134
+ zDate[0] = 0;
134135
www_print_timeline(&q, zDate);
135136
db_finalize(&q);
136137
if( zStart==0 ){
137138
zStart = zDate;
138139
}
139140
--- src/timeline.c
+++ src/timeline.c
@@ -129,10 +129,11 @@
129 }
130 }
131 zSQL = mprintf("%z ORDER BY event.mtime DESC LIMIT %d", zSQL, nEntry);
132 db_prepare(&q, zSQL);
133 free(zSQL);
 
134 www_print_timeline(&q, zDate);
135 db_finalize(&q);
136 if( zStart==0 ){
137 zStart = zDate;
138 }
139
--- src/timeline.c
+++ src/timeline.c
@@ -129,10 +129,11 @@
129 }
130 }
131 zSQL = mprintf("%z ORDER BY event.mtime DESC LIMIT %d", zSQL, nEntry);
132 db_prepare(&q, zSQL);
133 free(zSQL);
134 zDate[0] = 0;
135 www_print_timeline(&q, zDate);
136 db_finalize(&q);
137 if( zStart==0 ){
138 zStart = zDate;
139 }
140

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button