projects
/
rrq
/
newlisp-ftw.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1bfe55c
)
added initial request filtering
author
Ralph Ronnquist
<ralph.ronnquist@gmail.com>
Wed, 3 Jun 2020 04:37:19 +0000
(14:37 +1000)
committer
Ralph Ronnquist
<ralph.ronnquist@gmail.com>
Wed, 3 Jun 2020 04:37:19 +0000
(14:37 +1000)
hobby-http.lsp
patch
|
blob
|
history
diff --git
a/hobby-http.lsp
b/hobby-http.lsp
index f2ba8314daf636056c1513316fd45def1633e978..33b8da7287a7e7bc8cd86b8895065799fe338ac0 100755
(executable)
--- a/
hobby-http.lsp
+++ b/
hobby-http.lsp
@@
-37,9
+37,14
@@
; Apply rewriting rules for some requests
(define (tag-on-html X)
(write-line 2 (string "> " X ))
; Apply rewriting rules for some requests
(define (tag-on-html X)
(write-line 2 (string "> " X ))
- (let ((C (if (and (string? X) (regex "^GET ([^ ]+) (.+)" X 0))
- (format "GET %s %s\r\n" (maybe-html $1) $2) X)))
- (write-line 2 (string "< " C))
- C))
+ (setf X (if (and (string? X) (regex "^([^\\s]+) ([^ ]+) (.+)" X 0))
+ (let ((A $1) (B $2) (C $3))
+ (format "%s %s %s\r\n" A (maybe-html B) C) X)))
+ (write-line 2 (string "< " X))
+ X)
-(command-event tag-on-html)
+(define (filter-request X)
+ (if (starts-with X "(GET|HEAD)" 0) (tag-on-html X)
+ "GET /403.html HTTP/1.1"))
+
+(command-event filter-request)