File tree 2 files changed +13
-13
lines changed
2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,6 @@ decode-target: wrap [
80
80
][
81
81
target
82
82
][ any [result/file %"" ] ]
83
- if #"/" = first result/file [remove result/file ]
84
83
new-line /skip result/values true 2
85
84
result
86
85
]
@@ -238,7 +237,7 @@ sys/make-scheme [
238
237
/local target path info index modified If-Modified-Since
239
238
] [
240
239
target: ctx/inp/target
241
- target/file: path: join dirize ctx/config/root clean-path/only target/file
240
+ target/file: path: join dirize ctx/config/root next clean-path/only target/file
242
241
ctx/out/header/Date: to-idate/gmt now
243
242
ctx/out/status: 200
244
243
either exists? path [
@@ -352,13 +351,13 @@ sys/make-scheme [
352
351
return false
353
352
]
354
353
dir: target/file
355
- path: find/match dir ctx/config/root
354
+ path: join "/" find/match/tail dir ctx/config/root
356
355
357
356
try /except [
358
357
out: make string! 2000
359
358
append out ajoin [
360
- {<html><head><title>Index of /} path
361
- {</title></head><body bgcolor="white"><h1>Index of / } path
359
+ {<html><head><title>Index of } path
360
+ {</title></head><body bgcolor="white"><h1>Index of } path
362
361
{</h1><hr><pre>^/ }
363
362
]
364
363
unless empty? path [
Original file line number Diff line number Diff line change @@ -49,27 +49,28 @@ http-server/config/actor 8081 [
49
49
; TRUE = accepted, FALSE = refuse
50
50
find [ 127.0.0.1 ] info/remote-ip
51
51
]
52
- On-Header : func [ ctx [object! ]] [
53
- switch ctx/inp/target/file [
54
- %form/ [
52
+ On-Header : func [ ctx [object! ] /local path] [
53
+ path: ctx/inp/target/file
54
+ switch path [
55
+ %/form/ [
55
56
; path rewrite...
56
57
; http://localhost:8081/form/ is now same like http://localhost:8081/form.html
57
- ctx/inp/target/file: %form.html
58
+ ctx/inp/target/file: %/ form.html
58
59
; request processing will continue
59
60
]
60
- %form.htm
61
- %form.html [
61
+ %/ form.htm
62
+ %/ form.html [
62
63
ctx/out/status: 301 ;= Moved Permanently
63
64
ctx/out/header/Location: %/form/
64
65
; request processing will stop with redirection response
65
66
]
66
- %plain/ [
67
+ %/ plain/ [
67
68
ctx/out/status: 200
68
69
ctx/out/header/Content-Type: "text/plain; charset=UTF-8"
69
70
ctx/out/content: "hello"
70
71
; request processing will stop with response 200 serving the plain text content
71
72
]
72
- %humans.txt [
73
+ %/ humans.txt [
73
74
;@@ https://codeburst.io/all-about-humans-humans-txt-actually-f571d37f92d2
74
75
;-- serving the content directly from the memory
75
76
ctx/out/status: 200
You can’t perform that action at this time.
0 commit comments