decodeHeaders static method
Decode a QPACK-encoded field section into an Http3Request.
Extracts pseudo-headers (:method, :path, :scheme, :authority) and
treats the remainder as regular headers. :authority is stored under
the host key. The :scheme pseudo-header is currently ignored.
Implementation
static Http3Request decodeHeaders(Uint8List bytes) {
final lines = QpackDecoder.decodeFieldLines(bytes);
String method = '';
String path = '';
final headers = <String, String>{};
for (final line in lines) {
if (line.name == ':method') {
method = line.value;
} else if (line.name == ':path') {
path = line.value;
} else if (line.name == ':scheme') {
// ignored for now
} else if (line.name == ':authority') {
headers['host'] = line.value;
} else {
headers[line.name] = line.value;
}
}
return Http3Request(method: method, path: path, headers: headers);
}