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

Function h2_stream_send_frame

modules/http2/h2_stream.c:425–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423}
424
425apr_status_t h2_stream_send_frame(h2_stream *stream, int ftype, int flags, size_t frame_len)
426{
427 apr_status_t status = APR_SUCCESS;
428 int new_state, eos = 0;
429
430 H2_STRM_ASSERT_MAGIC(stream, H2_STRM_MAGIC_OK);
431 new_state = on_frame_send(stream->state, ftype);
432 if (new_state < 0) {
433 ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, stream->session->c1,
434 H2_STRM_MSG(stream, "invalid frame %d send"), ftype);
435 AP_DEBUG_ASSERT(new_state > S_XXX);
436 return transit(stream, new_state);
437 }
438
439 ++stream->out_frames;
440 stream->out_frame_octets += frame_len;
441 if(stream->c2) {
442 h2_conn_ctx_t *conn_ctx = h2_conn_ctx_get(stream->c2);
443 if(conn_ctx)
444 conn_ctx->bytes_sent = stream->out_frame_octets;
445 }
446
447 switch (ftype) {
448 case NGHTTP2_DATA:
449 eos = (flags & NGHTTP2_FLAG_END_STREAM);
450 break;
451
452 case NGHTTP2_HEADERS:
453 eos = (flags & NGHTTP2_FLAG_END_STREAM);
454 break;
455
456 case NGHTTP2_PUSH_PROMISE:
457 /* start pushed stream */
458 ap_assert(stream->request == NULL);
459 ap_assert(stream->rtmp != NULL);
460 status = h2_stream_end_headers(stream, 1, 0);
461 if (status != APR_SUCCESS) goto leave;
462 break;
463
464 default:
465 break;
466 }
467 status = transit(stream, new_state);
468 if (status == APR_SUCCESS && eos) {
469 status = transit(stream, on_event(stream, H2_SEV_CLOSED_L));
470 }
471leave:
472 return status;
473}
474
475apr_status_t h2_stream_recv_frame(h2_stream *stream, int ftype, int flags, size_t frame_len)
476{

Callers 1

on_frame_send_cbFunction · 0.85

Calls 4

on_frame_sendFunction · 0.85
h2_stream_end_headersFunction · 0.85
transitFunction · 0.70
on_eventFunction · 0.70

Tested by

no test coverage detected