Revision: 3457
Author: ksprotte
URL: http://bknr.net/trac/changeset/3457
contract-tree new function (contract-tree-update-images-if-needed)
that now is very fast in the case that there are no updates to be done
U trunk/projects/bos/web/contract-tree.lisp
Modified: trunk/projects/bos/web/contract-tree.lisp
===================================================================
--- trunk/projects/bos/web/contract-tree.lisp 2008-07-16 10:20:49 UTC (rev 3456)
+++ trunk/projects/bos/web/contract-tree.lisp 2008-07-16 11:59:12 UTC (rev 3457)
@@ -268,12 +268,26 @@
(delete-file (blob-pathname old-store-image))
(delete-object old-store-image)))))))
+(defun contract-node-update-image-needed-p (node)
+ (or (null (image node))
+ (> (timestamp node) (blob-timestamp (image node)))))
+
(defun contract-node-update-image-if-needed (node)
- (when (or (null (image node))
- (not (probe-file (blob-pathname (image node))))
- (> (timestamp node) (blob-timestamp (image node))))
+ (when (contract-node-update-image-needed-p node)
(contract-node-update-image node)))
+(defun contract-tree-update-images-if-needed ()
+ ;; I did not see an easy way to avoid that
+ ;; CONTRACT-NODE-UPDATE-IMAGE-NEEDED-P is called twice for every
+ ;; node. Once inside CONTRACT-NODE-UPDATE-IMAGE-IF-NEEDED and once
+ ;; for the prune-test.
+
+ ;; Let's hope we are lucky and there is nothing to do by inspecting
+ ;; *contract-tree* at first only once.
+ (when (contract-node-update-image-needed-p *contract-tree*)
+ (map-nodes #'contract-node-update-image-if-needed *contract-tree*
+ :prune-test (lambda (node) (not (contract-node-update-image-needed-p node))))))
+
;;; image handler
(defclass contract-tree-image-handler (page-handler)
())
@@ -300,7 +314,7 @@
(when (contract-published-p contract)
(insert-contract *contract-tree* contract)))
(format t "~&rendering contract-tree images if needed...") (force-output)
- (map-nodes #'contract-node-update-image-if-needed *contract-tree*)
+ (contract-tree-update-images-if-needed)
(format t "done.~%") (force-output)
(geometry:register-rect-subscriber geometry:*rect-publisher* *contract-tree*
(list 0 0 +width+ +width+)
Revision: 3454
Author: edi
URL: http://bknr.net/trac/changeset/3454
Integrate patch from Daniel Janus
U trunk/thirdparty/drakma/CHANGELOG.txt
U trunk/thirdparty/drakma/cookies.lisp
U trunk/thirdparty/drakma/doc/index.html
U trunk/thirdparty/drakma/packages.lisp
U trunk/thirdparty/drakma/specials.lisp
Modified: trunk/thirdparty/drakma/CHANGELOG.txt
===================================================================
--- trunk/thirdparty/drakma/CHANGELOG.txt 2008-07-16 08:59:09 UTC (rev 3453)
+++ trunk/thirdparty/drakma/CHANGELOG.txt 2008-07-16 09:16:15 UTC (rev 3454)
@@ -1,3 +1,5 @@
+Added *ALLOW-DOTLESS-COOKIE-DOMAINS-P* (thanks to Daniel Janus)
+
Version 0.11.5
2008-03-21
Added workaround for CLISP (thanks to Anton Vodonosov)
Modified: trunk/thirdparty/drakma/cookies.lisp
===================================================================
--- trunk/thirdparty/drakma/cookies.lisp 2008-07-16 08:59:09 UTC (rev 3453)
+++ trunk/thirdparty/drakma/cookies.lisp 2008-07-16 09:16:15 UTC (rev 3454)
@@ -93,8 +93,10 @@
(defun valid-cookie-domain-p (domain)
"Checks if the string DOMAIN contains enough dots to be
-acceptable."
- (or (string-equal domain "localhost")
+acceptable. If *ALLOW-DOTLESS-COOKIE-DOMAINS-P* is non-NIL,
+every domain name is considered acceptable."
+ (or *allow-dotless-cookie-domains-p*
+ (string-equal domain "localhost")
(> (count #\. (normalize-cookie-domain domain) :test #'char=) 1)))
(defun cookie-domain-matches (domain uri)
Modified: trunk/thirdparty/drakma/doc/index.html
===================================================================
--- trunk/thirdparty/drakma/doc/index.html 2008-07-16 08:59:09 UTC (rev 3453)
+++ trunk/thirdparty/drakma/doc/index.html 2008-07-16 09:16:15 UTC (rev 3454)
@@ -84,6 +84,7 @@
<li><a href="#cookie-jar-cookies"><code>cookie-jar-cookies</code></a>
<li><a href="#cookie="><code>cookie=</code></a>
<li><a href="#delete-old-cookies"><code>delete-old-cookies</code></a>
+ <li><a href="#*allow-dotless-cookie-domains-p*"><code>*allow-dotless-cookie-domains-p*</code></a>
<li><a href="#*ignore-unparseable-cookie-dates-p*"><code>*ignore-unparseable-cookie-dates-p*</code></a>
</ol>
<li><a href="#headers">Headers</a>
@@ -1261,6 +1262,20 @@
<!-- End of entry for DELETE-OLD-COOKIES -->
+<!-- Entry for *ALLOW-DOTLESS-COOKIE-DOMAINS-P* -->
+
+<p><br>[Special variable]<br><a class=none name='*allow-dotless-cookie-domains-p*'><b>*allow-dotless-cookie-domains-p*</b></a>
+<blockquote><br>
+
+When this variable is not <code>NIL</code>, cookie domains containing
+no dots are considered valid. The default is <code>NIL</code>,
+meaning to disallow such domains except for <code>"localhost"<code>.
+
+</blockquote>
+
+<!-- End of entry for *ALLOW-DOTLESS-COOKIE-DOMAINS-P* -->
+
+
<!-- Entry for *IGNORE-UNPARSEABLE-COOKIE-DATES-P* -->
<p><br>[Special variable]<br><a class=none name='*ignore-unparseable-cookie-dates-p*'><b>*ignore-unparseable-cookie-dates-p*</b></a>
Modified: trunk/thirdparty/drakma/packages.lisp
===================================================================
--- trunk/thirdparty/drakma/packages.lisp 2008-07-16 08:59:09 UTC (rev 3453)
+++ trunk/thirdparty/drakma/packages.lisp 2008-07-16 09:16:15 UTC (rev 3454)
@@ -33,7 +33,8 @@
(:use :cl :puri :flexi-streams :chunga)
;; the variable defined in the ASDF system definition
(:import-from :drakma-asd :*drakma-version-string*)
- (:export :*body-format-function*
+ (:export :*allow-dotless-cookie-domains-p*
+ :*body-format-function*
:*drakma-default-external-format*
:*header-stream*
:*ignore-unparseable-cookie-dates-p*
Modified: trunk/thirdparty/drakma/specials.lisp
===================================================================
--- trunk/thirdparty/drakma/specials.lisp 2008-07-16 08:59:09 UTC (rev 3453)
+++ trunk/thirdparty/drakma/specials.lisp 2008-07-16 09:16:15 UTC (rev 3454)
@@ -70,6 +70,11 @@
which incoming and outgoing headers will be written for debugging
purposes.")
+(defvar *allow-dotless-cookie-domains-p* nil
+ "When this variable is not NIL, cookie domains containing no dots
+are considered valid. The default is NIL, meaning to disallow such
+domains except for \"localhost\".")
+
(defvar *ignore-unparseable-cookie-dates-p* nil
"Whether Drakma is allowed to treat `Expires' dates in cookie
headers as non-existent if it can't parse them. If the value of this