MCPcopy Create free account
hub / github.com/apache/httpd / on_frame_recv_cb

Function on_frame_recv_cb

modules/http2/h2_session.c:346–496  ·  view source on GitHub ↗

* nghttp2 session has received a complete frame. Most are used by nghttp2 * for processing of internal state. Some, like HEADER and DATA frames, * we need to act on. */

Source from the content-addressed store, hash-verified

344 * we need to act on.
345 */
346static int on_frame_recv_cb(nghttp2_session *ng2s,
347 const nghttp2_frame *frame,
348 void *userp)
349{
350 h2_session *session = (h2_session *)userp;
351 h2_stream *stream;
352 apr_status_t rv = APR_SUCCESS;
353
354 stream = frame->hd.stream_id? get_stream(session, frame->hd.stream_id) : NULL;
355 if (APLOGcdebug(session->c1)) {
356 char buffer[256];
357
358 h2_util_frame_print(frame, buffer, sizeof(buffer)/sizeof(buffer[0]));
359 if (stream) {
360 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1,
361 H2_STRM_LOG(APLOGNO(10302), stream,
362 "recv FRAME[%s], frames=%ld/%ld (r/s)"),
363 buffer, (long)session->frames_received,
364 (long)session->frames_sent);
365 }
366 else {
367 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1,
368 H2_SSSN_LOG(APLOGNO(03066), session,
369 "recv FRAME[%s], frames=%ld/%ld (r/s), "
370 "remote.emitted=%d"),
371 buffer, (long)session->frames_received,
372 (long)session->frames_sent,
373 (int)session->remote.emitted_count);
374 }
375 }
376
377 ++session->frames_received;
378 switch (frame->hd.type) {
379 case NGHTTP2_HEADERS:
380 /* This can be HEADERS for a new stream, defining the request,
381 * or HEADER may come after DATA at the end of a stream as in
382 * trailers */
383 if (stream) {
384 rv = h2_stream_recv_frame(stream, NGHTTP2_HEADERS, frame->hd.flags,
385 frame->hd.length + H2_FRAME_HDR_LEN);
386 }
387 break;
388 case NGHTTP2_DATA:
389 if (stream) {
390 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1,
391 H2_STRM_LOG(APLOGNO(02923), stream,
392 "DATA, len=%ld, flags=%d"),
393 (long)frame->hd.length, frame->hd.flags);
394 rv = h2_stream_recv_frame(stream, NGHTTP2_DATA, frame->hd.flags,
395 frame->hd.length + H2_FRAME_HDR_LEN);
396 }
397 break;
398 case NGHTTP2_PRIORITY:
399 session->reprioritize = 1;
400 ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c1,
401 H2_SSSN_STRM_MSG(session, frame->hd.stream_id, "PRIORITY frame "
402 " weight=%d, dependsOn=%d, exclusive=%d"),
403 frame->priority.pri_spec.weight,

Callers

nothing calls this directly

Calls 5

get_streamFunction · 0.85
h2_util_frame_printFunction · 0.85
h2_stream_recv_frameFunction · 0.85
h2_mplx_c1_client_rstFunction · 0.85

Tested by

no test coverage detected