Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Do not assume that the method is CGI just because the GATEWAY_INTERFACE environment variable is set. Only do CGI if GATEWAY_INTERFACE is set and there either is no argument specified, or the specified argument is not a valid command. Ticket [e49f245975f89a8a9]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:dcf839e4a6cd787eda162f5d8b803850cf714f99
User & Date: drh 2010-11-04 19:58:16
Context
2010-11-06
16:57
merge from trunk check-in: 3ea66260 user: wolfgang tags: StvPrivateHook2
13:52
Change the anonymous login cookie name to include a hash of the base URL. Ticket [3edef69bf3e995ed2] check-in: 9dd6c431 user: drh tags: trunk
2010-11-04
19:58
Do not assume that the method is CGI just because the GATEWAY_INTERFACE environment variable is set. Only do CGI if GATEWAY_INTERFACE is set and there either is no argument specified, or the specified argument is not a valid command. Ticket [e49f245975f89a8a9] check-in: dcf839e4 user: drh tags: trunk
19:24
Fix a couple of minor issues with settings, as pointed out on the mailing list. check-in: cb2ff51c user: drh tags: trunk
Changes

Changes to src/main.c.

221
222
223
224
225
226
227

228
229
230
231
232
233


234
235
236
237
238
239
240

241
242
243
244
245
246
247
248
249



250
251
252
253
254
255
256
/*
** This procedure runs first.
*/
int main(int argc, char **argv){
  const char *zCmdName = "unknown";
  int idx;
  int rc;


  sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
  g.now = time(0);
  g.argc = argc;
  g.argv = argv;
  if( getenv("GATEWAY_INTERFACE")!=0 ){


    zCmdName = "cgi";
  }else if( argc<2 ){
    fprintf(stderr, "Usage: %s COMMAND ...\n"
                    "\"%s help\" for a list of available commands\n"
                    "\"%s help COMMAND\" for specific details\n",
                    argv[0], argv[0], argv[0]);
    fossil_exit(1);

  }else{
    g.fQuiet = find_option("quiet", 0, 0)!=0;
    g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
    g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
    g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
    g.zLogin = find_option("user", "U", 1);
    zCmdName = argv[1];
  }
  rc = name_search(zCmdName, aCommand, count(aCommand), &idx);



  if( rc==1 ){
    fprintf(stderr,"%s: unknown command: %s\n"
                   "%s: use \"help\" for more information\n",
                   argv[0], zCmdName, argv[0]);
    fossil_exit(1);
  }else if( rc==2 ){
    fprintf(stderr,"%s: ambiguous command prefix: %s\n"







>





|
>
>
|
|
|
|
|
|
|
>









>
>
>







221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/*
** This procedure runs first.
*/
int main(int argc, char **argv){
  const char *zCmdName = "unknown";
  int idx;
  int rc;
  int mightBeCgi;

  sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
  g.now = time(0);
  g.argc = argc;
  g.argv = argv;
  mightBeCgi = getenv("GATEWAY_INTERFACE")!=0;
  if( argc<2 ){
    if( mightBeCgi ){
      zCmdName = "cgi";
    }else{
      fprintf(stderr, "Usage: %s COMMAND ...\n"
                      "\"%s help\" for a list of available commands\n"
                      "\"%s help COMMAND\" for specific details\n",
                      argv[0], argv[0], argv[0]);
      fossil_exit(1);
    }
  }else{
    g.fQuiet = find_option("quiet", 0, 0)!=0;
    g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
    g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
    g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
    g.zLogin = find_option("user", "U", 1);
    zCmdName = argv[1];
  }
  rc = name_search(zCmdName, aCommand, count(aCommand), &idx);
  if( rc==1 && mightBeCgi ){
    rc = name_search("cgi", aCommand, count(aCommand), &idx);
  }
  if( rc==1 ){
    fprintf(stderr,"%s: unknown command: %s\n"
                   "%s: use \"help\" for more information\n",
                   argv[0], zCmdName, argv[0]);
    fossil_exit(1);
  }else if( rc==2 ){
    fprintf(stderr,"%s: ambiguous command prefix: %s\n"