Differences From:
File
src/main.c
part of check-in
[49380d500a]
- Continuing work on the ticketing system.
by
drh on
2008-05-28 18:48:12.
[view]
To:
File
src/main.c
part of check-in
[dcc48662f8]
- Better error messages when trying to run "fossil ui" with an invalid
or unaccessible repository.
by
drh on
2008-06-08 15:45:36.
[view]
@@ -72,8 +72,9 @@
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 */
@@ -245,9 +246,8 @@
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);
}
@@ -262,9 +262,8 @@
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);
}
@@ -636,22 +635,25 @@
** 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.httpOut = stdout;
+ g.fullHttpReply = 1;
+ 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]);
- if( g.argc==6 ){
- g.httpIn = fopen(g.argv[3], "rb");
- g.httpOut = fopen(g.argv[4], "wb");
- zIpAddr = g.argv[5];
- }
}else{
db_must_be_within_tree();
}
cgi_handle_http_request(zIpAddr);
@@ -697,10 +699,12 @@
}
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__)