DATA Frame
| 49 | // DATA Frame |
| 50 | // |
| 51 | int64_t |
| 52 | Http2DataFrame::write_to(MIOBuffer *iobuffer) const |
| 53 | { |
| 54 | // Write frame header |
| 55 | uint8_t buf[HTTP2_FRAME_HEADER_LEN]; |
| 56 | http2_write_frame_header(this->_hdr, make_iovec(buf)); |
| 57 | int64_t len = iobuffer->write(buf, sizeof(buf)); |
| 58 | |
| 59 | // Write frame payload |
| 60 | if (this->_reader && this->_payload_len > 0) { |
| 61 | int64_t written = 0; |
| 62 | // Fill current IOBufferBlock as much as possible to reduce SSL_write() calls |
| 63 | while (written < this->_payload_len) { |
| 64 | int64_t read_len = std::min(this->_payload_len - written, this->_reader->block_read_avail()); |
| 65 | |
| 66 | if (iobuffer->block_write_avail() < read_len) { |
| 67 | // This block size is the buffer size that we pass to SSLWriteBuffer |
| 68 | iobuffer->append_block(Http2::write_buffer_block_size_index); |
| 69 | } |
| 70 | |
| 71 | written += iobuffer->write(this->_reader->start(), read_len); |
| 72 | this->_reader->consume(read_len); |
| 73 | } |
| 74 | len += written; |
| 75 | } |
| 76 | |
| 77 | return len; |
| 78 | } |
| 79 | |
| 80 | // |
| 81 | // HEADERS Frame |
no test coverage detected