Fossil SCM

Add the 'D' Debug user capability. This is designed to show additional information and controls on webpages for debugging purposes. Also take steps to avoid trying to generate a webpage error message after the webpage has already gone out.

drh 2018-07-25 13:20 trunk
Commit fd3198322a6f902a38dcabdea1663de940ce017b3daf658ffad548f5f3f19f9b
+1
--- src/cgi.c
+++ src/cgi.c
@@ -343,10 +343,11 @@
343343
CGIDEBUG(("DONE\n"));
344344
345345
/* After the webpage has been sent, do any useful background
346346
** processing.
347347
*/
348
+ g.cgiOutput = 2;
348349
if( g.db!=0 && iReplyStatus==200 ){
349350
fclose(g.httpOut);
350351
g.httpOut = fossil_fopen("/dev/null", "wb");
351352
backoffice_run();
352353
}
353354
--- src/cgi.c
+++ src/cgi.c
@@ -343,10 +343,11 @@
343 CGIDEBUG(("DONE\n"));
344
345 /* After the webpage has been sent, do any useful background
346 ** processing.
347 */
 
348 if( g.db!=0 && iReplyStatus==200 ){
349 fclose(g.httpOut);
350 g.httpOut = fossil_fopen("/dev/null", "wb");
351 backoffice_run();
352 }
353
--- src/cgi.c
+++ src/cgi.c
@@ -343,10 +343,11 @@
343 CGIDEBUG(("DONE\n"));
344
345 /* After the webpage has been sent, do any useful background
346 ** processing.
347 */
348 g.cgiOutput = 2;
349 if( g.db!=0 && iReplyStatus==200 ){
350 fclose(g.httpOut);
351 g.httpOut = fossil_fopen("/dev/null", "wb");
352 backoffice_run();
353 }
354
--- src/login.c
+++ src/login.c
@@ -1240,10 +1240,11 @@
12401240
case '3': p->WrForum = 1;
12411241
case '2': p->RdForum = 1; break;
12421242
12431243
case '7': p->EmailAlert = 1; break;
12441244
case 'A': p->Announce = 1; break;
1245
+ case 'D': p->Debug = 1; break;
12451246
12461247
/* The "u" privileges is a little different. It recursively
12471248
** inherits all privileges of the user named "reader" */
12481249
case 'u': {
12491250
if( (flags & LOGIN_IGNORE_UV)==0 ){
@@ -1320,10 +1321,11 @@
13201321
case '4': rc = p->WrTForum; break;
13211322
case '5': rc = p->ModForum; break;
13221323
case '6': rc = p->AdminForum;break;
13231324
case '7': rc = p->EmailAlert;break;
13241325
case 'A': rc = p->Announce; break;
1326
+ case 'D': rc = p->Debug; break;
13251327
default: rc = 0; break;
13261328
}
13271329
}
13281330
return rc;
13291331
}
13301332
--- src/login.c
+++ src/login.c
@@ -1240,10 +1240,11 @@
1240 case '3': p->WrForum = 1;
1241 case '2': p->RdForum = 1; break;
1242
1243 case '7': p->EmailAlert = 1; break;
1244 case 'A': p->Announce = 1; break;
 
