if (qpack_encode_scheme(&headers_buf, scheme))
goto err;
- if (qpack_encode_path(&headers_buf, ist('/')))
+ if (qpack_encode_path(&headers_buf, uri))
goto err;
/* :authority */
/* Returns 0 on success else non-zero. */
int qpack_encode_path(struct buffer *out, const struct ist path)
{
+ size_t sz;
+
if (unlikely(isteq(path, ist("/")))) {
if (!b_room(out))
return 1;
return 0;
}
else {
- /* TODO */
- ABORT_NOW();
+ sz = 1 + qpack_get_prefix_int_size(istlen(path), 7) + istlen(path);
+ if (b_room(out) < sz)
+ return 1;
+
+ qpack_encode_prefix_integer(out, 1, 4, 0x50);
+ qpack_encode_prefix_integer(out, istlen(path), 7, 0);
+ for (size_t i = 0; i < istlen(path); ++i)
+ b_putchr(out, istptr(path)[i]);
+ return 0;
}
}