19 Commits
Author SHA1 Message Date
Hashim Khan dfebed0b4e Make HTTPFields hashing consistent with equality (#143)
## Summary

HTTPFields equality does not depend on the order of differently named
fields. Hashing used storage order, so equal values could hash
differently.

This hashes each name group in relative order, then mixes those group
hashes without depending on name order. The existing hash test now
asserts equal hashes.

Fixes #139
2026-09-03 13:55:14 +00:00
Eric RosenbergandFabian Fett 6226da4bb9 Add HTTP/2 and HTTP/3 error code types (#148)
### Motivation

HTTP/2 and HTTP/3 both carry a numeric error code to say why a stream or
a connection was terminated. HTTPTypes has no currency type for either,
so adopters passed bare integers around or defined their own.

### Modifications

Add HTTP2ErrorCode and HTTP3ErrorCode.

### Result

HTTP/2 and HTTP/3 error codes are first-class currency types.

---------

Co-authored-by: Fabian Fett <fabianfett@apple.com>
2026-08-29 00:04:31 +01:00
Fabian Fett e186752bbc Improve equality check performance (#141)
### Motivation

#138 introduced code paths that scale quadratically when running an
equality check.

### Changes

- Introduce a new lock-step equality check that performs great for small
fields and fields that share roughly the same order
- Introduce a new lookup equality check that scales linear for vastly
different field orders

### Result

Faster equality checks
2026-08-18 14:46:30 +00:00
Fabian Fett 43cf84fb56 Reimplement HTTPFields on top of a simple Array (#138)
### Motivation

We like faster and simpler code. When optimizing performance we focus on
often used use-cases.

### Changes

- Reimplement HTTPFields on top of a simple Array

### Result

- HTTPFields building becomes significantly faster
- HTTPFields lookups are faster for small fields, and only slightly
slower for larger (nearly always offset by reduced build time)

Follow ups:

- Make the equality implementation smarter
2026-08-18 14:26:31 +02:00
Fabian Fett 4b1dd0cab3 Add hash tests, incl. a known failing one (#137)
### Motivation

The more we test the more we know about current behavior

### Changes

- Add tests for hashing, incl. a failing one

### Result

We know that our hash implementation isn't respecting different header
order
2026-08-14 12:56:29 +02:00
Fabian Fett 7d65507593 Move to swift-testing (#135)
### Motivation

We want to refactor some internals of this library. For this we need
tests. The existing tests are written with XCTest. Given that the total
number of test is relatively small, let's take the chance and move to
swift-testing before we add further tests.

### Changes

- Move all tests from XCTest to swift-testing
- This is a mechanical change

### Result

All tests use the test framework of the future.
2026-08-13 10:59:18 +02:00
Guoye Zhang e8011a7bc3 PseudoHeaderFields adopting CoW to reduce size (#88)
HTTPRequest size 288 -> 16
HTTPResponse size 80 -> 16

rdar://144520456
2025-02-21 17:30:57 -08:00
Franz Busch f3d9ec3eef [CI] Make all CI checks green
# Motivation

We just adopted GH actions and want to make sure all the CI checks are green.

# Modification

This PR makes the necessary changes to pass all checks. Including:

- Adding a licenseignore file
- Moving `swift-format` and adopting the config that we use in all other swift on server repos.

# Result

Green CI.
2024-10-24 22:30:18 +02:00
Guoye Zhang 291e929d94 Add conveniences for modern HTTP parsers 2024-06-18 20:22:37 -07:00
Guoye Zhang 20d5ed91ae Support lenient legalization of header field values 2024-04-23 17:31:54 -07:00
Guoye Zhang 43107b6de1 Update contributors 2023-09-19 12:24:27 -07:00
Guoye Zhang 4105126730 Rename raw subscript to values 2023-09-02 12:48:20 -07:00
Guoye Zhang bd06898009 Merge pull request #23 from guoye-zhang/codable
Support Codable
2023-08-17 15:37:47 -07:00
Guoye Zhang 792abeab1f Support Codable 2023-08-07 18:09:53 -07:00
Guoye Zhang 4c7d1331a5 Field order should be insignificant between fields of different names 2023-08-07 16:14:56 -07:00
Guoye Zhang 79ea5d0bc5 Update format and contributors 2023-07-14 16:03:19 -07:00
Tomohiro Kumagai 57140e3abc Make Request.Method and Response.Status conform to Sendable. 2023-07-14 22:53:32 +09:00
Guoye Zhang ae848811f9 Internal API review feedback 2023-06-30 10:06:35 -07:00
Guoye Zhang c164739694 Import code 2023-06-30 10:06:35 -07:00