69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
+
|
char *zBaseURL; /* Full text of the URL being served */
char *zTop; /* Parent directory of zPath */
const char *zContentType; /* The content type of the input HTTP request */
int iErrPriority; /* Priority of current error message */
char *zErrMsg; /* Text of an error message */
Blob cgiIn; /* Input to an xfer www method */
int cgiPanic; /* Write error messages to CGI */
int fullHttpReply; /* True for full HTTP reply. False for CGI reply */
Th_Interp *interp; /* The TH1 interpreter */
FILE *httpIn; /* Accept HTTP input from here */
FILE *httpOut; /* Send HTTP output here */
int xlinkClusterOnly; /* Set when cloning. Only process clusters */
int *aCommitFile; /* Array of files to be committed */
|
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
|
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
|
-
-
|
static int once = 1;
va_start(ap, zFormat);
z = vmprintf(zFormat, ap);
va_end(ap);
if( g.cgiPanic && once ){
once = 0;
cgi_printf("<p><font color=\"red\">%h</font></p>", z);
style_footer();
cgi_reply();
}else{
fprintf(stderr, "%s: %s\n", g.argv[0], z);
}
db_force_rollback();
exit(1);
}
void fossil_fatal(const char *zFormat, ...){
char *z;
va_list ap;
va_start(ap, zFormat);
z = vmprintf(zFormat, ap);
va_end(ap);
if( g.cgiPanic ){
g.cgiPanic = 0;
cgi_printf("<p><font color=\"red\">%h</font></p>", z);
style_footer();
cgi_reply();
}else{
fprintf(stderr, "%s: %s\n", g.argv[0], z);
}
db_force_rollback();
exit(1);
}
|
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
|
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
|
-
+
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
|
**
** Handle a single HTTP request appearing on stdin. The resulting webpage
** is delivered on stdout. This method is used to launch an HTTP request
** handler from inetd, for example. The argument is the name of the
** repository.
*/
void cmd_http(void){
const char *zIpAddr = 0;
const char *zIpAddr;
if( g.argc!=2 && g.argc!=3 && g.argc!=6 ){
cgi_panic("no repository specified");
}
g.cgiPanic = 1;
g.httpIn = stdin;
g.fullHttpReply = 1;
g.httpOut = stdout;
if( g.argc>=3 ){
db_open_repository(g.argv[2]);
if( g.argc==6 ){
g.httpIn = fopen(g.argv[3], "rb");
g.httpOut = fopen(g.argv[4], "wb");
zIpAddr = g.argv[5];
}
if( g.argc==6 ){
g.httpIn = fopen(g.argv[3], "rb");
g.httpOut = fopen(g.argv[4], "wb");
zIpAddr = g.argv[5];
}else{
g.httpIn = stdin;
g.httpOut = stdout;
zIpAddr = 0;
}
if( g.argc>=3 ){
db_open_repository(g.argv[2]);
}else{
db_must_be_within_tree();
}
cgi_handle_http_request(zIpAddr);
process_one_web_page();
}
|
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
|
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
|
-
+
+
+
|
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();
}else{
db_open_repository(g.argv[2]);
}
db_close();
#ifndef __MINGW32__
/* Unix implementation */
if( g.argv[1][0]=='u' ){
#if !defined(__DARWIN__) && !defined(__APPLE__)
zBrowser = db_get("web-browser", "firefox");
#else
zBrowser = db_get("web-browser", "open");
|