Fossil

Check-in [58e2f487]
Login

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

Overview
Comment:Add the 'cgiHeaderLine' command to TH1.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | th1CgiHeader
Files: files | file ages | folders
SHA3-256: 58e2f487e55181a1785d137f806ca828f729416f3bc1763eebaf9245a0496adf
User & Date: mistachkin 2019-01-11 05:32:43
Context
2019-01-11
05:34
Merge trunk. Closed-Leaf check-in: dbaee34d user: mistachkin tags: th1CgiHeader
05:32
Add the 'cgiHeaderLine' command to TH1. check-in: 58e2f487 user: mistachkin tags: th1CgiHeader
2019-01-10
18:25
Fix the remote_repo_info() function to avoid resource leaks and to suppress unhelpful error and warning messages. check-in: 1e3cfc1e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/th_main.c.

  1364   1364         return TH_ERROR;
  1365   1365       }
  1366   1366     }else{
  1367   1367       Th_SetResult(interp, "repository unavailable", -1);
  1368   1368       return TH_ERROR;
  1369   1369     }
  1370   1370   }
         1371  +
         1372  +/*
         1373  +** TH1 command: cgiHeaderLine line
         1374  +**
         1375  +** Adds the specified line to the CGI header.
         1376  +*/
         1377  +static int cgiHeaderLineCmd(
         1378  +  Th_Interp *interp,
         1379  +  void *p,
         1380  +  int argc,
         1381  +  const char **argv,
         1382  +  int *argl
         1383  +){
         1384  +  if( argc!=2 ){
         1385  +    return Th_WrongNumArgs(interp, "cgiHeaderLine line");
         1386  +  }
         1387  +  cgi_append_header(argv[1]);
         1388  +  return TH_OK;
         1389  +}
  1371   1390   
  1372   1391   /*
  1373   1392   ** TH1 command: unversioned content FILENAME
  1374   1393   **
  1375   1394   ** Attempts to locate the specified unversioned file and return its contents.
  1376   1395   ** An error is generated if the repository is not open or the unversioned file
  1377   1396   ** cannot be found.
................................................................................
  1980   1999       const char *zName;
  1981   2000       Th_CommandProc xProc;
  1982   2001       void *pContext;
  1983   2002     } aCommand[] = {
  1984   2003       {"anoncap",       hascapCmd,            (void*)&anonFlag},
  1985   2004       {"anycap",        anycapCmd,            0},
  1986   2005       {"artifact",      artifactCmd,          0},
         2006  +    {"cgiHeaderLine", cgiHeaderLineCmd,     0},
  1987   2007       {"checkout",      checkoutCmd,          0},
  1988   2008       {"combobox",      comboboxCmd,          0},
  1989   2009       {"date",          dateCmd,              0},
  1990   2010       {"decorate",      wikiCmd,              (void*)&aFlags[2]},
  1991   2011       {"dir",           dirCmd,               0},
  1992   2012       {"enable_output", enableOutputCmd,      0},
  1993   2013       {"encode64",      encode64Cmd,          0},

Changes to test/th1.test.

  1027   1027   #       moved from Tcl builds to plain or the reverse. Sorting the
  1028   1028   #       command lists eliminates a dependence on order.
  1029   1029   #
  1030   1030   fossil test-th-eval "info commands"
  1031   1031   set sorted_result [lsort $RESULT]
  1032   1032   protOut "Sorted: $sorted_result"
  1033   1033   set base_commands {anoncap anycap array artifact break breakpoint catch\
  1034         -      checkout combobox continue date decorate dir enable_output encode64\
  1035         -      error expr for getParameter glob_match globalState hascap hasfeature\
  1036         -      html htmlize http httpize if info insertCsrf lindex linecount list\
  1037         -      llength lsearch markdown proc puts query randhex redirect regexp\
         1034  +      cgiHeaderLine checkout combobox continue date decorate dir enable_output \
         1035  +      encode64 error expr for getParameter glob_match globalState hascap \
         1036  +      hasfeature html htmlize http httpize if info insertCsrf lindex linecount \
         1037  +      list llength lsearch markdown proc puts query randhex redirect regexp\
  1038   1038         reinitialize rename render repository return searchable set\
  1039         -      setParameter setting stime string styleFooter styleHeader tclReady\
  1040         -      trace unset unversioned uplevel upvar utime verifyCsrf wiki}
         1039  +      setParameter setting stime string styleFooter styleHeader styleScript\
         1040  +      tclReady trace unset unversioned uplevel upvar utime verifyCsrf wiki}
  1041   1041   set tcl_commands {tclEval tclExpr tclInvoke tclIsSafe tclMakeSafe}
  1042   1042   if {$th1Tcl} {
  1043   1043     test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands $tcl_commands"]}
  1044   1044   } else {
  1045   1045     test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands"]}
  1046   1046   }
  1047   1047   

Changes to www/th1.md.

   165    165   
   166    166   There are many new commands added to TH1 and used to access the special
   167    167   features of Fossil.  The following is a summary of the extended commands:
   168    168   
   169    169     *  anoncap
   170    170     *  anycap
   171    171     *  artifact
          172  +  *  cgiHeaderLine
   172    173     *  checkout
   173    174     *  combobox
   174    175     *  date
   175    176     *  decorate
   176    177     *  dir
   177    178     *  enable\_output
   178    179     *  encode64
................................................................................
   244    245   -------------------------------------------
   245    246   
   246    247     *  artifact ID ?FILENAME?
   247    248   
   248    249   Attempts to locate the specified artifact and return its contents.  An
   249    250   error is generated if the repository is not open or the artifact cannot
   250    251   be found.
          252  +
          253  +<a name="cgiHeaderLine"></a>TH1 cgiHeader Command
          254  +-------------------------------------------------
          255  +
          256  +  *  cgiHeaderLine line
          257  +
          258  +Adds the specified line to the CGI header.
   251    259   
   252    260   <a name="checkout"></a>TH1 checkout Command
   253    261   -------------------------------------------
   254    262   
   255    263     *  checkout ?BOOLEAN?
   256    264   
   257    265   Return the fully qualified directory name of the current checkout or an