Skip to content

Commit

Permalink
CHANGE: updated source of httpd module to make it compatible also w…
Browse files Browse the repository at this point in the history
…ith older Rebol versions
  • Loading branch information
Oldes committed Jun 4, 2024
1 parent 6c8240c commit 8342afd
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/modules/httpd.reb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Rebol [
Title: "HTTPd Scheme"
Type: module
Name: httpd
Date: 10-Jan-2024
Version: 0.9.1
Date: 4-Jun-2024
Version: 0.9.2
Author: ["Andreas Bolka" "Christopher Ross-Gill" "Oldes"]
Exports: [serve-http http-server decode-target to-CLF-idate]
Home: https://github.com/Oldes/Rebol-HTTPd
Expand Down Expand Up @@ -37,7 +37,7 @@ Rebol [
09-May-2023 "Oldes" {Root-less configuration possibility (default)}
14-Dec-2023 "Oldes" {Deprecated the `http-server` function in favor of `serve-http` with a different configuration input}
]
Needs: [3.16.0 mime-types] ;; new construction syntax since 3.16.0
Needs: [3.11.0 mime-types]
]

append system/options/log [httpd: 1]
Expand Down Expand Up @@ -216,11 +216,11 @@ sys/make-scheme [
clients: make block! 16
]
subport/extra/config:
config: make map! [
root: #(none)
config: make map! reduce/no-set [
root: none
index: [%index.html %index.htm]
keep-alive: #(true)
list-dir?: #(true)
keep-alive: true
list-dir?: true
server-name: "Rebol3-HTTPd"
]
]
Expand Down Expand Up @@ -618,7 +618,7 @@ sys/make-scheme [
]

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

serve-http: function [
Expand Down

0 comments on commit 8342afd

Please sign in to comment.