infof(conn->data, "on_data_chunk_recv() "
"len = %u, stream = %x\n", len, stream_id);
+ if(!c->bodystarted) {
+ memcpy(c->mem, "\r\n", 2); /* signal end of headers */
+ c->mem += 2;
+ c->len -= 2;
+ c->bodystarted = TRUE;
+ }
+
if(len < c->len) {
memcpy(c->mem, data, len);
c->mem += len;
c->len -= len;
}
else {
- infof(conn->data, "EEEEEEK\n");
+ infof(conn->data, "EEEEEEK: %d > %d\n", len, c->len);
+ /* return NGHTTP2_ERR_PAUSE; */
}
return 0;
c->mem[namelen + valuelen + 2]='\n';
c->mem[namelen + valuelen + 3]=0; /* to display this easier */
}
- infof(conn->data, "Got %s", c->mem);
c->mem += hlen;
c->len -= hlen;
conn->proto.httpc.mem = mem;
conn->proto.httpc.len = len;
- infof(conn->data, "http2_recv\n");
+ infof(conn->data, "http2_recv: %d bytes buffer\n",
+ conn->proto.httpc.len);
for(;;) {
rc = Curl_read_plain(conn->sock[FIRSTSOCKET], inbuf, H2_BUFSIZE, &nread);
*err = CURLE_RECV_ERROR;
return 0;
}
- infof(conn->data, "nread=%zd\n", nread);
+
if(!nread) {
*err = CURLE_RECV_ERROR;
return 0; /* TODO EOF? */
/* Happens when NGHTTP2_ERR_PAUSE is returned from user callback */
break;
}
+ break;
}
return len - conn->proto.httpc.len;
}
conn->recv[FIRSTSOCKET] = http2_recv;
conn->send[FIRSTSOCKET] = http2_send;
infof(conn->data, "We have switched to HTTP2\n");
+ httpc->bodystarted = FALSE;
/* send the SETTINGS frame (again) */
rc = nghttp2_session_upgrade(httpc->h2, httpc->binsettings, httpc->binlen,