1245
1246 /* The "u" privileges is a little different. It recursively
1247 ** inherits all privileges of the user named "reader" */
1248 case 'u': {
1249 if( (flags & LOGIN_IGNORE_UV)==0 ){
@@ -1320,10 +1321,11 @@
1320 case '4': rc = p->WrTForum; break;
1321 case '5': rc = p->ModForum; break;
1322 case '6': rc = p->AdminForum;break;
1323 case '7': rc = p->EmailAlert;break;
1324 case 'A': rc = p->Announce; break;
 
1325 default: rc = 0; break;
1326 }
1327 }
1328 return rc;
1329 }
1330
--- src/login.c
+++ src/login.c
@@ -1240,10 +1240,11 @@
1240 case '3': p->WrForum = 1;
1241 case '2': p->RdForum = 1; break;
1242
1243 case '7': p->EmailAlert = 1; break;
1244 case 'A': p->Announce = 1; break;
1245 case 'D': p->Debug = 1; break;
1246
1247 /* The "u" privileges is a little different. It recursively
1248 ** inherits all privileges of the user named "reader" */
1249 case 'u': {
1250 if( (flags & LOGIN_IGNORE_UV)==0 ){
@@ -1320,10 +1321,11 @@
1321 case '4': rc = p->WrTForum; break;
1322 case '5': rc = p->ModForum; break;
1323 case '6': rc = p->AdminForum;break;
1324 case '7': rc = p->EmailAlert;break;
1325 case 'A': rc = p->Announce; break;
1326 case 'D': rc = p->Debug; break;
1327 default: rc = 0; break;
1328 }
1329 }
1330 return rc;
1331 }
1332
+2 -1
--- src/main.c
+++ src/main.c
@@ -93,10 +93,11 @@
9393
char WrTForum; /* 4: Post to forums not subject to moderation */
9494
char ModForum; /* 5: Moderate (approve or reject) forum posts */
9595
char AdminForum; /* 6: Edit forum posts by other users */
9696
char EmailAlert; /* 7: Sign up for email notifications */
9797
char Announce; /* A: Send announcements */
98
+ char Debug; /* D: show extra Fossil debugging features */
9899
};
99100
100101
#ifdef FOSSIL_ENABLE_TCL
101102
/*
102103
** All Tcl related context information is in this structure. This structure
@@ -168,11 +169,11 @@
168169
const char *zContentType; /* The content type of the input HTTP request */
169170
int iErrPriority; /* Priority of current error message */
170171
char *zErrMsg; /* Text of an error message */
171172
int sslNotAvailable; /* SSL is not available. Do not redirect to https: */
172173
Blob cgiIn; /* Input to an xfer www method */
173
- int cgiOutput; /* 0: command-line 1: CGI. 2: CGI after an error */
174
+ int cgiOutput; /* 0: command-line 1: CGI. 2: after CGI */
174175
int xferPanic; /* Write error messages in XFER protocol */
175176
int fullHttpReply; /* True for full HTTP reply. False for CGI reply */
176177
Th_Interp *interp; /* The TH1 interpreter */
177178
char *th1Setup; /* The TH1 post-creation setup script, if any */
178179
int th1Flags; /* The TH1 integration state flags */
179180
--- src/main.c
+++ src/main.c
@@ -93,10 +93,11 @@
93 char WrTForum; /* 4: Post to forums not subject to moderation */
94 char ModForum; /* 5: Moderate (approve or reject) forum posts */
95 char AdminForum; /* 6: Edit forum posts by other users */
96 char EmailAlert; /* 7: Sign up for email notifications */
97 char Announce; /* A: Send announcements */
 
