Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions http-tools.red
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ headers!: context [
other-headers: none
]

parse-headers: func [query] [
parse-headers: func [query /local headers raw key value keys] [
headers: make headers! []
raw: make map! 50
key: value: none
Expand All @@ -122,12 +122,23 @@ parse-headers: func [query] [
"GATEWAY_INTERFACE" gateway-interface
"SERVER_PROTOCOL" server-protocol
"REQUEST_METHOD" request-method
"PATH_INFO" path-info
"PATH_TRANSLATED" path-translated
"QUERY_STRING" query-string
"CONTENT_TYPE" Content-Type
"CONTENT_LENGTH" content-length
"AUTH_TYPE" auth-type
] [
headers/:red-key: raw/:cgi-key
raw/:cgi-key: none
]
keys: keys-of raw
while [not tail? keys] [
if not parse key: first keys [["HTTP_" | "HTTPS_" | "AUTH_" | "CERT_"] thru end] [
raw/:key: none
]
keys: next keys
]
headers/other-headers: raw
headers
]
Expand Down Expand Up @@ -357,4 +368,4 @@ load-non-utf: func [
data [binary!]
] [
copy collect/into [forall data [keep to char! data/1]] {}
]
]