⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rfc1952.ps

📁 RFC 的详细文档!
💻 PS
📖 第 1 页 / 共 3 页
字号:
b(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g
(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)42
b(10)0 1545 y Fi(1)60 b(Intr)o(oduction)0 1680 y Ff(1.1)50
b(Purpose)0 1796 y Fk(The)11 b(purpose)f(of)i(this)e(speci\256cation)g
(is)g(to)h(de\256ne)h(a)f(lossless)e(compressed)i(data)g(format)h
(that:)68 1882 y Fh(\017)23 b Fk(Is)12 b(independent)f(of)i(CPU)g
(type,)g(operating)e(system,)i(\256le)g(system,)f(and)h(character)g
(set,)g(and)f(hence)h(can)g(be)g(used)114 1938 y(for)e(interchange;)68
2025 y Fh(\017)23 b Fk(Can)12 b(compress)f(or)h(decompress)g(a)g(data)f
(stream)h(\(as)g(opposed)f(to)g(a)h(randomly)f(accessible)g(\256le\))h
(to)g(produce)f(an-)114 2081 y(other)h(data)g(stream,)i(using)d(only)h
(an)h Fe(a)f(priori)f Fk(bounded)g(amount)i(of)f(intermediate)g
(storage,)h(and)f(hence)h(can)g(be)114 2137 y(used)d(in)h(data)g
(communications)f(or)h(similar)g(structures)f(such)h(as)g(Unix)f
(\256lters;)68 2224 y Fh(\017)23 b Fk(Compresses)10 b(data)g(with)f(ef)
o(\256ciency)i(comparable)g(to)f(the)g(best)f(currently)h(available)g
(general-purpose)f(compres-)114 2280 y(sion)h(methods,)h(and)g(in)f
(particular)h(considerably)e(better)i(than)g(the)g(\252compress\272)g
(program;)68 2366 y Fh(\017)23 b Fk(Can)11 b(be)g(implemented)g
(readily)g(in)g(a)g(manner)h(not)e(covered)h(by)g(patents,)g(and)g
(hence)g(can)h(be)f(practiced)g(freely;)68 2452 y Fh(\017)23
b Fk(Is)10 b(compatible)g(with)f(the)h(\256le)h(format)f(produced)g(by)
g(the)g(current)h(widely)e(used)h(gzip)f(utility)m(,)g(in)h(that)g
(conforming)114 2509 y(decompressors)g(will)g(be)h(able)h(to)e(read)i
(data)f(produced)f(by)h(the)g(existing)f(gzip)g(compressor)n(.)0
2594 y(The)h(data)g(format)h(de\256ned)f(by)g(this)f(speci\256cation)g
(does)h(not)f(attempt)h(to:)0 2719 y(Deutsch)698 b(Informational)g
([Page)12 b(2])p eop
%%Page: 3 3
3 2 bop 0 46 a Fk(RFC)12 b(1952)500 b(GZIP)11 b(File)h(Format)f
(Speci\256cation)500 b(May)12 b(1996)68 195 y Fh(\017)23
b Fk(Provide)10 b(random)i(access)f(to)g(compressed)g(data;)68
282 y Fh(\017)23 b Fk(Compress)10 b(specialized)g(data)h(\(e.g.,)h
(raster)f(graphics\))f(as)h(well)f(as)h(the)g(best)f(currently)g
(available)g(specialized)g(al-)114 339 y(gorithms.)0
493 y Ff(1.2)50 b(Intended)12 b(audience)0 611 y Fk(This)e
(speci\256cation)g(is)h(intended)e(for)j(use)f(by)f(implementors)h(of)g
(software)f(to)h(compress)g(data)g(into)f(gzip)g(format)i(and/or)0
667 y(decompress)f(data)g(from)h(gzip)e(format.)0 754
y(The)g(text)f(of)i(the)e(speci\256cation)g(assumes)h(a)h(basic)e
(background)g(in)h(programming)g(at)g(the)g(level)f(of)h(bits)f(and)h
(other)g(prim-)0 811 y(itive)g(data)h(representations.)0
966 y Ff(1.3)50 b(Scope)0 1083 y Fk(The)12 b(speci\256cation)g
(speci\256es)g(a)h(compression)e(method)h(and)h(a)g(\256le)f(format)h
(\(the)f(latter)h(assuming)e(only)g(that)h(a)h(\256le)g(can)0
1140 y(store)e(a)i(sequence)e(of)h(arbitrary)g(bytes\).)k(It)c(does)g
(not)f(specify)g(any)h(particular)f(interface)h(to)f(a)i(\256le)f
(system)f(or)h(anything)0 1196 y(about)e(character)i(sets)f(or)g
(encodings)f(\(except)h(for)g(\256le)h(names)f(and)g(comments,)h(which)
e(are)i(optional\).)0 1351 y Ff(1.4)50 b(Compliance)0
1469 y Fk(Unless)8 b(otherwise)h(indicated)f(below)m(,)i(a)g(compliant)
e(decompressor)i(must)f(be)g(able)h(to)f(accept)h(and)f(decompress)h
(any)f(\256le)0 1525 y(that)e(conforms)g(to)g(all)h(the)f
(speci\256cations)f(presented)h(here;)i(a)f(compliant)e(compressor)h
(must)g(produce)h(\256les)f(that)g(conform)0 1581 y(to)k(all)g(the)g
(speci\256cations)f(presented)h(here.)16 b(The)11 b(material)h(in)f
(the)g(appendices)f(is)h(not)g(part)g(of)g(the)g(speci\256cation)g(per)
g(se)0 1638 y(and)g(is)g(not)f(relevant)h(to)g(compliance.)0
1793 y Ff(1.5)50 b(De\256nitions)11 b(of)h(terms)h(and)f(conventions)f
(used)0 1910 y Fk(byte:)j(8)d(bits)e(stored)h(or)h(transmitted)f(as)h
(a)g(unit)f(\(same)h(as)g(an)g(octet\).)k(\(For)c(this)f
(speci\256cation,)g(a)h(byte)g(is)f(exactly)g(8)h(bits,)0
1967 y(even)e(on)f(machines)h(which)f(store)h(a)g(character)h(on)e(a)h
(number)g(of)g(bits)f(dif)o(ferent)h(from)g(8.\))15 b(See)9
b(below)f(for)h(the)g(numbering)0 2023 y(of)i(bits)f(within)g(a)h
(byte.)0 2178 y Ff(1.6)50 b(Changes)12 b(fr)o(om)h(pr)o(evious)f
(versions)0 2296 y Fk(There)h(have)g(been)f(no)h(technical)f(changes)g
(to)g(the)g(gzip)h(format)g(since)f(version)g(4.1)g(of)h(this)f
(speci\256cation.)18 b(In)13 b(version)0 2352 y(4.2,)e(some)f
(terminology)e(was)i(changed,)g(and)g(the)g(sample)g(CRC)h(code)f(was)g
(rewritten)f(for)h(clarity)g(and)g(to)f(eliminate)g(the)0
2408 y(requirement)j(for)g(the)g(caller)g(to)f(do)h(pre-)g(and)g
(post-conditioni)o(ng.)j(V)-5 b(ersion)11 b(4.3)h(is)f(a)i(conversion)d
(of)j(the)e(speci\256cation)0 2465 y(to)g(RFC)h(style.)0
2719 y(Deutsch)698 b(Informational)g([Page)12 b(3])p
eop
%%Page: 4 4
4 3 bop 0 46 a Fk(RFC)12 b(1952)500 b(GZIP)11 b(File)h(Format)f
(Speci\256cation)500 b(May)12 b(1996)0 195 y Fi(2)60
b(Detailed)13 b(speci\256cation)0 331 y Ff(2.1)50 b(Overall)12
b(conventions)0 448 y Fk(In)f(the)g(diagrams)g(below)m(,)g(a)h(box)e
(like)h(this:)114 535 y Fd(+---+)114 592 y(|)82 b(|)27
b(<--)h(the)g(vertical)i(bars)e(might)h(be)f(missing)114
648 y(+---+)0 735 y Fk(represents)11 b(one)g(byte;)f(a)h(box)g(like)g
(this:)114 822 y Fd(+==============)q(+)114 879 y(|)382
b(|)114 935 y(+==============)q(+)0 1022 y Fk(represents)11
b(a)g(variable)g(number)g(of)g(bytes.)0 1109 y(Bytes)g(stored)g(within)
f(a)i(computer)f(do)g(not)g(have)h(a)g(\252bit)f(order)r(\272,)g(since)
h(they)f(are)h(always)f(treated)g(as)h(a)g(unit.)j(However)n(,)0
1165 y(a)d(byte)f(considered)f(as)i(an)g(integer)e(between)i(0)f(and)g
(255)g(does)g(have)h(a)f(most-)h(and)f(least-signi\256cant)e(bit,)j
(and)f(since)g(we)0 1222 y(write)f(numbers)g(with)f(the)h
(most-signi\256cant)e(digit)h(on)g(the)h(left,)h(we)f(also)g(write)g
(bytes)f(with)g(the)h(most-signi\256cant)e(bit)i(on)0
1278 y(the)h(left.)16 b(In)11 b(the)g(diagrams)h(below)m(,)f(we)g
(number)h(the)f(bits)f(of)h(a)h(byte)f(so)g(that)g(bit)f(0)i(is)e(the)i
(least-signi\256cant)d(bit,)i(i.e.,)h(the)0 1335 y(bits)e(are)i
(numbered:)114 1434 y Fd(+--------+)114 1491 y(|76543210|)114
1547 y(+--------+)0 1647 y Fk(This)7 b(document)g(does)g(not)f(address)
i(the)f(issue)f(of)i(the)f(order)h(in)f(which)g(bits)f(of)i(a)g(byte)f
(are)h(transmitted)e(on)i(a)g(bit-sequential)0 1703 y(medium,)k(since)e
(the)h(data)g(format)h(described)f(here)g(is)g(byte-)g(rather)g(than)g
(bit-oriented.)0 1790 y(W)n(ithin)h(a)h(computer)n(,)h(a)f(number)h
(may)f(occupy)g(multiple)e(bytes.)20 b(All)13 b(multi-byte)e(numbers)i
(in)g(the)f(format)i(described)0 1847 y(here)d(are)h(stored)e(with)g
(the)h(least-signi\256cant)e(byte)i(\256rst)f(\(at)i(the)e(lower)h
(memory)h(address\).)i(For)e(example,)f(the)g(decimal)0
1903 y(number)g(520)g(is)f(stored)h(as:)223 1990 y Fd(0)218
b(1)114 2046 y(+--------+-----)q(---)q(+)114 2103 y(|00001000|00000)q
(010)q(|)114 2159 y(+--------+-----)q(---)q(+)141 2216
y(\303)g(\303)141 2272 y(|)g(|)141 2329 y(|)g(+)28 b(more)g
(significant)j(byte)d(=)f(2)h(x)g(256)141 2385 y(+)f(less)i
(significant)h(byte)e(=)g(8)0 2719 y Fk(Deutsch)698 b(Informational)g
([Page)12 b(4])p eop
%%Page: 5 5
5 4 bop 0 46 a Fk(RFC)12 b(1952)500 b(GZIP)11 b(File)h(Format)f
(Speci\256cation)500 b(May)12 b(1996)0 195 y Ff(2.2)50
b(File)13 b(format)0 313 y Fk(A)g(gzip)f(\256le)h(consists)e(of)i(a)h
(series)e(of)h(\252members\272)h(\(compressed)f(data)g(sets\).)19
b(The)13 b(format)g(of)g(each)h(member)g(is)e(spec-)0
369 y(i\256ed)h(in)f(the)g(following)f(section.)19 b(The)12
b(members)i(simply)d(appear)i(one)g(after)g(another)f(in)g(the)h
(\256le,)g(with)f(no)g(additional)0 426 y(information)e(before,)i
(between,)f(or)g(after)h(them.)0 580 y Ff(2.3)50 b(Member)13
b(format)0 698 y Fk(Each)e(member)i(has)d(the)h(following)f(structure:)
114 785 y Fd(+---+---+---+--)q(-+-)q(--+-)q(--+-)q(--+)q(---+)q(---+)q
(---)q(+)114 841 y(|ID1|ID2|CM)30 b(|FLG|)138 b(MTIME)f(|XFL|OS)30
b(|)d(\(more-->\))114 898 y(+---+---+---+--)q(-+-)q(--+-)q(--+-)q(--+)q
(---+)q(---+)q(---)q(+)0 985 y Fk(\(if)11 b(FLG.FEXTRA)h(set\))114
1072 y Fd(+---+---+======)q(===)q(====)q(====)q(===)q(====)q(====)q
(===)q(==+)114 1128 y(|)27 b(XLEN)56 b(|...XLEN)29 b(bytes)g(of)f
("extra)h(field"...|)h(\(more-->\))114 1185 y(+---+---+======)q(===)q
(====)q(====)q(===)q(====)q(====)q(===)q(==+)0 1272 y
Fk(\(if)11 b(FLG.FNAME)h(set\))114 1359 y Fd(+==============)q(===)q
(====)q(====)q(===)q(====)q(====)q(===)q(==+)114 1415
y(|...original)30 b(file)f(name,)f(zero-terminat)q(ed.)q(..|)j
(\(more-->\))114 1472 y(+==============)q(===)q(====)q(====)q(===)q
(====)q(====)q(===)q(==+)0 1559 y Fk(\(if)11 b(FLG.FCOMMENT)h(set\))114
1646 y Fd(+==============)q(===)q(====)q(====)q(===)q(====)q(===+)114
1702 y(|...file)29 b(comment,)h(zero-terminated)q(...|)h(\(more-->\))
114 1759 y(+==============)q(===)q(====)q(====)q(===)q(====)q(===+)0
1846 y Fk(\(if)11 b(FLG.FHCRC)i(set\))114 1933 y Fd(+---+---+)114
1989 y(|)27 b(CRC16)i(|)114 2045 y(+---+---+)114 2145
y(+==============)q(===)q(====)q(==+)114 2201 y(|...compressed)i
(blocks...|)f(\(more-->\))114 2258 y(+==============)q(===)q(====)q
(==+)168 2357 y(0)82 b(1)g(2)g(3)h(4)f(5)g(6)g(7)114
2414 y(+---+---+---+--)q(-+-)q(--+-)q(--+-)q(--+)q(---+)114
2470 y(|)136 b(CRC32)i(|)f(ISIZE)g(|)114 2527 y(+---+---+---+--)q(-+-)q
(--+-)q(--+-)q(--+)q(---+)0 2719 y Fk(Deutsch)698 b(Informational)g
([Page)12 b(5])p eop
%%Page: 6 6
6 5 bop 0 46 a Fk(RFC)12 b(1952)500 b(GZIP)11 b(File)h(Format)f
(Speci\256cation)500 b(May)12 b(1996)0 195 y Fc(2.3.1)45
b(Member)12 b(header)g(and)g(trailer)11 300 y(ID1)f(\(IDenti\256cation)
g(1\))11 385 y(ID2)g(\(IDenti\256cation)g(2\))114 459
y Fk(These)d(have)g(the)g(\256xed)h(values)e(ID1)h(=)h(31)f(\(0x1f,)g
Fd(\\)p Fk(037\),)i(ID2)e(=)g(139)g(\(0x8b,)g Fd(\\)p
Fk(213\),)h(to)f(identify)f(the)h(\256le)h(as)f(being)114
516 y(in)i(gzip)h(format.)11 601 y Fc(CM)g(\(Compr)o(ession)g(Method\))
114 675 y Fk(This)g(identi\256es)g(the)h(compression)f(method)g(used)h
(in)f(the)h(\256le.)19 b(CM)13 b(=)f(0-7)f(are)i(reserved.)18
b(CM)13 b(=)f(8)g(denotes)f(the)114 732 y(\252de\257ate\272)i
(compression)f(method,)h(which)g(is)f(the)h(one)f(customarily)g(used)h
(by)f(gzip)g(and)h(which)f(is)h(documented)114 788 y(elsewhere.)11
873 y Fc(FLG)f(\(FLaGs\))114 947 y Fk(This)e(\257ag)h(byte)g(is)g
(divided)e(into)h(individual)f(bits)h(as)h(follows:)214
1038 y Fd(bit)28 b(0)82 b(FTEXT)214 1094 y(bit)28 b(1)82
b(FHCRC)214 1151 y(bit)28 b(2)82 b(FEXTRA)214 1207 y(bit)28
b(3)82 b(FNAME)214 1264 y(bit)28 b(4)82 b(FCOMMENT)214
1320 y(bit)28 b(5)82 b(reserved)214 1377 y(bit)28 b(6)82
b(reserved)214 1433 y(bit)28 b(7)82 b(reserved)114 1524
y Fk(If)11 b(FTEXT)g(is)g(set,)g(the)g(\256le)g(is)g(probably)f(ASCII)i
(text.)i(This)c(is)h(an)g(optional)f(indication,)f(which)i(the)f
(compressor)114 1581 y(may)k(set)f(by)g(checking)g(a)h(small)f(amount)g
(of)h(the)f(input)f(data)i(to)f(see)g(whether)g(any)h(non-ASCII)g
(characters)g(are)114 1637 y(present.)g(In)c(case)h(of)f(doubt,)g
(FTEXT)g(is)g(cleared,)h(indicating)d(binary)i(data.)15
b(For)10 b(systems)g(which)f(have)h(dif)o(ferent)114
1693 y(\256le)g(formats)h(for)f(ascii)g(text)g(and)g(binary)g(data,)g
(the)h(decompressor)f(can)g(use)g(FTEXT)g(to)g(choose)g(the)g
(appropriate)114 1750 y(format.)21 b(W)l(e)13 b(deliberately)f(do)h
(not)f(specify)h(the)f(algorithm)g(used)h(to)f(set)h(this)f(bit,)h
(since)g(a)g(compressor)g(always)114 1806 y(has)c(the)h(option)e(of)i
(leaving)f(it)g(cleared)h(and)g(a)g(decompressor)f(always)h(has)f(the)h
(option)e(of)i(ignoring)e(it)h(and)h(letting)114 1863
y(some)h(other)g(program)g(handle)g(issues)f(of)h(data)g(conversion.)
114 1937 y(If)j(FHCRC)h(is)f(set,)g(a)g(CRC16)h(for)f(the)g(gzip)f
(header)h(is)g(present,)g(immediately)f(before)i(the)e(compressed)h
(data.)114 1994 y(The)9 b(CRC16)i(consists)d(of)i(the)g(two)f(least)h
(signi\256cant)e(bytes)h(of)h(the)g(CRC32)g(for)h(all)e(bytes)g(of)h
(the)g(gzip)f(header)i(up)114 2050 y(to)f(and)h(not)f(including)f(the)i
(CRC16.)k([The)c(FHCRC)i(bit)d(was)g(never)i(set)e(by)h(versions)e(of)i
(gzip)g(up)f(to)h(1.2.4,)g(even)114 2107 y(though)e(it)i(was)g
(documented)f(with)h(a)g(dif)o(ferent)g(meaning)g(in)g(gzip)g(1.2.4.])
114 2181 y(If)g(FEXTRA)g(is)g(set,)g(optional)f(extra)h(\256elds)g(are)
h(present,)f(as)g(described)f(in)h(a)h(following)d(section.)114
2256 y(If)h(FNAME)g(is)f(set,)h(an)f(original)g(\256le)g(name)i(is)e
(present,)h(terminated)f(by)g(a)h(zero)g(byte.)k(The)c(name)g(must)f
(consist)f(of)114 2312 y(ISO)i(8859-1)f(\(LA)-5 b(TIN-1\))10
b(characters;)h(on)e(operating)g(systems)h(using)e(EBCDIC)j(or)g(any)f
(other)f(character)i(set)f(for)114 2369 y(\256le)g(names,)g(the)g(name)
g(must)f(be)h(translated)f(to)g(the)g(ISO)h(LA)-5 b(TIN-1)9
b(character)i(set.)j(This)9 b(is)g(the)h(original)e(name)i(of)114
2425 y(the)h(\256le)g(being)g(compressed,)g(with)g(any)g(directory)f
(components)h(removed,)g(and,)h(if)f(the)g(\256le)h(being)e(compressed)
114 2482 y(is)g(on)h(a)h(\256le)g(system)f(with)f(case)i(insensitive)d
(names,)j(forced)f(to)g(lower)g(case.)16 b(There)c(is)f(no)g(original)f
(\256le)h(name)h(if)114 2538 y(the)g(data)g(was)h(compressed)f(from)h
(a)g(source)f(other)g(than)g(a)h(named)g(\256le;)g(for)g(example,)g(if)
g(the)f(source)g(was)h(stdin)114 2594 y(on)d(a)i(Unix)e(system,)h
(there)g(is)g(no)g(\256le)g(name.)0 2719 y(Deutsch)698
b(Informational)g([Page)12 b(6])p eop
%%Page: 7 7
7 6 bop 0 46 a Fk(RFC)12 b(1952)500 b(GZIP)11 b(File)h(Format)f
(Speci\256cation)500 b(May)12 b(1996)114 195 y(If)f(FCOMMENT)h(is)f
(set,)g(a)h(zero-terminated)f(\256le)h(comment)f(is)g(present.)k(This)
10 b(comment)i(is)e(not)h(interpreted;)f(it)114 252 y(is)g(only)g
(intended)g(for)h(human)g(consumption.)i(The)e(comment)g(must)f
(consist)g(of)h(ISO)g(8859-1)f(\(LA)-5 b(TIN-1\))11 b(char)o(-)114
308 y(acters.)k(Line)c(breaks)g(should)e(be)j(denoted)e(by)h(a)g
(single)f(line)h(feed)g(character)h(\(10)f(decimal\).)114
384 y(Reserved)g(FLG)g(bits)f(must)h(be)g(zero.)11 470
y Fc(MTIME)h(\(Modi\256cation)f(TIME\))114 546 y Fk(This)d(gives)g(the)
h(most)g(recent)h(modi\256cation)e(time)h(of)h(the)f(original)f(\256le)
h(being)g(compressed.)14 b(The)9 b(time)g(is)g(in)g(Unix)114
602 y(format,)j(i.e.,)h(seconds)e(since)g(00:00:00)f(GMT)m(,)i(Jan.)17
b(1,)12 b(1970.)k(\(Note)11 b(that)g(this)g(may)h(cause)g(problems)f
(for)h(MS-)114 659 y(DOS)d(and)g(other)g(systems)f(that)h(use)g(local)g
(rather)h(than)e(Universal)h(time.\))14 b(If)c(the)f(compressed)g(data)
g(did)g(not)g(come)114 715 y(from)h(a)g(\256le,)h(MTIME)g(is)e(set)h
(to)f(the)h(time)g(at)g(which)f(compression)g(started.)14
b(MTIME)d(=)f(0)g(means)g(no)f(time)h(stamp)114 772 y(is)g(available.)
11 858 y Fc(XFL)i(\(eXtra)f(FLags\))114 934 y Fk(These)i(\257ags)g(are)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -