Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Merged from trunk to pick up work in progress and a bug fix to tester.tcl. Fixed issue introduced by the addition of the insertCsrf and verifyCsrf commands from ci [f8820eff] which broke the test th1-info-commands. Also fixed the dependence on the order of commands output by TH1. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | rberteig-json-test |
Files: | files | file ages | folders |
SHA1: |
2de15c8e3b85ccc6f4aa51cf79de7539 |
User & Date: | rberteig 2016-02-06 02:03:29.127 |
2016-02-06
| ||
02:46 | Add test cases for fossil json. Improve the test suite to support a way to treat expected non-zero status exits from fossil as success when warrented. Made minor bug fixes to the test framework, and to several test cases unrelated to JSON support. ... (check-in: 62627615 user: rberteig tags: trunk) | |
02:03 | Merged from trunk to pick up work in progress and a bug fix to tester.tcl. Fixed issue introduced by the addition of the insertCsrf and verifyCsrf commands from ci [f8820eff] which broke the test th1-info-commands. Also fixed the dependence on the order of commands output by TH1. ... (Closed-Leaf check-in: 2de15c8e user: rberteig tags: rberteig-json-test) | |
2016-02-05
| ||
23:46 | On Windows, normalize the Fossil executable file extension used by the test suite. ... (check-in: 74ce4181 user: mistachkin tags: trunk) | |
2016-02-02
| ||
02:32 | Minor tweaks in a few test cases, placeholder for cases to exercise documented error codes. ... (check-in: 9f45c8b6 user: rberteig tags: rberteig-json-test) | |
2016-02-01
| ||
20:38 | Add --https and --nossl options to the 'server' command. ... (check-in: b8c7af5b user: mistachkin tags: trunk) | |
Changes to auto.def.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | # Find tclsh for the test suite. Can't yet use jimsh for this. cc-check-progs tclsh define EXTRA_CFLAGS "" define EXTRA_LDFLAGS "" define USE_SYSTEM_SQLITE 0 define USE_LINENOISE 0 if {![opt-bool internal-sqlite]} { proc find_internal_sqlite {} { # On some systems (slackware), libsqlite3 requires -ldl to link. So # search for the system SQLite once with -ldl, and once without. If # the library can only be found with $extralibs set to -ldl, then # the code below will append -ldl to LIBS. # foreach extralibs {{} {-ldl}} { # Locate the system SQLite by searching for sqlite3_open(). Then check # if sqlite3_strglob() can be found as well. If we can find open() but # not strglob(), then the system SQLite is too old to link against # fossil. # | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | # Find tclsh for the test suite. Can't yet use jimsh for this. cc-check-progs tclsh define EXTRA_CFLAGS "" define EXTRA_LDFLAGS "" define USE_SYSTEM_SQLITE 0 define USE_LINENOISE 0 # This procedure is a customized version of "cc-check-function-in-lib", # that does not modify the LIBS variable. Its use prevents prematurely # pulling in libraries that will be added later anyhow (e.g. "-ldl"). proc check-function-in-lib {function libs {otherlibs {}}} { if {[string length $otherlibs]} { msg-checking "Checking for $function in $libs with $otherlibs..." } else { msg-checking "Checking for $function in $libs..." } set found 0 cc-with [list -libs $otherlibs] { if {[cctest_function $function]} { msg-result "none needed" define lib_$function "" incr found } else { foreach lib $libs { cc-with [list -libs -l$lib] { if {[cctest_function $function]} { msg-result -l$lib define lib_$function -l$lib incr found break } } } } } if {$found} { define [feature-define-name $function] } else { msg-result "no" } return $found } if {![opt-bool internal-sqlite]} { proc find_internal_sqlite {} { # On some systems (slackware), libsqlite3 requires -ldl to link. So # search for the system SQLite once with -ldl, and once without. If # the library can only be found with $extralibs set to -ldl, then # the code below will append -ldl to LIBS. # foreach extralibs {{} {-ldl}} { # Locate the system SQLite by searching for sqlite3_open(). Then check # if sqlite3_strglob() can be found as well. If we can find open() but # not strglob(), then the system SQLite is too old to link against # fossil. # if {[check-function-in-lib sqlite3_open sqlite3 $extralibs]} { if {![check-function-in-lib sqlite3_malloc64 sqlite3 $extralibs]} { user-error "system sqlite3 too old (require >= 3.8.7)" } # Success. Update symbols and return. # define USE_SYSTEM_SQLITE 1 define-append LIBS -lsqlite3 define-append LIBS $extralibs return } } user-error "system sqlite3 not found" } |
140 141 142 143 144 145 146 147 148 149 150 151 152 153 | # XXX: This will not work on all systems. define-append EXTRA_LDFLAGS -static msg-result "Trying to link statically" } else { define-append EXTRA_CFLAGS -DFOSSIL_DYNAMIC_BUILD=1 define FOSSIL_DYNAMIC_BUILD } set tclpath [opt-val with-tcl] if {$tclpath ne ""} { set tclprivatestubs [opt-bool with-tcl-private-stubs] # Note parse-tclconfig-sh is in autosetup/local.tcl if {$tclpath eq "1"} { set tcldir [file dirname $autosetup(dir)]/compat/tcl-8.6 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 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 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | # XXX: This will not work on all systems. define-append EXTRA_LDFLAGS -static msg-result "Trying to link statically" } else { define-append EXTRA_CFLAGS -DFOSSIL_DYNAMIC_BUILD=1 define FOSSIL_DYNAMIC_BUILD } # Helper for OpenSSL checking proc check-for-openssl {msg {cflags {}} {libs {-lssl -lcrypto}}} { msg-checking "Checking for $msg..." set rc 0 if {[is_mingw]} { lappend libs -lgdi32 -lwsock32 } if {[info exists ::zlib_lib]} { lappend libs $::zlib_lib } msg-quiet cc-with [list -cflags $cflags -libs $libs] { if {[cc-check-includes openssl/ssl.h] && \ [cc-check-functions SSL_new]} { incr rc } } if {!$rc && ![is_mingw]} { # On some systems, OpenSSL appears to require -ldl to link. lappend libs -ldl msg-quiet cc-with [list -cflags $cflags -libs $libs] { if {[cc-check-includes openssl/ssl.h] && \ [cc-check-functions SSL_new]} { incr rc } } } if {$rc} { msg-result "ok" return 1 } else { msg-result "no" return 0 } } if {[opt-bool with-miniz]} { define FOSSIL_ENABLE_MINIZ 1 msg-result "Using miniz for compression" } else { # Check for zlib, using the given location if specified set zlibpath [opt-val with-zlib] if {$zlibpath eq "tree"} { set zlibdir [file dirname $autosetup(dir)]/compat/zlib if {![file isdirectory $zlibdir]} { user-error "The zlib in source tree directory does not exist" } cc-with [list -cflags "-I$zlibdir -L$zlibdir"] define-append EXTRA_CFLAGS -I$zlibdir define-append LIBS $zlibdir/libz.a set ::zlib_lib $zlibdir/libz.a msg-result "Using zlib in source tree" } else { if {$zlibpath ni {auto ""}} { cc-with [list -cflags "-I$zlibpath -L$zlibpath"] define-append EXTRA_CFLAGS -I$zlibpath define-append EXTRA_LDFLAGS -L$zlibpath msg-result "Using zlib from $zlibpath" } if {![cc-check-includes zlib.h] || ![check-function-in-lib inflateEnd z]} { user-error "zlib not found please install it or specify the location with --with-zlib" } set ::zlib_lib -lz } } set ssldirs [opt-val with-openssl] if {$ssldirs ne "none"} { if {[opt-bool with-miniz]} { user-error "The --with-miniz option is incompatible with OpenSSL" } set found 0 if {$ssldirs eq "tree"} { set ssldir [file dirname $autosetup(dir)]/compat/openssl if {![file isdirectory $ssldir]} { user-error "The OpenSSL in source tree directory does not exist" } set msg "ssl in $ssldir" set cflags "-I$ssldir/include" set ldflags "-L$ssldir" set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a" set found [check-for-openssl "ssl in source tree" "$cflags $ldflags" $ssllibs] } else { if {$ssldirs in {auto ""}} { catch { set cflags [exec pkg-config openssl --cflags-only-I] set ldflags [exec pkg-config openssl --libs-only-L] set found [check-for-openssl "ssl via pkg-config" "$cflags $ldflags"] } msg if {!$found} { set ssldirs "{} /usr/sfw /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr" } } if {!$found} { foreach dir $ssldirs { if {$dir eq ""} { set msg "system ssl" set cflags "" set ldflags "" } else { set msg "ssl in $dir" set cflags "-I$dir/include" set ldflags "-L$dir/lib" } if {[check-for-openssl $msg "$cflags $ldflags"]} { incr found break } } } } if {$found} { define FOSSIL_ENABLE_SSL define-append EXTRA_CFLAGS $cflags define-append EXTRA_LDFLAGS $ldflags if {[info exists ssllibs]} { define-append LIBS $ssllibs } else { define-append LIBS -lssl -lcrypto } if {[info exists ::zlib_lib]} { define-append LIBS $::zlib_lib } if {[is_mingw]} { define-append LIBS -lgdi32 -lwsock32 } msg-result "HTTPS support enabled" # Silence OpenSSL deprecation warnings on Mac OS X 10.7. if {[string match *-darwin* [get-define host]]} { if {[cctest -cflags {-Wdeprecated-declarations}]} { define-append EXTRA_CFLAGS -Wdeprecated-declarations } } } else { user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support" } } else { if {[info exists ::zlib_lib]} { define-append LIBS $::zlib_lib } } set tclpath [opt-val with-tcl] if {$tclpath ne ""} { set tclprivatestubs [opt-bool with-tcl-private-stubs] # Note parse-tclconfig-sh is in autosetup/local.tcl if {$tclpath eq "1"} { set tcldir [file dirname $autosetup(dir)]/compat/tcl-8.6 |
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | } } else { if {[cc-check-functions Tcl_CreateInterp]} { set foundtcl 1 } } } } if {!$foundtcl} { if {$tclstubs} { user-error "Cannot find a usable Tcl stubs library $msg" } else { user-error "Cannot find a usable Tcl library $msg" } } } set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL) msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)" if {!$tclprivatestubs} { define-append LIBS $libs } define-append EXTRA_CFLAGS $cflags define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS) define FOSSIL_ENABLE_TCL } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | } } else { if {[cc-check-functions Tcl_CreateInterp]} { set foundtcl 1 } } } } if {!$foundtcl && ![string match *-lpthread* $libs]} { # On some systems, TCL_LIB_SPEC appears to be missing # "-lpthread". Try adding it. msg-result "Adding \"-lpthread\" and retrying for Tcl..." set libs "$libs -lpthread" cc-with [list -cflags $cflags -libs $libs] { if {$tclstubs} { if {[cc-check-functions Tcl_InitStubs]} { set foundtcl 1 } } else { if {[cc-check-functions Tcl_CreateInterp]} { set foundtcl 1 } } } } if {!$foundtcl} { if {$tclstubs} { user-error "Cannot find a usable Tcl stubs library $msg" } else { user-error "Cannot find a usable Tcl library $msg" } } } set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL) msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)" if {!$tclprivatestubs} { define-append LIBS $libs } define-append EXTRA_CFLAGS $cflags if {[info exists zlibpath] && $zlibpath eq "tree"} { # # NOTE: When using zlib in the source tree, prevent Tcl from # pulling in the system one. # set tclconfig(TCL_LD_FLAGS) [string map [list -lz ""] \ $tclconfig(TCL_LD_FLAGS)] } # # NOTE: Remove "-ldl" from the TCL_LD_FLAGS because it will be # be checked for near the bottom of this file. # set tclconfig(TCL_LD_FLAGS) [string map [list -ldl ""] \ $tclconfig(TCL_LD_FLAGS)] define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS) define FOSSIL_ENABLE_TCL } # Network functions require libraries on some systems cc-check-function-in-lib gethostbyname nsl if {![cc-check-function-in-lib socket {socket network}]} { # Last resort, may be Windows if {[is_mingw]} { define-append LIBS -lwsock32 } |
Changes to src/json_detail.h.
182 183 184 185 186 187 188 | ** ** <0 = CLI only, >0 = HTTP only, 0==both ** ** Now that we can simulate POST in CLI mode, the distinction ** between them has disappeared in most (or all) cases, so 0 is ** the standard value. */ | | | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | ** ** <0 = CLI only, >0 = HTTP only, 0==both ** ** Now that we can simulate POST in CLI mode, the distinction ** between them has disappeared in most (or all) cases, so 0 is ** the standard value. */ int runMode; } JsonPageDef; /* ** Holds common keys used for various JSON API properties. */ typedef struct FossilJsonKeys_{ /** maintainers: please keep alpha sorted (case-insensitive) */ |
Changes to src/login.c.
1073 1074 1075 1076 1077 1078 1079 | int i; FossilUserPerms *p = (flags & LOGIN_ANON) ? &g.anon : &g.perm; if(NULL==zCap){ return; } for(i=0; zCap[i]; i++){ switch( zCap[i] ){ | | | | | | | > | | | | 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 | int i; FossilUserPerms *p = (flags & LOGIN_ANON) ? &g.anon : &g.perm; if(NULL==zCap){ return; } for(i=0; zCap[i]; i++){ switch( zCap[i] ){ case 's': p->Setup = 1; /* Fall thru into Admin */ case 'a': p->Admin = p->RdTkt = p->WrTkt = p->Zip = p->RdWiki = p->WrWiki = p->NewWiki = p->ApndWiki = p->Hyperlink = p->Clone = p->NewTkt = p->Password = p->RdAddr = p->TktFmt = p->Attach = p->ApndTkt = p->ModWiki = p->ModTkt = p->Delete = p->Private = 1; /* Fall thru into Read/Write */ case 'i': p->Read = p->Write = 1; break; case 'o': p->Read = 1; break; case 'z': p->Zip = 1; break; case 'd': p->Delete = 1; break; case 'h': p->Hyperlink = 1; break; case 'g': p->Clone = 1; break; case 'p': p->Password = 1; break; case 'j': p->RdWiki = 1; break; case 'k': p->WrWiki = p->RdWiki = p->ApndWiki =1; break; case 'm': p->ApndWiki = 1; break; case 'f': p->NewWiki = 1; break; case 'l': p->ModWiki = 1; break; case 'e': p->RdAddr = 1; break; case 'r': p->RdTkt = 1; break; case 'n': p->NewTkt = 1; break; |
1179 1180 1181 1182 1183 1184 1185 | case 't': rc = p->TktFmt; break; /* case 'u': READER */ /* case 'v': DEVELOPER */ case 'w': rc = p->WrTkt; break; case 'x': rc = p->Private; break; /* case 'y': */ case 'z': rc = p->Zip; break; | | | 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 | case 't': rc = p->TktFmt; break; /* case 'u': READER */ /* case 'v': DEVELOPER */ case 'w': rc = p->WrTkt; break; case 'x': rc = p->Private; break; /* case 'y': */ case 'z': rc = p->Zip; break; default: rc = 0; break; } } return rc; } /* ** Change the login to zUser. |
1287 1288 1289 1290 1291 1292 1293 | void login_insert_csrf_secret(void){ @ <input type="hidden" name="csrf" value="%s(g.zCsrfToken)" /> } /* ** Before using the results of a form, first call this routine to verify ** that this Anti-CSRF token is present and is valid. If the Anti-CSRF token | | | > | 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 | void login_insert_csrf_secret(void){ @ <input type="hidden" name="csrf" value="%s(g.zCsrfToken)" /> } /* ** Before using the results of a form, first call this routine to verify ** that this Anti-CSRF token is present and is valid. If the Anti-CSRF token ** is missing or is incorrect, that indicates a cross-site scripting attack. ** If the event of an attack is detected, an error message is generated and ** all further processing is aborted. */ void login_verify_csrf_secret(void){ if( g.okCsrf ) return; if( fossil_strcmp(P("csrf"), g.zCsrfToken)==0 ){ g.okCsrf = 1; return; } |
Changes to src/main.c.
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 | ** This function returns a human readable version string. */ const char *get_version(){ static const char version[] = RELEASE_VERSION " " MANIFEST_VERSION " " MANIFEST_DATE " UTC"; return version; } /* ** This function returns the user-agent string for Fossil, for ** use in HTTP(S) requests. */ const char *get_user_agent(){ static const char version[] = "Fossil/" RELEASE_VERSION " (" MANIFEST_DATE " " MANIFEST_VERSION ")"; return version; } /* ** COMMAND: version ** ** Usage: %fossil version ?-verbose|-v? ** ** Print the source code version number for the fossil executable. ** If the verbose option is specified, additional details will ** be output about what optional features this binary was compiled ** with */ void version_cmd(void){ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < | < | > > | | | < < < < < < < > | > | > > > | > | < < < < | < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | > > > > > > > > > | 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 | ** This function returns a human readable version string. */ const char *get_version(){ static const char version[] = RELEASE_VERSION " " MANIFEST_VERSION " " MANIFEST_DATE " UTC"; return version; } /* ** This function populates a blob with version information. It is used by ** the "version" command and "test-version" web page. It assumes the blob ** passed to it is uninitialized; otherwise, it will leak memory. */ static void get_version_blob( Blob *pOut, /* Write the manifest here */ int bVerbose /* Non-zero for full information. */ ){ #if defined(FOSSIL_ENABLE_TCL) int rc; const char *zRc; #endif blob_zero(pOut); blob_appendf(pOut, "This is fossil version %s\n", get_version()); if( !bVerbose ) return; blob_appendf(pOut, "Compiled on %s %s using %s (%d-bit)\n", __DATE__, __TIME__, COMPILER_NAME, sizeof(void*)*8); blob_appendf(pOut, "SQLite %s %.30s\n", sqlite3_libversion(), sqlite3_sourceid()); blob_appendf(pOut, "Schema version %s\n", AUX_SCHEMA_MAX); #if defined(FOSSIL_ENABLE_MINIZ) blob_appendf(pOut, "miniz %s, loaded %s\n", MZ_VERSION, mz_version()); #else blob_appendf(pOut, "zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion()); #endif #if defined(FOSSIL_ENABLE_SSL) blob_appendf(pOut, "SSL (%s)\n", SSLeay_version(SSLEAY_VERSION)); #endif #if defined(FOSSIL_ENABLE_LEGACY_MV_RM) blob_append(pOut, "LEGACY_MV_RM\n", -1); #endif #if defined(FOSSIL_ENABLE_EXEC_REL_PATHS) blob_append(pOut, "EXEC_REL_PATHS\n", -1); #endif #if defined(FOSSIL_ENABLE_TH1_DOCS) blob_append(pOut, "TH1_DOCS\n", -1); #endif #if defined(FOSSIL_ENABLE_TH1_HOOKS) blob_append(pOut, "TH1_HOOKS\n", -1); #endif #if defined(FOSSIL_ENABLE_TCL) Th_FossilInit(TH_INIT_DEFAULT | TH_INIT_FORCE_TCL); rc = Th_Eval(g.interp, 0, "tclInvoke info patchlevel", -1); zRc = Th_ReturnCodeName(rc, 0); blob_appendf(pOut, "TCL (Tcl %s, loaded %s: %s)\n", TCL_PATCH_LEVEL, zRc, Th_GetResult(g.interp, 0) ); #endif #if defined(USE_TCL_STUBS) blob_append(pOut, "USE_TCL_STUBS\n", -1); #endif #if defined(FOSSIL_ENABLE_TCL_STUBS) blob_append(pOut, "TCL_STUBS\n", -1); #endif #if defined(FOSSIL_ENABLE_TCL_PRIVATE_STUBS) blob_append(pOut, "TCL_PRIVATE_STUBS\n", -1); #endif #if defined(FOSSIL_ENABLE_JSON) blob_appendf(pOut, "JSON (API %s)\n", FOSSIL_JSON_API_VERSION); #endif #if defined(BROKEN_MINGW_CMDLINE) blob_append(pOut, "MBCS_COMMAND_LINE\n", -1); #else blob_append(pOut, "UNICODE_COMMAND_LINE\n", -1); #endif #if defined(FOSSIL_DYNAMIC_BUILD) blob_append(pOut, "DYNAMIC_BUILD\n", -1); #else blob_append(pOut, "STATIC_BUILD\n", -1); #endif } /* ** This function returns the user-agent string for Fossil, for ** use in HTTP(S) requests. */ const char *get_user_agent(){ static const char version[] = "Fossil/" RELEASE_VERSION " (" MANIFEST_DATE " " MANIFEST_VERSION ")"; return version; } /* ** COMMAND: version ** ** Usage: %fossil version ?-verbose|-v? ** ** Print the source code version number for the fossil executable. ** If the verbose option is specified, additional details will ** be output about what optional features this binary was compiled ** with */ void version_cmd(void){ Blob versionInfo; int verboseFlag = find_option("verbose","v",0)!=0; /* We should be done with options.. */ verify_all_options(); get_version_blob(&versionInfo, verboseFlag); fossil_print("%s", blob_str(&versionInfo)); } /* ** WEBPAGE: test-version ** ** Show the version information for Fossil. ** ** Query parameters: ** ** verbose Show all available details. */ void test_version_page(void){ Blob versionInfo; int verboseFlag; login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } verboseFlag = P("verbose")!=0; style_header("Version Information"); get_version_blob(&versionInfo, verboseFlag); @ <blockquote><pre> @ %h(blob_str(&versionInfo)) @ </pre></blockquote> style_footer(); } /* ** COMMAND: help ** ** Usage: %fossil help COMMAND |
1359 1360 1361 1362 1363 1364 1365 | const char *zMode; const char *zCur; if( g.zBaseURL!=0 ) return; if( zAltBase ){ int i, n, c; g.zTop = g.zBaseURL = mprintf("%s", zAltBase); | | > > > > > > | 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 | const char *zMode; const char *zCur; if( g.zBaseURL!=0 ) return; if( zAltBase ){ int i, n, c; g.zTop = g.zBaseURL = mprintf("%s", zAltBase); if( strncmp(g.zTop, "http://", 7)==0 ){ /* it is HTTP, replace prefix with HTTPS. */ g.zHttpsURL = mprintf("https://%s", &g.zTop[7]); }else if( strncmp(g.zTop, "https://", 8)==0 ){ /* it is already HTTPS, use it. */ g.zHttpsURL = mprintf("%s", g.zTop); }else{ fossil_fatal("argument to --baseurl should be 'http://host/path'" " or 'https://host/path'"); } for(i=n=0; (c = g.zTop[i])!=0; i++){ if( c=='/' ){ n++; if( n==3 ){ |
2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 | ** Options: ** --baseurl URL Use URL as the base (useful for reverse proxies) ** --create Create a new REPOSITORY if it does not already exist ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci" ** --files GLOBLIST Comma-separated list of glob patterns for static files ** --localauth enable automatic login for requests from localhost ** --localhost listen on 127.0.0.1 only (always true for "ui") ** --nojail Drop root privileges but do not enter the chroot jail ** --notfound URL Redirect ** -P|--port TCPPORT listen to request on port TCPPORT ** --th-trace trace TH1 execution (for debugging purposes) ** --repolist If REPOSITORY is dir, URL "/" lists repos. ** --scgi Accept SCGI rather than HTTP ** --skin LABEL Use override skin LABEL | > > | 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 | ** Options: ** --baseurl URL Use URL as the base (useful for reverse proxies) ** --create Create a new REPOSITORY if it does not already exist ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci" ** --files GLOBLIST Comma-separated list of glob patterns for static files ** --localauth enable automatic login for requests from localhost ** --localhost listen on 127.0.0.1 only (always true for "ui") ** --https signal a request coming in via https ** --nojail Drop root privileges but do not enter the chroot jail ** --nossl signal that no SSL connections are available ** --notfound URL Redirect ** -P|--port TCPPORT listen to request on port TCPPORT ** --th-trace trace TH1 execution (for debugging purposes) ** --repolist If REPOSITORY is dir, URL "/" lists repos. ** --scgi Accept SCGI rather than HTTP ** --skin LABEL Use override skin LABEL |
2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 | zNotFound = find_option("notfound", 0, 1); allowRepoList = find_option("repolist",0,0)!=0; zAltBase = find_option("baseurl", 0, 1); fCreate = find_option("create",0,0)!=0; if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; if( zAltBase ){ set_base_url(zAltBase); } if( find_option("localhost", 0, 0)!=0 ){ flags |= HTTP_SERVER_LOCALHOST; } /* We should be done with options.. */ verify_all_options(); | > > > > > > > | 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 | zNotFound = find_option("notfound", 0, 1); allowRepoList = find_option("repolist",0,0)!=0; zAltBase = find_option("baseurl", 0, 1); fCreate = find_option("create",0,0)!=0; if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; if( zAltBase ){ set_base_url(zAltBase); } g.sslNotAvailable = find_option("nossl", 0, 0)!=0; if( find_option("https",0,0)!=0 ){ cgi_replace_parameter("HTTPS","on"); }else{ /* without --https, defaults to not available. */ g.sslNotAvailable = 1; } if( find_option("localhost", 0, 0)!=0 ){ flags |= HTTP_SERVER_LOCALHOST; } /* We should be done with options.. */ verify_all_options(); |
2513 2514 2515 2516 2517 2518 2519 | } if( g.repositoryOpen ) flags |= HTTP_SERVER_HAD_REPOSITORY; if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; db_close(1); if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ fossil_fatal("unable to listen on TCP socket %d", iPort); } | < | 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 | } if( g.repositoryOpen ) flags |= HTTP_SERVER_HAD_REPOSITORY; if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; db_close(1); if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ fossil_fatal("unable to listen on TCP socket %d", iPort); } g.httpIn = stdin; g.httpOut = stdout; if( g.fHttpTrace || g.fSqlTrace ){ fprintf(stderr, "====== SERVER pid %d =======\n", getpid()); } g.cgiOutput = 1; find_server_repository(2, 0); |
Changes to src/makemake.tcl.
615 616 617 618 619 620 621 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # | | | 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2f OPENSSLINCDIR = $(OPENSSLDIR)/include OPENSSLLIBDIR = $(OPENSSLDIR) #### Either the directory where the Tcl library is installed or the Tcl # source code directory resides (depending on the value of the macro # FOSSIL_TCL_SOURCE). If this points to the Tcl install directory, # this directory must have "include" and "lib" sub-directories. If |
1404 1405 1406 1407 1408 1409 1410 | # Enable support for Windows XP with Visual Studio 201x? !ifndef FOSSIL_ENABLE_WINXP FOSSIL_ENABLE_WINXP = 0 !endif !if $(FOSSIL_ENABLE_SSL)!=0 | | | 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 | # Enable support for Windows XP with Visual Studio 201x? !ifndef FOSSIL_ENABLE_WINXP FOSSIL_ENABLE_WINXP = 0 !endif !if $(FOSSIL_ENABLE_SSL)!=0 SSLDIR = $(B)\compat\openssl-1.0.2f SSLINCDIR = $(SSLDIR)\inc32 !if $(FOSSIL_DYNAMIC_BUILD)!=0 SSLLIBDIR = $(SSLDIR)\out32dll !else SSLLIBDIR = $(SSLDIR)\out32 !endif SSLLFLAGS = /nologo /opt:ref /debug |
Changes to src/th_lang.c.
988 989 990 991 992 993 994 | Th_SetResultInt(interp, rc); return TH_OK; } /* ** TH Syntax: ** | | | 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 | Th_SetResultInt(interp, rc); return TH_OK; } /* ** TH Syntax: ** ** array names VARNAME */ static int array_names_command( Th_Interp *interp, void *ctx, int argc, const char **argv, int *argl ){ int rc; char *zElem = 0; int nElem = 0; |
1012 1013 1014 1015 1016 1017 1018 | if( zElem ) Th_Free(interp, zElem); return TH_OK; } /* ** TH Syntax: ** | | | 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 | if( zElem ) Th_Free(interp, zElem); return TH_OK; } /* ** TH Syntax: ** ** unset VARNAME */ static int unset_command( Th_Interp *interp, void *ctx, int argc, const char **argv, int *argl |
Changes to src/th_main.c.
428 429 430 431 432 433 434 435 436 437 438 439 440 441 | ){ if( argc!=2 ){ return Th_WrongNumArgs(interp, "puts STRING"); } sendText((char*)argv[1], argl[1], *(unsigned int*)pConvert); return TH_OK; } /* ** TH1 command: markdown STRING ** ** Renders the input string as markdown. The result is a two-element list. ** The first element is the text-only title string. The second element ** contains the body, rendered as HTML. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | ){ if( argc!=2 ){ return Th_WrongNumArgs(interp, "puts STRING"); } sendText((char*)argv[1], argl[1], *(unsigned int*)pConvert); return TH_OK; } /* ** TH1 command: redirect URL ** ** Issues an HTTP redirect (302) to the specified URL and then exits the ** process. */ static int redirectCmd( Th_Interp *interp, void *p, int argc, const char **argv, int *argl ){ if( argc!=2 ){ return Th_WrongNumArgs(interp, "redirect URL"); } cgi_redirect(argv[1]); Th_SetResult(interp, argv[1], argl[1]); /* NOT REACHED */ return TH_OK; } /* ** TH1 command: insertCsrf ** ** While rendering a form, call this command to add the Anti-CSRF token ** as a hidden element of the form. */ static int insertCsrfCmd( Th_Interp *interp, void *p, int argc, const char **argv, int *argl ){ if( argc!=1 ){ return Th_WrongNumArgs(interp, "insertCsrf"); } login_insert_csrf_secret(); return TH_OK; } /* ** TH1 command: verifyCsrf ** ** Before using the results of a form, first call this command to verify ** that this Anti-CSRF token is present and is valid. If the Anti-CSRF token ** is missing or is incorrect, that indicates a cross-site scripting attack. ** If the event of an attack is detected, an error message is generated and ** all further processing is aborted. */ static int verifyCsrfCmd( Th_Interp *interp, void *p, int argc, const char **argv, int *argl ){ if( argc!=1 ){ return Th_WrongNumArgs(interp, "verifyCsrf"); } login_verify_csrf_secret(); return TH_OK; } /* ** TH1 command: markdown STRING ** ** Renders the input string as markdown. The result is a two-element list. ** The first element is the text-only title string. The second element ** contains the body, rendered as HTML. |
1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 | {"globalState", globalStateCmd, 0}, {"httpize", httpizeCmd, 0}, {"hascap", hascapCmd, (void*)&zeroInt}, {"hasfeature", hasfeatureCmd, 0}, {"html", putsCmd, (void*)&aFlags[0]}, {"htmlize", htmlizeCmd, 0}, {"http", httpCmd, 0}, {"linecount", linecntCmd, 0}, {"markdown", markdownCmd, 0}, {"puts", putsCmd, (void*)&aFlags[1]}, {"query", queryCmd, 0}, {"randhex", randhexCmd, 0}, {"regexp", regexpCmd, 0}, {"reinitialize", reinitializeCmd, 0}, {"render", renderCmd, 0}, {"repository", repositoryCmd, 0}, {"searchable", searchableCmd, 0}, {"setParameter", setParameterCmd, 0}, {"setting", settingCmd, 0}, {"styleHeader", styleHeaderCmd, 0}, {"styleFooter", styleFooterCmd, 0}, {"tclReady", tclReadyCmd, 0}, {"trace", traceCmd, 0}, {"stime", stimeCmd, 0}, {"utime", utimeCmd, 0}, {"wiki", wikiCmd, (void*)&aFlags[0]}, {0, 0, 0} }; if( g.thTrace ){ Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags); } if( needConfig ){ | > > > | 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 | {"globalState", globalStateCmd, 0}, {"httpize", httpizeCmd, 0}, {"hascap", hascapCmd, (void*)&zeroInt}, {"hasfeature", hasfeatureCmd, 0}, {"html", putsCmd, (void*)&aFlags[0]}, {"htmlize", htmlizeCmd, 0}, {"http", httpCmd, 0}, {"insertCsrf", insertCsrfCmd, 0}, {"linecount", linecntCmd, 0}, {"markdown", markdownCmd, 0}, {"puts", putsCmd, (void*)&aFlags[1]}, {"query", queryCmd, 0}, {"randhex", randhexCmd, 0}, {"redirect", redirectCmd, 0}, {"regexp", regexpCmd, 0}, {"reinitialize", reinitializeCmd, 0}, {"render", renderCmd, 0}, {"repository", repositoryCmd, 0}, {"searchable", searchableCmd, 0}, {"setParameter", setParameterCmd, 0}, {"setting", settingCmd, 0}, {"styleHeader", styleHeaderCmd, 0}, {"styleFooter", styleFooterCmd, 0}, {"tclReady", tclReadyCmd, 0}, {"trace", traceCmd, 0}, {"stime", stimeCmd, 0}, {"utime", utimeCmd, 0}, {"verifyCsrf", verifyCsrfCmd, 0}, {"wiki", wikiCmd, (void*)&aFlags[0]}, {0, 0, 0} }; if( g.thTrace ){ Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags); } if( needConfig ){ |
2289 2290 2291 2292 2293 2294 2295 | ** ** --cgi Include a CGI response header in the output ** --http Include an HTTP response header in the output ** --open-config Open the configuration database ** --th-trace Trace TH1 execution (for debugging purposes) */ void test_th_render(void){ | | | 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 | ** ** --cgi Include a CGI response header in the output ** --http Include an HTTP response header in the output ** --open-config Open the configuration database ** --th-trace Trace TH1 execution (for debugging purposes) */ void test_th_render(void){ int forceCgi, fullHttpReply; Blob in; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; fullHttpReply = find_option("http", 0, 0)!=0; if( fullHttpReply ) forceCgi = 1; if( forceCgi ) Th_ForceCgi(fullHttpReply); if( find_option("open-config", 0, 0)!=0 ){ |
2316 2317 2318 2319 2320 2321 2322 | /* ** COMMAND: test-th-eval ** ** Usage: %fossil test-th-eval SCRIPT ** ** Evaluate SCRIPT as if it were a header or footer or ticket rendering | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 | /* ** COMMAND: test-th-eval ** ** Usage: %fossil test-th-eval SCRIPT ** ** Evaluate SCRIPT as if it were a header or footer or ticket rendering ** script and show the results on standard output. ** ** Options: ** ** --cgi Include a CGI response header in the output ** --http Include an HTTP response header in the output ** --open-config Open the configuration database ** --th-trace Trace TH1 execution (for debugging purposes) */ void test_th_eval(void){ int rc; const char *zRc; int forceCgi, fullHttpReply; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; fullHttpReply = find_option("http", 0, 0)!=0; if( fullHttpReply ) forceCgi = 1; if( forceCgi ) Th_ForceCgi(fullHttpReply); if( find_option("open-config", 0, 0)!=0 ){ Th_OpenConfig(1); } verify_all_options(); if( g.argc!=3 ){ usage("script"); } Th_FossilInit(TH_INIT_DEFAULT); rc = Th_Eval(g.interp, 0, g.argv[2], -1); zRc = Th_ReturnCodeName(rc, 1); fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", Th_GetResult(g.interp, 0)); Th_PrintTraceLog(); if( forceCgi ) cgi_reply(); } /* ** COMMAND: test-th-source ** ** Usage: %fossil test-th-source FILE ** ** Evaluate the contents of the file named "FILE" as if it were a header ** or footer or ticket rendering script and show the results on standard ** output. ** ** Options: ** ** --cgi Include a CGI response header in the output ** --http Include an HTTP response header in the output ** --open-config Open the configuration database ** --th-trace Trace TH1 execution (for debugging purposes) */ void test_th_source(void){ int rc; const char *zRc; int forceCgi, fullHttpReply; Blob in; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; fullHttpReply = find_option("http", 0, 0)!=0; if( fullHttpReply ) forceCgi = 1; if( forceCgi ) Th_ForceCgi(fullHttpReply); if( find_option("open-config", 0, 0)!=0 ){ Th_OpenConfig(1); } verify_all_options(); if( g.argc!=3 ){ usage("file"); } blob_zero(&in); blob_read_from_file(&in, g.argv[2]); Th_FossilInit(TH_INIT_DEFAULT); rc = Th_Eval(g.interp, 0, blob_str(&in), -1); zRc = Th_ReturnCodeName(rc, 1); fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", Th_GetResult(g.interp, 0)); Th_PrintTraceLog(); if( forceCgi ) cgi_reply(); } #ifdef FOSSIL_ENABLE_TH1_HOOKS /* ** COMMAND: test-th-hook ** ** Usage: %fossil test-th-hook TYPE NAME FLAGS ** ** Evaluates the TH1 script configured for the pre-operation (i.e. a command ** or web page) "hook" or post-operation "notification". The results of the ** script evaluation, if any, will be printed to the standard output channel. ** The NAME argument must be the name of a command or web page; however, it ** does not necessarily have to be a command or web page that is normally ** recognized by Fossil. The FLAGS argument will be used to set the value ** of the "cmd_flags" and/or "web_flags" TH1 variables, if applicable. The ** TYPE argument must be one of the following: |
2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 | char *zResult = 0; int forceCgi, fullHttpReply; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; fullHttpReply = find_option("http", 0, 0)!=0; if( fullHttpReply ) forceCgi = 1; if( forceCgi ) Th_ForceCgi(fullHttpReply); if( g.argc<5 ){ usage("TYPE NAME FLAGS"); } if( fossil_stricmp(g.argv[2], "cmdhook")==0 ){ rc = Th_CommandHook(g.argv[3], (char)atoi(g.argv[4])); }else if( fossil_stricmp(g.argv[2], "cmdnotify")==0 ){ rc = Th_CommandNotify(g.argv[3], (char)atoi(g.argv[4])); | > | 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 | char *zResult = 0; int forceCgi, fullHttpReply; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; fullHttpReply = find_option("http", 0, 0)!=0; if( fullHttpReply ) forceCgi = 1; if( forceCgi ) Th_ForceCgi(fullHttpReply); verify_all_options(); if( g.argc<5 ){ usage("TYPE NAME FLAGS"); } if( fossil_stricmp(g.argv[2], "cmdhook")==0 ){ rc = Th_CommandHook(g.argv[3], (char)atoi(g.argv[4])); }else if( fossil_stricmp(g.argv[2], "cmdnotify")==0 ){ rc = Th_CommandNotify(g.argv[3], (char)atoi(g.argv[4])); |
Changes to test/tester.tcl.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # is the name of the executable to be tested. # set testfiledir [file normalize [file dirname [info script]]] set testrundir [pwd] set testdir [file normalize [file dirname $argv0]] set fossilexe [file normalize [lindex $argv 0]] set argv [lrange $argv 1 end] set i [lsearch $argv -halt] if {$i>=0} { set HALT 1 set argv [lreplace $argv $i $i] } else { | > > > > > > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # is the name of the executable to be tested. # set testfiledir [file normalize [file dirname [info script]]] set testrundir [pwd] set testdir [file normalize [file dirname $argv0]] set fossilexe [file normalize [lindex $argv 0]] if {$tcl_platform(platform) eq "windows" && \ [string length [file extension $fossilexe]] == 0} { append fossilexe .exe } set argv [lrange $argv 1 end] set i [lsearch $argv -halt] if {$i>=0} { set HALT 1 set argv [lreplace $argv $i $i] } else { |
Changes to test/th1.test.
911 912 913 914 915 916 917 | fossil test-th-eval "reinitialize 1; globalState configuration" test th1-reinitialize-2 {$RESULT ne ""} ############################################################################### # | | > | | > > > > > > > > > > | < < < < < < < | < < < < < < < > | | | | | | | | | | | 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 | fossil test-th-eval "reinitialize 1; globalState configuration" test th1-reinitialize-2 {$RESULT ne ""} ############################################################################### # # NOTE: This test will fail if the command names are added to TH1, or # moved from Tcl builds to plain or the reverse. Sorting the # command lists eliminates a dependence on order. # fossil test-th-eval "info commands" set sorted_result [lsort $RESULT] protOut "Sorted: $sorted_result" set base_commands {anoncap anycap array artifact break breakpoint catch\ checkout combobox continue date decorate dir enable_output encode64\ error expr for getParameter glob_match globalState hascap hasfeature\ html htmlize http httpize if info insertCsrf lindex linecount list\ llength lsearch markdown proc puts query randhex redirect regexp\ reinitialize rename render repository return searchable set\ setParameter setting stime string styleFooter styleHeader tclReady\ trace unset uplevel upvar utime verifyCsrf wiki} set tcl_commands {tclEval tclExpr tclInvoke tclIsSafe tclMakeSafe} if {$th1Tcl} { test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands $tcl_commands"]} } else { test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands"]} } ############################################################################### fossil test-th-eval "info vars" if {$th1Hooks} { test th1-info-vars-1 {[lsort $RESULT] eq \ [lsort "th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]} } else { test th1-info-vars-1 {$RESULT eq "tcl_platform"} } ############################################################################### fossil test-th-eval "set x 1; info vars" if {$th1Hooks} { test th1-info-vars-2 {[lsort $RESULT] eq \ [lsort "x th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]} } else { test th1-info-vars-2 {[lsort $RESULT] eq [lsort "x tcl_platform"]} } ############################################################################### fossil test-th-eval "set x 1; unset x; info vars" if {$th1Hooks} { test th1-info-vars-3 {[lsort $RESULT] eq \ [lsort "th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]} } else { test th1-info-vars-3 {$RESULT eq "tcl_platform"} } ############################################################################### fossil test-th-eval "proc foo {} {set x 1; info vars}; foo" test th1-info-vars-4 {$RESULT eq "x"} ############################################################################### fossil test-th-eval "set y 1; proc foo {} {set x 1; uplevel 1 {info vars}}; foo" if {$th1Hooks} { test th1-info-vars-5 {[lsort $RESULT] eq \ [lsort "th_stack_trace y cmd_flags tcl_platform cmd_name cmd_args"]} } else { test th1-info-vars-5 {[lsort $RESULT] eq [lsort "y tcl_platform"]} } ############################################################################### fossil test-th-eval "array exists foo" test th1-array-exists-1 {$RESULT eq "0"} |
1434 1435 1436 1437 1438 1439 1440 | fossil test-th-eval {set tcl_platform(engine)} test th1-platform-3 {$RESULT eq "TH1"} ############################################################################### fossil test-th-eval {set tcl_platform(platform)} test th1-platform-4 {$RESULT eq "windows" || $RESULT eq "unix"} | > > > > > > > > > > > > > > > > > | 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 | fossil test-th-eval {set tcl_platform(engine)} test th1-platform-3 {$RESULT eq "TH1"} ############################################################################### fossil test-th-eval {set tcl_platform(platform)} test th1-platform-4 {$RESULT eq "windows" || $RESULT eq "unix"} ############################################################################### set th1FileName [file join $::tempPath th1-[pid].th1] write_file $th1FileName { set x "" for {set i 0} {$i < 10} {set i [expr {$i + 1}]} { set x "$x $i" } return [string trim $x] set y; # NOTE: Never hit. } fossil test-th-source $th1FileName test th1-source-1 {$RESULT eq {TH_RETURN: 0 1 2 3 4 5 6 7 8 9}} file delete $th1FileName |
Changes to win/Makefile.mingw.
156 157 158 159 160 161 162 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # | | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2f OPENSSLINCDIR = $(OPENSSLDIR)/include OPENSSLLIBDIR = $(OPENSSLDIR) #### Either the directory where the Tcl library is installed or the Tcl # source code directory resides (depending on the value of the macro # FOSSIL_TCL_SOURCE). If this points to the Tcl install directory, # this directory must have "include" and "lib" sub-directories. If |
Changes to win/Makefile.mingw.mistachkin.
156 157 158 159 160 161 162 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # | | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.0.2f OPENSSLINCDIR = $(OPENSSLDIR)/include OPENSSLLIBDIR = $(OPENSSLDIR) #### Either the directory where the Tcl library is installed or the Tcl # source code directory resides (depending on the value of the macro # FOSSIL_TCL_SOURCE). If this points to the Tcl install directory, # this directory must have "include" and "lib" sub-directories. If |
Changes to win/Makefile.msc.
91 92 93 94 95 96 97 | # Enable support for Windows XP with Visual Studio 201x? !ifndef FOSSIL_ENABLE_WINXP FOSSIL_ENABLE_WINXP = 0 !endif !if $(FOSSIL_ENABLE_SSL)!=0 | | | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | # Enable support for Windows XP with Visual Studio 201x? !ifndef FOSSIL_ENABLE_WINXP FOSSIL_ENABLE_WINXP = 0 !endif !if $(FOSSIL_ENABLE_SSL)!=0 SSLDIR = $(B)\compat\openssl-1.0.2f SSLINCDIR = $(SSLDIR)\inc32 !if $(FOSSIL_DYNAMIC_BUILD)!=0 SSLLIBDIR = $(SSLDIR)\out32dll !else SSLLIBDIR = $(SSLDIR)\out32 !endif SSLLFLAGS = /nologo /opt:ref /debug |
Changes to win/buildmsvc.bat.
257 258 259 260 261 262 263 | SET LIB=%PFILES_SDK71A%\Microsoft SDKs\Windows\7.1A\Lib;%LIB% ) CALL :fn_UnsetVariable PFILES_SDK71A SET NMAKE_ARGS=%NMAKE_ARGS% FOSSIL_ENABLE_WINXP=1 GOTO :EOF :fn_UnsetVariable | > | | > | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | SET LIB=%PFILES_SDK71A%\Microsoft SDKs\Windows\7.1A\Lib;%LIB% ) CALL :fn_UnsetVariable PFILES_SDK71A SET NMAKE_ARGS=%NMAKE_ARGS% FOSSIL_ENABLE_WINXP=1 GOTO :EOF :fn_UnsetVariable SET VALUE=%1 IF DEFINED VALUE ( SET %VALUE%= SET VALUE= CALL :fn_ResetErrorLevel ) GOTO :EOF :fn_ResetErrorLevel VERIFY > NUL GOTO :EOF |
Changes to www/build.wiki.
109 110 111 112 113 114 115 | all Unix and Unix-like systems. Simply type "<b>make</b>". <li><p><i>Unix without running "configure"</i> → if you prefer to avoid running configure, you can also use: <b>make -f Makefile.classic</b>. You may want to make minor edits to Makefile.classic to configure the build for your system. | | | | | | > > > > > > | | | | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | all Unix and Unix-like systems. Simply type "<b>make</b>". <li><p><i>Unix without running "configure"</i> → if you prefer to avoid running configure, you can also use: <b>make -f Makefile.classic</b>. You may want to make minor edits to Makefile.classic to configure the build for your system. <li><p><i>MinGW 3.x (<u>not</u> 4.x) / MinGW-w64</i> → Use the MinGW makefile: "<b>make -f win/Makefile.mingw</b>". On a Windows box you will need either Cygwin or Msys as build environment. On Cygwin, Linux or Darwin you may want to make minor edits to win/Makefile.mingw to configure the cross-compile environment. To enable the native [./th1.md#tclEval | Tcl integration feature], use a command line like the following (all on one line): <b>make -f win/Makefile.mingw FOSSIL_ENABLE_TCL=1 FOSSIL_ENABLE_TCL_STUBS=1 FOSSIL_ENABLE_TCL_PRIVATE_STUBS=1</b> Alternatively, <b>./configure</b> may now be used to create a Makefile suitable for use with MinGW; however, options passed to configure that are not applicable on Windows may cause the configuration or compilation to fail (e.g. fusefs, internal-sqlite, etc). <i>HINT</i>: Do <u>not</u> use MinGW-4.x, it may compile but the Fossil binary will not work correctly, see [https://www.fossil-scm.org/index.html/tktview/18cff45a4e210430e24c | ticket]. <li><p><i>MSVC</i> → Use the MSVC makefile. First change to the "win/" subdirectory ("<b>cd win</b>") then run "<b>nmake /f Makefile.msc</b>".<br><br>Alternatively, the batch file "<b>win\buildmsvc.bat</b>" may be used and it will attempt to detect and use the latest installed version of MSVC.<br><br>To enable the optional <a href="https://www.openssl.org/">OpenSSL</a> support, first <a href="https://www.openssl.org/source/">download the official source code for OpenSSL</a> and extract it to an appropriately named "<b>openssl-X.Y.ZA</b>" subdirectory within the local [/tree?ci=trunk&name=compat | compat] directory (e.g. "<b>compat/openssl-1.0.2f</b>"), then make sure that some recent <a href="http://www.perl.org/">Perl</a> binaries are installed locally, and finally run one of the following commands: <blockquote><pre> nmake /f Makefile.msc FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin </pre></blockquote> <blockquote><pre> buildmsvc.bat FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin |
Changes to www/th1.md.
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | * globalState * hascap * hasfeature * html * htmlize * http * httpize * linecount * markdown * puts * query * randhex * regexp * reinitialize * render * repository * searchable * setParameter * setting * styleHeader * styleFooter * tclEval * tclExpr * tclInvoke * tclIsSafe * tclMakeSafe * tclReady * trace * stime * utime * wiki Each of the commands above is documented by a block comment above their implementation in the th\_main.c or th\_tcl.c source files. All commands starting with "tcl", with the exception of "tclReady", require the Tcl integration subsystem be included at compile-time. | > > > | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | * globalState * hascap * hasfeature * html * htmlize * http * httpize * insertCsrf * linecount * markdown * puts * query * randhex * redirect * regexp * reinitialize * render * repository * searchable * setParameter * setting * styleHeader * styleFooter * tclEval * tclExpr * tclInvoke * tclIsSafe * tclMakeSafe * tclReady * trace * stime * utime * verifyCsrf * wiki Each of the commands above is documented by a block comment above their implementation in the th\_main.c or th\_tcl.c source files. All commands starting with "tcl", with the exception of "tclReady", require the Tcl integration subsystem be included at compile-time. |
376 377 378 379 380 381 382 383 384 385 386 387 388 389 | <a name="httpize"></a>TH1 httpize Command ----------------------------------------- * httpize STRING Escape all characters of STRING which have special meaning in URI components. Returns the escaped string. <a name="linecount"></a>TH1 linecount Command --------------------------------------------- * linecount STRING MAX MIN Returns one more than the number of \n characters in STRING. But | > > > > > > > > | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | <a name="httpize"></a>TH1 httpize Command ----------------------------------------- * httpize STRING Escape all characters of STRING which have special meaning in URI components. Returns the escaped string. <a name="insertCsrf"></a>TH1 insertCsrf Command ----------------------------------------------- * insertCsrf While rendering a form, call this command to add the Anti-CSRF token as a hidden element of the form. <a name="linecount"></a>TH1 linecount Command --------------------------------------------- * linecount STRING MAX MIN Returns one more than the number of \n characters in STRING. But |
420 421 422 423 424 425 426 427 428 429 430 431 432 433 | <a name="randhex"></a>TH1 randhex Command ----------------------------------------- * randhex N Returns a string of N*2 random hexadecimal digits with N<50. If N is omitted, use a value of 10. <a name="regexp"></a>TH1 regexp Command --------------------------------------- * regexp ?-nocase? ?--? exp string Checks the string against the specified regular expression and returns | > > > > > > > > | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | <a name="randhex"></a>TH1 randhex Command ----------------------------------------- * randhex N Returns a string of N*2 random hexadecimal digits with N<50. If N is omitted, use a value of 10. <a name="redirect"></a>TH1 redirect Command ------------------------------------------- * redirect URL Issues an HTTP redirect (302) to the specified URL and then exits the process. <a name="regexp"></a>TH1 regexp Command --------------------------------------- * regexp ?-nocase? ?--? exp string Checks the string against the specified regular expression and returns |
596 597 598 599 600 601 602 603 604 605 606 607 608 609 | <a name="utime"></a>TH1 utime Command ------------------------------------- * utime Returns the number of microseconds of CPU time consumed by the current process in user space. <a name="wiki"></a>TH1 wiki Command ----------------------------------- * wiki STRING Renders STRING as wiki content. | > > > > > > > > > > > | 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | <a name="utime"></a>TH1 utime Command ------------------------------------- * utime Returns the number of microseconds of CPU time consumed by the current process in user space. <a name="verifyCsrf"></a>TH1 verifyCsrf Command ----------------------------------------------- * verifyCsrf Before using the results of a form, first call this command to verify that this Anti-CSRF token is present and is valid. If the Anti-CSRF token is missing or is incorrect, that indicates a cross-site scripting attack. If the event of an attack is detected, an error message is generated and all further processing is aborted. <a name="wiki"></a>TH1 wiki Command ----------------------------------- * wiki STRING Renders STRING as wiki content. |