Skip to content

Commit

Permalink
FIX: using deline to normalize CRLF to LF when reading text HTML co…
Browse files Browse the repository at this point in the history
…ntent
  • Loading branch information
Oldes committed Jun 9, 2020
1 parent eecaec8 commit 6520457
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/mezz/prot-http.r
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,8 @@ decode-result: func[
][
unless code-page [code-page: "utf-8"]
sys/log/info 'HTTP ["Trying to decode from code-page:^[[m" code-page]
try [result/2: iconv result/2 code-page]
; using also deline to normalize possible CRLF to LF
try [result/2: deline iconv result/2 code-page]
]
result
]
Expand Down Expand Up @@ -703,12 +704,12 @@ sys/make-scheme [
sys/log/debug 'HTTP "WRITE"
;?? port
case [
map? value [
value: reduce [[Content-Type: "application/json; charset=utf-8"] encode 'JSON value]
]
binary? value [
value: reduce [[Content-Type: "application/octet-stream"] value]
]
map? value [
value: reduce [[Content-Type: "application/json; charset=utf-8"] encode 'JSON value]
]
not block? value [
value: reduce [[Content-Type: "application/x-www-form-urlencoded; charset=utf-8"] form value]
]
Expand Down

0 comments on commit 6520457

Please sign in to comment.