98 };
99
100 #ifdef FOSSIL_ENABLE_TCL
101 /*
102 ** All Tcl related context information is in this structure. This structure
@@ -168,11 +169,11 @@
168 const char *zContentType; /* The content type of the input HTTP request */
169 int iErrPriority; /* Priority of current error message */
170 char *zErrMsg; /* Text of an error message */
171 int sslNotAvailable; /* SSL is not available. Do not redirect to https: */
172 Blob cgiIn; /* Input to an xfer www method */
173 int cgiOutput; /* 0: command-line 1: CGI. 2: CGI after an error */
174 int xferPanic; /* Write error messages in XFER protocol */
175 int fullHttpReply; /* True for full HTTP reply. False for CGI reply */
176 Th_Interp *interp; /* The TH1 interpreter */
177 char *th1Setup; /* The TH1 post-creation setup script, if any */
178 int th1Flags; /* The TH1 integration state flags */
179
--- src/main.c
+++ src/main.c
@@ -93,10 +93,11 @@
93 char WrTForum; /* 4: Post to forums not subject to moderation */
94 char ModForum; /* 5: Moderate (approve or reject) forum posts */
95 char AdminForum; /* 6: Edit forum posts by other users */
96 char EmailAlert; /* 7: Sign up for email notifications */
97 char Announce; /* A: Send announcements */
98 char Debug; /* D: show extra Fossil debugging features */
99 };
100
101 #ifdef FOSSIL_ENABLE_TCL
102 /*
103 ** All Tcl related context information is in this structure. This structure
@@ -168,11 +169,11 @@
169 const char *zContentType; /* The content type of the input HTTP request */
170 int iErrPriority; /* Priority of current error message */
171 char *zErrMsg; /* Text of an error message */
172 int sslNotAvailable; /* SSL is not available. Do not redirect to https: */
173 Blob cgiIn; /* Input to an xfer www method */
174 int cgiOutput; /* 0: command-line 1: CGI. 2: after CGI */
175 int xferPanic; /* Write error messages in XFER protocol */
176 int fullHttpReply; /* True for full HTTP reply. False for CGI reply */
177 Th_Interp *interp; /* The TH1 interpreter */
178 char *th1Setup; /* The TH1 post-creation setup script, if any */
179 int th1Flags; /* The TH1 integration state flags */
180
+1 -1
--- src/printf.c
+++ src/printf.c
@@ -1148,11 +1148,11 @@
11481148
if(g.json.isJsonMode){
11491149
json_warn( FSL_JSON_W_UNKNOWN, "%s", z );
11501150
}else
11511151
#endif
11521152
{
1153
- if( g.cgiOutput ){
1153
+ if( g.cgiOutput==1 ){
11541154
cgi_printf("<p class=\"generalError\">\n%h\n</p>\n", z);
11551155
}else{
11561156
fossil_force_newline();
11571157
fossil_trace("%s\n", z);
11581158
}
11591159
--- src/printf.c
+++ src/printf.c
@@ -1148,11 +1148,11 @@
1148 if(g.json.isJsonMode){
1149 json_warn( FSL_JSON_W_UNKNOWN, "%s", z );
1150 }else
1151 #endif
1152 {
1153 if( g.cgiOutput ){
1154 cgi_printf("<p class=\"generalError\">\n%h\n</p>\n", z);
1155 }else{
1156 fossil_force_newline();
1157 fossil_trace("%s\n", z);
1158 }
1159
--- src/printf.c
+++ src/printf.c
@@ -1148,11 +1148,11 @@
1148 if(g.json.isJsonMode){
1149 json_warn( FSL_JSON_W_UNKNOWN, "%s", z );
1150 }else
1151 #endif
1152 {
1153 if( g.cgiOutput==1 ){
1154 cgi_printf("<p class=\"generalError\">\n%h\n</p>\n", z);
1155 }else{
1156 fossil_force_newline();
1157 fossil_trace("%s\n", z);
1158 }
1159
+12 -8
--- src/setup.c
+++ src/setup.c
@@ -372,10 +372,12 @@
372372
@ Forum administrator
373373
@ <tr><th valign="top">7</th>
374374
@ <td><i>Email-Alerts:</i> Sign up for email nofications</td></tr>
375375
@ <tr><th valign="top">A</th>
376376
@ <td><i>Announce:</i> Send announcements</td></tr>
377
+ @ <tr><th valign="top">D</th>
378
+ @ <td><i>Debug:</i> Enable debugging features</td></tr>
377379
@ </table>
378380
}
379381
380382
/*
381383
** WEBPAGE: setup_ulist_notes
@@ -724,15 +726,15 @@
724726
@ <label><input type="checkbox" name="ao"%s(oa['o']) />
725727
@ Check-Out%s(B('o'))</label><br />
726728
@ <label><input type="checkbox" name="ah"%s(oa['h']) />
727729
@ Hyperlinks%s(B('h'))</label><br />
728730
@ <label><input type="checkbox" name="ab"%s(oa['b']) />
729
- @ Attachments%s(B('b'))</label>
730
-
731
- @ </td><td><td width="40"></td><td valign="top">
731
+ @ Attachments%s(B('b'))</label><br>
732732
@ <label><input type="checkbox" name="ag"%s(oa['g']) />
733733
@ Clone%s(B('g'))</label><br />
734
+
735
+ @ </td><td><td width="40"></td><td valign="top">
734736
@ <label><input type="checkbox" name="aj"%s(oa['j']) />
735737
@ Read Wiki%s(B('j'))</label><br>
736738
@ <label><input type="checkbox" name="af"%s(oa['f']) />
737739
@ New Wiki%s(B('f'))</label><br />
738740
@ <label><input type="checkbox" name="am"%s(oa['m']) />
@@ -748,17 +750,17 @@
748750
@ <label><input type="checkbox" name="ac"%s(oa['c']) />
749751
@ Append To Ticket%s(B('c'))</label><br>
750752
@ <label><input type="checkbox" name="aw"%s(oa['w']) />
751753
@ Write Tickets%s(B('w'))</label><br />
752754
@ <label><input type="checkbox" name="aq"%s(oa['q']) />
753
- @ Moderate Tickets%s(B('q'))</label>
754
-
755
- @ </td><td><td width="40"></td><td valign="top">
755
+ @ Moderate Tickets%s(B('q'))</label><br>
756756
@ <label><input type="checkbox" name="at"%s(oa['t']) />
757757
@ Ticket Report%s(B('t'))</label><br />
758758
@ <label><input type="checkbox" name="ax"%s(oa['x']) />
759
- @ Private%s(B('x'))</label><br />
759
+ @ Private%s(B('x'))</label>
760
+
761
+ @ </td><td><td width="40"></td><td valign="top">
760762
@ <label><input type="checkbox" name="ay"%s(oa['y']) />
761763
@ Write Unversioned%s(B('y'))</label><br />
762764
@ <label><input type="checkbox" name="az"%s(oa['z']) />
763765
@ Download Zip%s(B('z'))</label><br />
764766
@ <label><input type="checkbox" name="a2"%s(oa['2']) />
@@ -772,11 +774,13 @@
772774
@ <label><input type="checkbox" name="a6"%s(oa['6']) />
773775
@ Supervise Forum%s(B('6'))</label><br>
774776
@ <label><input type="checkbox" name="a7"%s(oa['7']) />
775777
@ Email Alerts%s(B('7'))</label><br>
776778
@ <label><input type="checkbox" name="aA"%s(oa['A']) />
777
- @ Send Announcements%s(B('A'))</label>
779
+ @ Send Announcements%s(B('A'))</label><br>
780
+ @ <label><input type="checkbox" name="aD"%s(oa['D']) />
781
+ @ Enable Debug%s(B('D'))</label>
778782
@ </td></tr>
779783
@ </table>
780784
@ </td>
781785
@ </tr>
782786
@ <tr>
783787
--- src/setup.c
+++ src/setup.c
@@ -372,10 +372,12 @@
372 @ Forum administrator
373 @ <tr><th valign="top">7</th>
374 @ <td><i>Email-Alerts:</i> Sign up for email nofications</td></tr>
375 @ <tr><th valign="top">A</th>
376 @ <td><i>Announce:</i> Send announcements</td></tr>
 
 
377 @ </table>
378 }
379
380 /*
381 ** WEBPAGE: setup_ulist_notes
@@ -724,15 +726,15 @@
724 @ <label><input type="checkbox" name="ao"%s(oa['o']) />
725 @ Check-Out%s(B('o'))</label><br />
726 @ <label><input type="checkbox" name="ah"%s(oa['h']) />
727 @ Hyperlinks%s(B('h'))</label><br />
728 @ <label><input type="checkbox" name="ab"%s(oa['b']) />
729 @ Attachments%s(B('b'))</label>
730
731 @ </td><td><td width="40"></td><td valign="top">
732 @ <label><input type="checkbox" name="ag"%s(oa['g']) />
733 @ Clone%s(B('g'))</label><br />
 
 
734 @ <label><input type="checkbox" name="aj"%s(oa['j']) />
735 @ Read Wiki%s(B('j'))</label><br>
736 @ <label><input type="checkbox" name="af"%s(oa['f']) />
737 @ New Wiki%s(B('f'))</label><br />
738 @ <label><input type="checkbox" name="am"%s(oa['m']) />
@@ -748,17 +750,17 @@
748 @ <label><input type="checkbox" name="ac"%s(oa['c']) />
749 @ Append To Ticket%s(B('c'))</label><br>
750 @ <label><input type="checkbox" name="aw"%s(oa['w']) />
751 @ Write Tickets%s(B('w'))</label><br />
752 @ <label><input type="checkbox" name="aq"%s(oa['q']) />
753 @ Moderate Tickets%s(B('q'))</label>
754
755 @ </td><td><td width="40"></td><td valign="top">
756 @ <label><input type="checkbox" name="at"%s(oa['t']) />
757 @ Ticket Report%s(B('t'))</label><br />
758 @ <label><input type="checkbox" name="ax"%s(oa['x']) />
759 @ Private%s(B('x'))</label><br />
 
 
760 @ <label><input type="checkbox" name="ay"%s(oa['y']) />
761 @ Write Unversioned%s(B('y'))</label><br />
762 @ <label><input type="checkbox" name="az"%s(oa['z']) />
763 @ Download Zip%s(B('z'))</label><br />
764 @ <label><input type="checkbox" name="a2"%s(oa['2']) />
@@ -772,11 +774,13 @@
772 @ <label><input type="checkbox" name="a6"%s(oa['6']) />
773 @ Supervise Forum%s(B('6'))</label><br>
774 @ <label><input type="checkbox" name="a7"%s(oa['7']) />
775 @ Email Alerts%s(B('7'))</label><br>
776 @ <label><input type="checkbox" name="aA"%s(oa['A']) />
777 @ Send Announcements%s(B('A'))</label>
 
 
778 @ </td></tr>
779 @ </table>
780 @ </td>
781 @ </tr>
782 @ <tr>
783
--- src/setup.c
+++ src/setup.c
@@ -372,10 +372,12 @@
372 @ Forum administrator
373 @ <tr><th valign="top">7</th>
374 @ <td><i>Email-Alerts:</i> Sign up for email nofications</td></tr>
375 @ <tr><th valign="top">A</th>
376 @ <td><i>Announce:</i> Send announcements</td></tr>
377 @ <tr><th valign="top">D</th>
378 @ <td><i>Debug:</i> Enable debugging features</td></tr>
379 @ </table>
380 }
381
382 /*
383 ** WEBPAGE: setup_ulist_notes
@@ -724,15 +726,15 @@
726 @ <label><input type="checkbox" name="ao"%s(oa['o']) />
727 @ Check-Out%s(B('o'))</label><br />
728 @ <label><input type="checkbox" name="ah"%s(oa['h']) />
729 @ Hyperlinks%s(B('h'))</label><br />
730 @ <label><input type="checkbox" name="ab"%s(oa['b']) />
731 @ Attachments%s(B('b'))</label><br>
 
 
732 @ <label><input type="checkbox" name="ag"%s(oa['g']) />
733 @ Clone%s(B('g'))</label><br />
734
735 @ </td><td><td width="40"></td><td valign="top">
736 @ <label><input type="checkbox" name="aj"%s(oa['j']) />
737 @ Read Wiki%s(B('j'))</label><br>
738 @ <label><input type="checkbox" name="af"%s(oa['f']) />
739 @ New Wiki%s(B('f'))</label><br />
740 @ <label><input type="checkbox" name="am"%s(oa['m']) />
@@ -748,17 +750,17 @@
750 @ <label><input type="checkbox" name="ac"%s(oa['c']) />
751 @ Append To Ticket%s(B('c'))</label><br>
752 @ <label><input type="checkbox" name="aw"%s(oa['w']) />
753 @ Write Tickets%s(B('w'))</label><br />
754 @ <label><input type="checkbox" name="aq"%s(oa['q']) />
755 @ Moderate Tickets%s(B('q'))</label><br>
 
 
756 @ <label><input type="checkbox" name="at"%s(oa['t']) />
757 @ Ticket Report%s(B('t'))</label><br />
758 @ <label><input type="checkbox" name="ax"%s(oa['x']) />
759 @ Private%s(B('x'))</label>
760
761 @ </td><td><td width="40"></td><td valign="top">
762 @ <label><input type="checkbox" name="ay"%s(oa['y']) />
763 @ Write Unversioned%s(B('y'))</label><br />
764 @ <label><input type="checkbox" name="az"%s(oa['z']) />
765 @ Download Zip%s(B('z'))</label><br />
766 @ <label><input type="checkbox" name="a2"%s(oa['2']) />
@@ -772,11 +774,13 @@
774 @ <label><input type="checkbox" name="a6"%s(oa['6']) />
775 @ Supervise Forum%s(B('6'))</label><br>
776 @ <label><input type="checkbox" name="a7"%s(oa['7']) />
777 @ Email Alerts%s(B('7'))</label><br>
778 @ <label><input type="checkbox" name="aA"%s(oa['A']) />
779 @ Send Announcements%s(B('A'))</label><br>
780 @ <label><input type="checkbox" name="aD"%s(oa['D']) />
781 @ Enable Debug%s(B('D'))</label>
782 @ </td></tr>
783 @ </table>
784 @ </td>
785 @ </tr>
786 @ <tr>
787

Keyboard Shortcuts

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