| 101 | } |
| 102 | |
| 103 | int |
| 104 | Http3HeaderVIOAdaptor::_on_qpack_decode_complete() |
| 105 | { |
| 106 | // Currently trailer support for h3 is not implemented. |
| 107 | constexpr static bool NON_TRAILER = false; |
| 108 | if (!HeaderValidator::is_h2_h3_header_valid(this->_header, http_hdr_type_get(this->_header.m_http) == HTTP_TYPE_RESPONSE, |
| 109 | NON_TRAILER)) { |
| 110 | Dbg(dbg_ctl_http3, "Header is invalid"); |
| 111 | return -1; |
| 112 | } |
| 113 | int res = this->_hvc.convert(this->_header, 3, 1); |
| 114 | if (res != 0) { |
| 115 | Dbg(dbg_ctl_http3, "PARSE_RESULT_ERROR"); |
| 116 | return -1; |
| 117 | } |
| 118 | |
| 119 | // FIXME: response header might be delayed from first response body because of callback from QPACK |
| 120 | // Workaround fix for mixed response header and body |
| 121 | if (http_hdr_type_get(this->_header.m_http) == HTTP_TYPE_RESPONSE) { |
| 122 | return 0; |
| 123 | } |
| 124 | |
| 125 | SCOPED_MUTEX_LOCK(lock, this->_sink_vio->mutex, this_ethread()); |
| 126 | MIOBuffer *writer = this->_sink_vio->get_writer(); |
| 127 | |
| 128 | // TODO: Http2Stream::send_request has same logic. It originally comes from HttpSM::write_header_into_buffer. |
| 129 | // a). Make HttpSM::write_header_into_buffer static |
| 130 | // or |
| 131 | // b). Add interface to HTTPHdr to dump data |
| 132 | // or |
| 133 | // c). Add interface to HttpSM to handle HTTPHdr directly |
| 134 | int bufindex; |
| 135 | int dumpoffset = 0; |
| 136 | int done, tmp; |
| 137 | IOBufferBlock *block; |
| 138 | do { |
| 139 | bufindex = 0; |
| 140 | tmp = dumpoffset; |
| 141 | block = writer->get_current_block(); |
| 142 | if (!block) { |
| 143 | writer->add_block(); |
| 144 | block = writer->get_current_block(); |
| 145 | } |
| 146 | done = this->_header.print(block->end(), block->write_avail(), &bufindex, &tmp); |
| 147 | dumpoffset += bufindex; |
| 148 | writer->fill(bufindex); |
| 149 | if (!done) { |
| 150 | writer->add_block(); |
| 151 | } |
| 152 | } while (!done); |
| 153 | |
| 154 | this->_is_complete = true; |
| 155 | return 1; |
| 156 | } |
no test coverage detected