Fossil SCM

Add the "timelineX" tag to robot-restrict processing. Move /honeypot over to the captcha.c file and have it use the resources found there.

drh 2025-08-16 00:36 robot-restrict-simplified
Commit 54afc94ce057369b4e37bd365ee7f955e201e2fabbb6d76d06981bd19d4b0286
--- src/captcha.c
+++ src/captcha.c
@@ -759,10 +759,18 @@
759759
@ %s(captcha_render(zPw))
760760
@ </pre>
761761
style_finish_page();
762762
}
763763
}
764
+
765
+/*
766
+** WEBPAGE: honeypot
767
+** This page is a honeypot for spiders and bots.
768
+*/
769
+void honeypot_page(void){
770
+ (void)exclude_spiders(0);
771
+}
764772
765773
/*
766774
** Check to see if the current request is coming from an agent that
767775
** self-identifies as a spider.
768776
**
769777
--- src/captcha.c
+++ src/captcha.c
@@ -759,10 +759,18 @@
759 @ %s(captcha_render(zPw))
760 @ </pre>
761 style_finish_page();
762 }
763 }
 
 
 
 
 
 
 
 
764
765 /*
766 ** Check to see if the current request is coming from an agent that
767 ** self-identifies as a spider.
768 **
769
--- src/captcha.c
+++ src/captcha.c
@@ -759,10 +759,18 @@
759 @ %s(captcha_render(zPw))
760 @ </pre>
761 style_finish_page();
762 }
763 }
764
765 /*
766 ** WEBPAGE: honeypot
767 ** This page is a honeypot for spiders and bots.
768 */
769 void honeypot_page(void){
770 (void)exclude_spiders(0);
771 }
772
773 /*
774 ** Check to see if the current request is coming from an agent that
775 ** self-identifies as a spider.
776 **
777
+2 -2
--- src/robot.c
+++ src/robot.c
@@ -117,11 +117,11 @@
117117
** The VALUE of this setting is a list of GLOB patterns that match
118118
** pages for which complex HTTP requests from unauthenicated clients
119119
** should be disallowed. "Unauthenticated" means the user is "nobody".
120120
** The recommended value for this setting is:
121121
**
122
-** timeline,diff,annotate,zip,fileage,file
122
+** timelineX,diff,annotate,zip,fileage,file
123123
**
124124
** The "diff" tag covers all diffing pages such as /vdiff, /fdiff, and
125125
** /vpatch. The "annotate" tag also covers /blame and /praise. "zip"
126126
** also covers /tarball and /sqlar. If a tag has an "X" character appended,
127127
** then it only applies if query parameters are such that the page is
@@ -132,11 +132,11 @@
132132
133133
/*
134134
** Return the default restriction GLOB
135135
*/
136136
const char *robot_restrict_default(void){
137
- return "timeline,diff,annotate,zip,fileage,file";
137
+ return "timelineX,diff,annotate,zip,fileage,file";
138138
}
139139
/*
140140
** Check to see if the page named in the argument is on the
141141
** robot-restrict list. If it is on the list and if the user
142142
** is "nobody" then bring up a captcha to test to make sure that
143143
--- src/robot.c
+++ src/robot.c
@@ -117,11 +117,11 @@
117 ** The VALUE of this setting is a list of GLOB patterns that match
118 ** pages for which complex HTTP requests from unauthenicated clients
119 ** should be disallowed. "Unauthenticated" means the user is "nobody".
120 ** The recommended value for this setting is:
121 **
122 ** timeline,diff,annotate,zip,fileage,file
123 **
124 ** The "diff" tag covers all diffing pages such as /vdiff, /fdiff, and
125 ** /vpatch. The "annotate" tag also covers /blame and /praise. "zip"
126 ** also covers /tarball and /sqlar. If a tag has an "X" character appended,
127 ** then it only applies if query parameters are such that the page is
@@ -132,11 +132,11 @@
132
133 /*
134 ** Return the default restriction GLOB
135 */
136 const char *robot_restrict_default(void){
137 return "timeline,diff,annotate,zip,fileage,file";
138 }
139 /*
140 ** Check to see if the page named in the argument is on the
141 ** robot-restrict list. If it is on the list and if the user
142 ** is "nobody" then bring up a captcha to test to make sure that
143
--- src/robot.c
+++ src/robot.c
@@ -117,11 +117,11 @@
117 ** The VALUE of this setting is a list of GLOB patterns that match
118 ** pages for which complex HTTP requests from unauthenicated clients
119 ** should be disallowed. "Unauthenticated" means the user is "nobody".
120 ** The recommended value for this setting is:
121 **
122 ** timelineX,diff,annotate,zip,fileage,file
123 **
124 ** The "diff" tag covers all diffing pages such as /vdiff, /fdiff, and
125 ** /vpatch. The "annotate" tag also covers /blame and /praise. "zip"
126 ** also covers /tarball and /sqlar. If a tag has an "X" character appended,
127 ** then it only applies if query parameters are such that the page is
@@ -132,11 +132,11 @@
132
133 /*
134 ** Return the default restriction GLOB
135 */
136 const char *robot_restrict_default(void){
137 return "timelineX,diff,annotate,zip,fileage,file";
138 }
139 /*
140 ** Check to see if the page named in the argument is on the
141 ** robot-restrict list. If it is on the list and if the user
142 ** is "nobody" then bring up a captcha to test to make sure that
143
-45
--- src/style.c
+++ src/style.c
@@ -1390,55 +1390,10 @@
13901390
*/
13911391
void page_test_env(void){
13921392
webpage_error("");
13931393
}
13941394
1395
-/*
1396
-** WEBPAGE: honeypot
1397
-** This page is a honeypot for spiders and bots.
1398
-*/
1399
-void honeypot_page(void){
1400
- unsigned int uSeed = captcha_seed();
1401
- const char *zDecoded = captcha_decode(uSeed, 0);
1402
- int bAutoCaptcha = db_get_boolean("auto-captcha", 0);
1403
- char *zCaptcha = captcha_render(zDecoded);
1404
- style_header("I think you are a robot");
1405
- @ <p>You seem like a robot.</p>
1406
- @
1407
- @ <p>Is that incorrect? Are you really human?
1408
- @ If so, please prove it by transcribing the captcha text
1409
- @ into the entry box below and pressing "Submit".
1410
- @ <form action="%R/login" method="post">
1411
- @ <input type="hidden" id="u" name="u" value="anonymous">
1412
- @ <p>
1413
- @ Captcha: <input type="text" id="p" name="p" value="">
1414
- @ <input type="submit" name="in" value="Submit">
1415
- @
1416
- @ <p>Alternatively, you can <a href="%R/login">log in</a> using an
1417
- @ existing userid.
1418
- @
1419
- @ <p><input type="hidden" name="cs" value="%u(uSeed)">
1420
- @ <div class="captcha"><table class="captcha"><tr><td>\
1421
- @ <pre class="captcha">
1422
- @ %h(zCaptcha)
1423
- @ </pre></td></tr></table>
1424
- if( bAutoCaptcha ) {
1425
- @ <input type="button" value="Fill out captcha" id='autofillButton' \
1426
- @ data-af='%s(zDecoded)'>
1427
- builtin_request_js("login.js");
1428
- }
1429
- @ </div>
1430
- free(zCaptcha);
1431
- @
1432
- @ <p>We regret this inconvenience. However, robots have become so
1433
- @ prolific and so aggressive that they will soak up too much CPU time
1434
- @ and network bandwidth on our servers if allowed to run unchecked.
1435
- @ Your cooperation in demonstrating that you are human is
1436
- @ appreciated.
1437
- style_finish_page();
1438
-}
1439
-
14401395
/*
14411396
** Webpages that encounter an error due to missing or incorrect
14421397
** query parameters can jump to this routine to render an error
14431398
** message screen.
14441399
**
14451400
--- src/style.c
+++ src/style.c
@@ -1390,55 +1390,10 @@
1390 */
1391 void page_test_env(void){
1392 webpage_error("");
1393 }
1394
1395 /*
1396 ** WEBPAGE: honeypot
1397 ** This page is a honeypot for spiders and bots.
1398 */
1399 void honeypot_page(void){
1400 unsigned int uSeed = captcha_seed();
1401 const char *zDecoded = captcha_decode(uSeed, 0);
1402 int bAutoCaptcha = db_get_boolean("auto-captcha", 0);
1403 char *zCaptcha = captcha_render(zDecoded);
1404 style_header("I think you are a robot");
1405 @ <p>You seem like a robot.</p>
1406 @
1407 @ <p>Is that incorrect? Are you really human?
1408 @ If so, please prove it by transcribing the captcha text
1409 @ into the entry box below and pressing "Submit".
1410 @ <form action="%R/login" method="post">
1411 @ <input type="hidden" id="u" name="u" value="anonymous">
1412 @ <p>
1413 @ Captcha: <input type="text" id="p" name="p" value="">
1414 @ <input type="submit" name="in" value="Submit">
1415 @
1416 @ <p>Alternatively, you can <a href="%R/login">log in</a> using an
1417 @ existing userid.
1418 @
1419 @ <p><input type="hidden" name="cs" value="%u(uSeed)">
1420 @ <div class="captcha"><table class="captcha"><tr><td>\
1421 @ <pre class="captcha">
1422 @ %h(zCaptcha)
1423 @ </pre></td></tr></table>
1424 if( bAutoCaptcha ) {
1425 @ <input type="button" value="Fill out captcha" id='autofillButton' \
1426 @ data-af='%s(zDecoded)'>
1427 builtin_request_js("login.js");
1428 }
1429 @ </div>
1430 free(zCaptcha);
1431 @
1432 @ <p>We regret this inconvenience. However, robots have become so
1433 @ prolific and so aggressive that they will soak up too much CPU time
1434 @ and network bandwidth on our servers if allowed to run unchecked.
1435 @ Your cooperation in demonstrating that you are human is
1436 @ appreciated.
1437 style_finish_page();
1438 }
1439
1440 /*
1441 ** Webpages that encounter an error due to missing or incorrect
1442 ** query parameters can jump to this routine to render an error
1443 ** message screen.
1444 **
1445
--- src/style.c
+++ src/style.c
@@ -1390,55 +1390,10 @@
1390 */
1391 void page_test_env(void){
1392 webpage_error("");
1393 }
1394
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1395 /*
1396 ** Webpages that encounter an error due to missing or incorrect
1397 ** query parameters can jump to this routine to render an error
1398 ** message screen.
1399 **
1400
--- src/timeline.c
+++ src/timeline.c
@@ -1830,10 +1830,11 @@
18301830
|| (bisectLocal && !g.perm.Setup)
18311831
){
18321832
login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
18331833
return;
18341834
}
1835
+ if( zBefore && robot_restrict("timelineX") ) return;
18351836
if( !bisectLocal ){
18361837
etag_check(ETAG_QUERY|ETAG_COOKIE|ETAG_DATA|ETAG_CONFIG, 0);
18371838
}
18381839
cookie_read_parameter("y","y");
18391840
zType = P("y");
18401841
--- src/timeline.c
+++ src/timeline.c
@@ -1830,10 +1830,11 @@
1830 || (bisectLocal && !g.perm.Setup)
1831 ){
1832 login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
1833 return;
1834 }
 
1835 if( !bisectLocal ){
1836 etag_check(ETAG_QUERY|ETAG_COOKIE|ETAG_DATA|ETAG_CONFIG, 0);
1837 }
1838 cookie_read_parameter("y","y");
1839 zType = P("y");
1840
--- src/timeline.c
+++ src/timeline.c
@@ -1830,10 +1830,11 @@
1830 || (bisectLocal && !g.perm.Setup)
1831 ){
1832 login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
1833 return;
1834 }
1835 if( zBefore && robot_restrict("timelineX") ) return;
1836 if( !bisectLocal ){
1837 etag_check(ETAG_QUERY|ETAG_COOKIE|ETAG_DATA|ETAG_CONFIG, 0);
1838 }
1839 cookie_read_parameter("y","y");
1840 zType = P("y");
1841

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button