/* Decode the payload of a HEADERS frame and produce the equivalent HTTP/1
* request. Returns the number of bytes emitted if > 0, or 0 if it couldn't
* proceed. Stream errors are reported in h2s->errcode and connection errors
- * in h2c->errcode. The caller must already have checked the frame header and
- * ensured that the frame was complete or the buffer full.
+ * in h2c->errcode.
*/
static int h2_frt_decode_headers(struct h2s *h2s, struct buffer *buf, int count)
{
return 0;
}
+ if (h2c->dbuf->i < h2c->dfl && h2c->dbuf->i < h2c->dbuf->size)
+ return 0; // incomplete input frame
+
/* if the input buffer wraps, take a temporary copy of it (rare) */
wrap = h2c->dbuf->data + h2c->dbuf->size - h2c->dbuf->p;
if (wrap < h2c->dfl) {
if (!h2c->dbuf->size)
return 0; // empty buffer
- if (h2c->dbuf->i < h2c->dfl && h2c->dbuf->i < h2c->dbuf->size)
- return 0; // incomplete input frame
-
switch (h2c->dft) {
case H2_FT_HEADERS:
ret = h2_frt_decode_headers(h2s, buf, count);