Merge pull request #17 from guoye-zhang/relative

Fix relative URL
This commit is contained in:
Guoye Zhang authored and GitHub committed 2023-07-31 11:30:34 -07:00
commit 68deedb6b9
1 file changed
+1 -1
@@ -84,7 +84,7 @@ extension URL {
fileprivate var httpRequestComponents: (scheme: [UInt8], authority: [UInt8]?, path: [UInt8]) {
// CFURL parser based on byte ranges does not unnecessarily percent-encode WHATWG URL
let url = unsafeBitCast(self as NSURL, to: CFURL.self)
let url = unsafeBitCast(self.absoluteURL as NSURL, to: CFURL.self)
let length = CFURLGetBytes(url, nil, 0)
return withUnsafeTemporaryAllocation(of: UInt8.self, capacity: length) { buffer in
CFURLGetBytes(url, buffer.baseAddress, buffer.count)