| 1188 | } |
| 1189 | |
| 1190 | struct h2_stream *h2_session_push(h2_session *session, h2_stream *is, |
| 1191 | h2_push *push) |
| 1192 | { |
| 1193 | h2_stream *stream; |
| 1194 | h2_ngheader *ngh; |
| 1195 | apr_status_t status; |
| 1196 | int nid = 0; |
| 1197 | |
| 1198 | status = h2_req_create_ngheader(&ngh, is->pool, push->req); |
| 1199 | if (status == APR_SUCCESS) { |
| 1200 | nid = nghttp2_submit_push_promise(session->ngh2, 0, is->id, |
| 1201 | ngh->nv, ngh->nvlen, NULL); |
| 1202 | } |
| 1203 | if (status != APR_SUCCESS || nid <= 0) { |
| 1204 | ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, session->c1, |
| 1205 | H2_STRM_LOG(APLOGNO(03075), is, |
| 1206 | "submitting push promise fail: %s"), nghttp2_strerror(nid)); |
| 1207 | return NULL; |
| 1208 | } |
| 1209 | ++session->pushes_promised; |
| 1210 | |
| 1211 | ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1, |
| 1212 | H2_STRM_LOG(APLOGNO(03076), is, "SERVER_PUSH %d for %s %s on %d"), |
| 1213 | nid, push->req->method, push->req->path, is->id); |
| 1214 | |
| 1215 | stream = h2_session_open_stream(session, nid, is->id); |
| 1216 | if (!stream) { |
| 1217 | ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1, |
| 1218 | H2_STRM_LOG(APLOGNO(03077), is, |
| 1219 | "failed to create stream obj %d"), nid); |
| 1220 | /* kill the push_promise */ |
| 1221 | nghttp2_submit_rst_stream(session->ngh2, NGHTTP2_FLAG_NONE, nid, |
| 1222 | NGHTTP2_INTERNAL_ERROR); |
| 1223 | return NULL; |
| 1224 | } |
| 1225 | |
| 1226 | h2_session_set_prio(session, stream, push->priority); |
| 1227 | h2_stream_set_request(stream, push->req); |
| 1228 | return stream; |
| 1229 | } |
| 1230 | |
| 1231 | static int valid_weight(float f) |
| 1232 | { |
no test coverage detected