Skip to content

Commit 8342afd

Browse files
committed
CHANGE: updated source of httpd module to make it compatible also with older Rebol versions
1 parent 6c8240c commit 8342afd

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/modules/httpd.reb

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Rebol [
22
Title: "HTTPd Scheme"
33
Type: module
44
Name: httpd
5-
Date: 10-Jan-2024
6-
Version: 0.9.1
5+
Date: 4-Jun-2024
6+
Version: 0.9.2
77
Author: ["Andreas Bolka" "Christopher Ross-Gill" "Oldes"]
88
Exports: [serve-http http-server decode-target to-CLF-idate]
99
Home: https://github.com/Oldes/Rebol-HTTPd
@@ -37,7 +37,7 @@ Rebol [
3737
09-May-2023 "Oldes" {Root-less configuration possibility (default)}
3838
14-Dec-2023 "Oldes" {Deprecated the `http-server` function in favor of `serve-http` with a different configuration input}
3939
]
40-
Needs: [3.16.0 mime-types] ;; new construction syntax since 3.16.0
40+
Needs: [3.11.0 mime-types]
4141
]
4242

4343
append system/options/log [httpd: 1]
@@ -216,11 +216,11 @@ sys/make-scheme [
216216
clients: make block! 16
217217
]
218218
subport/extra/config:
219-
config: make map! [
220-
root: #(none)
219+
config: make map! reduce/no-set [
220+
root: none
221221
index: [%index.html %index.htm]
222-
keep-alive: #(true)
223-
list-dir?: #(true)
222+
keep-alive: true
223+
list-dir?: true
224224
server-name: "Rebol3-HTTPd"
225225
]
226226
]
@@ -618,7 +618,7 @@ sys/make-scheme [
618618
]
619619

620620
Awake-Client: wrap [
621-
chars-method: #(bitset! #{00000000000000007FFFFFE0}) ; #"A" - #"Z"
621+
chars-method: charset [#"A" - #"Z"]
622622
;from-method: ["GET" | "POST" | "HEAD" | "PUT" | "DELETE" | "TRACE" | "CONNECT" | "OPTIONS"]
623623
chars: complement union space: charset " " charset [#"^@" - #"^_"]
624624
CRLF2BIN: #{0D0A0D0A}
@@ -917,7 +917,7 @@ sys/make-scheme [
917917
;try [remove find clients port]
918918
]
919919
log-debug ["Ports open:" length? clients]
920-
if ctx/done? [
920+
if all [ctx/done? zero? length? clients][
921921
log-more "Server's job done, closing initiated"
922922
ctx/parent/data: ctx/done?
923923
Awake-Server make event! [type: 'CLOSE port: ctx/parent]
@@ -988,11 +988,11 @@ http-server: function [
988988
actions [block! object!] "Functions like: On-Get On-Post On-Post-Received On-Read On-List-Dir On-Not-Found"
989989
/no-wait "Will not enter wait loop"
990990
][
991-
sys/log/error 'HTTPD "`http-server` function is deprecated, use `start-http` instead!"
991+
sys/log/error 'HTTPD "`http-server` function is deprecated, use `serve-http` instead!"
992992
spec: either config [[]][to block! spec]
993993
if actor [extend spec 'actor actions]
994994
extend spec 'port port
995-
start-http/:no-wait spec
995+
serve-http/:no-wait spec
996996
]
997997

998998
serve-http: function [

0 commit comments

Comments
 (0)