| 302 | } |
| 303 | |
| 304 | static int on_header_cb(nghttp2_session *ngh2, const nghttp2_frame *frame, |
| 305 | const uint8_t *name, size_t namelen, |
| 306 | const uint8_t *value, size_t valuelen, |
| 307 | uint8_t flags, |
| 308 | void *userp) |
| 309 | { |
| 310 | h2_session *session = (h2_session *)userp; |
| 311 | h2_stream * stream; |
| 312 | apr_status_t status; |
| 313 | |
| 314 | (void)flags; |
| 315 | stream = get_stream(session, frame->hd.stream_id); |
| 316 | if (!stream) { |
| 317 | ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1, APLOGNO(02920) |
| 318 | H2_SSSN_STRM_MSG(session, frame->hd.stream_id, |
| 319 | "on_header unknown stream")); |
| 320 | return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; |
| 321 | } |
| 322 | |
| 323 | status = h2_stream_add_header(stream, (const char *)name, namelen, |
| 324 | (const char *)value, valuelen); |
| 325 | if (status != APR_SUCCESS && |
| 326 | (!stream->rtmp || |
| 327 | stream->rtmp->http_status == H2_HTTP_STATUS_UNSET || |
| 328 | /* We accept a certain amount of failures in order to reply |
| 329 | * with an informative HTTP error response like 413. But of the |
| 330 | * client is too wrong, we RESET the stream */ |
| 331 | stream->request_headers_failed > 100)) { |
| 332 | ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c1, |
| 333 | H2_SSSN_STRM_MSG(session, frame->hd.stream_id, |
| 334 | "RST stream, header failures: %d"), |
| 335 | (int)stream->request_headers_failed); |
| 336 | return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; |
| 337 | } |
| 338 | return 0; |
| 339 | } |
| 340 | |
| 341 | /** |
| 342 | * nghttp2 session has received a complete frame. Most are used by nghttp2 |
nothing calls this directly
no test coverage detected