tests passing babyyyyy, header is 112 bytes of pure ecstasy

This commit is contained in:
soypat
2025-05-25 02:01:53 -03:00
parent 095c4e1b57
commit b63ce5a964
3 changed files with 87 additions and 86 deletions
+8 -2
View File
@@ -45,8 +45,8 @@ func (tb headerBuf) musttoken(slice headerSlice) []byte {
}
func (tb headerBuf) slice(b []byte) headerSlice {
base := uintptr(unsafe.Pointer(&tb.buf[0]))
off := uintptr(unsafe.Pointer(&b[0]))
base := uintptr(unsafe.Pointer(unsafe.SliceData(tb.buf)))
off := uintptr(unsafe.Pointer(unsafe.SliceData(b)))
if off < base || off > base+uintptr(len(tb.buf)) {
panic("httpx: argument buffer does not alias header buffer")
}
@@ -87,6 +87,12 @@ type header struct {
flags flags
}
func (h *header) ParseBytes(b []byte) error {
h.resetSkipNormalize()
h.hbuf.readFromBytes(b)
return h.parse()
}
func (h *header) Set(key, value string) {
h.SetCanonical(key, value) //TODO: implement non-canonical.
}