File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -18,14 +18,14 @@ public enum BinaryHeaderMapEncoder {
1818 static let encoding : String . Encoding = . utf8
1919
2020 public static func encode( _ headerMap: BinaryHeaderMap ) throws -> Data {
21- let entries : [ BinaryHeaderMap . Entry ] = headerMap. entries. map { $0. value }
21+ let entries : [ BinaryHeaderMap . Entry ] = headerMap. entries. map { $0. value } . sorted { $0 . key < $1 . key }
2222 return try makeHeaderMapBinaryData ( withEntries: entries)
2323 }
2424}
2525
2626private func makeHeaderMapBinaryData( withEntries unsafeEntries: [ BinaryHeaderMap . Entry ] ) throws -> Data {
2727 let safeEntries = sanitize ( headerEntries: unsafeEntries)
28- let allStrings = Set ( safeEntries. flatMap { [ $0. key, $0. prefix, $0. suffix] } )
28+ let allStrings = Set ( safeEntries. flatMap { [ $0. key, $0. prefix, $0. suffix] } ) . sorted ( )
2929 let stringSection = try makeStringSection ( allStrings: allStrings)
3030 let bucketSection = try makeBucketSection (
3131 forEntries: safeEntries,
@@ -157,7 +157,7 @@ private struct StringSection {
157157 let offsets : [ String : StringSectionOffset ]
158158}
159159
160- private func makeStringSection( allStrings: Set < String > ) throws -> StringSection {
160+ private func makeStringSection( allStrings: [ String ] ) throws -> StringSection {
161161
162162 var buffer = Data ( )
163163 var offsets : [ String : StringSectionOffset ] = [ : ]
You can’t perform that action at this time.
0 commit comments