int32_t stream_id;
bool post; /* POST or GET */
- isc_region_t postdata;
- size_t postdata_pos;
+ isc_buffer_t *postdata;
char *GET_path;
size_t GET_path_len;
stream->GET_path = NULL;
stream->GET_path_len = 0;
}
- if (stream->postdata.base != NULL) {
- isc_mem_put(mctx, stream->postdata.base,
- stream->postdata.length);
+
+ if (stream->postdata != NULL) {
+ INSIST(stream->post);
+ isc_buffer_free(&stream->postdata);
}
+
if (stream == stream->httpsock->h2.connect.cstream) {
stream->httpsock->h2.connect.cstream = NULL;
}
}
if (cstream->post) {
- size_t len = cstream->postdata.length - cstream->postdata_pos;
+ size_t len = isc_buffer_remaininglength(cstream->postdata);
if (len > length) {
len = length;
}
- memmove(buf, cstream->postdata.base + cstream->postdata_pos,
- len);
- cstream->postdata_pos += len;
+ if (len > 0) {
+ memmove(buf, isc_buffer_current(cstream->postdata),
+ len);
+ isc_buffer_forward(cstream->postdata, len);
+ }
- if (cstream->postdata_pos == cstream->postdata.length) {
+ if (isc_buffer_remaininglength(cstream->postdata) == 0) {
*data_flags |= NGHTTP2_DATA_FLAG_EOF;
}
if (stream->post) {
char p[64];
- snprintf(p, sizeof(p), "%u", stream->postdata.length);
+ snprintf(p, sizeof(p), "%u",
+ isc_buffer_usedlength(stream->postdata));
nghttp2_nv hdrs[] = {
MAKE_NV2(":method", "POST"),
MAKE_NV(":scheme",
if (cstream->post) {
/* POST */
- cstream->postdata = (isc_region_t){
- .base = isc_mem_get(mctx, region->length),
- .length = region->length
- };
- memmove(cstream->postdata.base, region->base, region->length);
- cstream->postdata_pos = 0;
+ isc_buffer_allocate(mctx, &cstream->postdata, region->length);
+ isc_buffer_putmem(cstream->postdata, region->base,
+ region->length);
} else {
/* GET */
size_t path_size = 0;