Skip to content

Commit fc55543

Browse files
committed
CHANGE: use the standardized br instead of brotli as the compression method name
1 parent 541cc51 commit fc55543

File tree

4 files changed

+32
-33
lines changed

4 files changed

+32
-33
lines changed

src/core/b-init.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
** REBOL [R3] Language Interpreter and Run-time Environment
44
**
55
** Copyright 2012 REBOL Technologies
6-
** Copyright 2012-2023 Rebol Open Source Contributors
6+
** Copyright 2012-2024 Rebol Open Source Contributors
77
** REBOL is a trademark of REBOL Technologies
88
**
99
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -1009,7 +1009,7 @@ static void Set_Option_File(REBCNT field, REBYTE* src, REBOOL dir )
10091009
blk = Get_System(SYS_CATALOG, CAT_COMPRESSIONS);
10101010
if (blk && IS_BLOCK(blk)) {
10111011
#ifdef INCLUDE_BROTLI
1012-
add_compression(SYM_BROTLI);
1012+
add_compression(SYM_BR);
10131013
#endif
10141014
#ifdef INCLUDE_CRUSH
10151015
add_compression(SYM_CRUSH);

src/core/n-strings.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ static struct digest {
426426
windowBits |= 16;
427427
goto zlib_compress;
428428

429-
case SYM_BROTLI:
429+
case SYM_BR:
430430
#ifdef INCLUDE_BROTLI
431431
Set_Binary(D_RET, CompressBrotli(ser, index, (REBINT)len, ref_level ? VAL_INT32(level) : -1));
432432
#else
@@ -507,7 +507,7 @@ static struct digest {
507507
windowBits |= 16;
508508
goto zlib_decompress;
509509

510-
case SYM_BROTLI:
510+
case SYM_BR:
511511
#ifdef INCLUDE_BROTLI
512512
Set_Binary(D_RET, DecompressBrotli(VAL_SERIES(data), VAL_INDEX(data), (REBINT)len, limit));
513513
#else

src/mezz/prot-http.reb

+6-7
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ REBOL [
1212
Licensed under the Apache License, Version 2.0
1313
See: http://www.apache.org/licenses/LICENSE-2.0
1414
}
15-
Version: 0.5.3
16-
Date: 11-Jul-2024
15+
Version: 0.5.4
16+
Date: 12-Jul-2024
1717
File: %prot-http.r3
1818
Purpose: {
1919
This program defines the HTTP protocol scheme for REBOL 3.
@@ -679,11 +679,10 @@ decode-result: func[
679679
result [block!] {[header body]}
680680
/local body content-type code-page encoding
681681
][
682-
if encoding: select result/2 'Content-Encoding [
683-
either find ["gzip" "deflate" "br"] encoding [
684-
if encoding == "br" [encoding: 'brotli]
682+
if encoding: attempt [to word! result/2/Content-Encoding] [
683+
either find system/catalog/compressions encoding [
685684
try/with [
686-
result/3: decompress result/3 to word! encoding
685+
result/3: decompress result/3 encoding
687686
][
688687
sys/log/info 'HTTP ["Failed to decode data using:^[[22m" encoding]
689688
return result
@@ -964,7 +963,7 @@ sys/make-scheme [
964963
;@@ One can set above value for example to: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"
965964
;@@ And so pretend that request is coming from Chrome on Windows10
966965
]
967-
if find system/catalog/compressions 'brotli [
966+
if find system/catalog/compressions 'br [
968967
append headers/Accept-Encoding ",br"
969968
]
970969
]

src/tests/units/compress-test.r3

+22-22
Original file line numberDiff line numberDiff line change
@@ -124,41 +124,41 @@ text: {Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempo
124124

125125
===start-group=== "Brotli compression / decompression"
126126
--test-- "Brotli compress/decompress"
127-
either error? e: try [compress "test" 'brotli][
127+
either error? e: try [compress "test" 'br][
128128
;-- Brotli compression is not available in current build
129129
--assert 'feature-na = e/id
130130
][
131-
--assert data = to string! decompress compress data 'brotli 'brotli
131+
--assert data = to string! decompress compress data 'br 'br
132132

133133
--test-- "Brotli compress/decompress while specifing level of compression"
134-
--assert (compress/level "" 'brotli 0) =
134+
--assert (compress/level "" 'br 0) =
135135
#{3B}
136-
--assert (compress/level data 'brotli 0) =
136+
--assert (compress/level data 'br 0) =
137137
#{8B0680746573742074657374207465737403}
138-
--assert text = to string! decompress compress/level text 'brotli 0 'brotli
139-
--assert text = to string! decompress compress/level text 'brotli 1 'brotli
140-
--assert text = to string! decompress compress/level text 'brotli 2 'brotli
141-
--assert text = to string! decompress compress/level text 'brotli 3 'brotli
142-
--assert text = to string! decompress compress/level text 'brotli 4 'brotli
143-
--assert text = to string! decompress compress/level text 'brotli 5 'brotli
144-
--assert text = to string! decompress compress/level text 'brotli 6 'brotli
145-
--assert text = to string! decompress compress/level text 'brotli 7 'brotli
146-
--assert text = to string! decompress compress/level text 'brotli 8 'brotli
147-
--assert text = to string! decompress compress/level text 'brotli 9 'brotli
148-
--assert text = to string! decompress compress/level text 'brotli 10 'brotli
149-
--assert text = to string! decompress compress/level text 'brotli 11 'brotli
138+
--assert text = to string! decompress compress/level text 'br 0 'br
139+
--assert text = to string! decompress compress/level text 'br 1 'br
140+
--assert text = to string! decompress compress/level text 'br 2 'br
141+
--assert text = to string! decompress compress/level text 'br 3 'br
142+
--assert text = to string! decompress compress/level text 'br 4 'br
143+
--assert text = to string! decompress compress/level text 'br 5 'br
144+
--assert text = to string! decompress compress/level text 'br 6 'br
145+
--assert text = to string! decompress compress/level text 'br 7 'br
146+
--assert text = to string! decompress compress/level text 'br 8 'br
147+
--assert text = to string! decompress compress/level text 'br 9 'br
148+
--assert text = to string! decompress compress/level text 'br 10 'br
149+
--assert text = to string! decompress compress/level text 'br 11 'br
150150

151151
--test-- "Brotli decompression with specified uncompressed size"
152-
bin: compress data 'brotli
153-
--assert #{74657374} = decompress/size bin 'brotli 4
152+
bin: compress data 'br
153+
--assert #{74657374} = decompress/size bin 'br 4
154154

155155
--test-- "Brotli compression when input is limited"
156-
--assert #{74657374} = decompress compress/part data 'brotli 4 'brotli
157-
--assert #{74657374} = decompress compress/part skip data 5 'brotli 4 'brotli
158-
--assert #{74657374} = decompress compress/part tail data 'brotli -4 'brotli
156+
--assert #{74657374} = decompress compress/part data 'br 4 'br
157+
--assert #{74657374} = decompress compress/part skip data 5 'br 4 'br
158+
--assert #{74657374} = decompress compress/part tail data 'br -4 'br
159159

160160
--test-- "Brotli decompress when not at head"
161-
--assert data = to string! decompress next join #{00} compress data 'brotli 'brotli
161+
--assert data = to string! decompress next join #{00} compress data 'br 'br
162162
]
163163
===end-group===
164164

0 commit comments

Comments
 (0)