| 444 | "<body><h1>500 Internal Server Error</h1></body></html>"; |
| 445 | |
| 446 | static int error_reply(nghttp2_session *session, |
| 447 | http2_stream_data *stream_data) { |
| 448 | int rv; |
| 449 | ssize_t writelen; |
| 450 | int pipefd[2]; |
| 451 | nghttp2_nv hdrs[] = {MAKE_NV(":status", "500")}; |
| 452 | |
| 453 | rv = pipe(pipefd); |
| 454 | if (rv != 0) { |
| 455 | LM_WARN("Could not create pipe"); |
| 456 | rv = nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, |
| 457 | stream_data->stream_id, |
| 458 | NGHTTP2_INTERNAL_ERROR); |
| 459 | if (rv != 0) { |
| 460 | LM_WARN("Fatal error: %s", nghttp2_strerror(rv)); |
| 461 | return -1; |
| 462 | } |
| 463 | |
| 464 | return 0; |
| 465 | } |
| 466 | |
| 467 | writelen = write(pipefd[1], ERROR_HTML, sizeof(ERROR_HTML) - 1); |
| 468 | close(pipefd[1]); |
| 469 | |
| 470 | if (writelen != sizeof(ERROR_HTML) - 1) { |
| 471 | close(pipefd[0]); |
| 472 | return -1; |
| 473 | } |
| 474 | |
| 475 | stream_data->fd = pipefd[0]; |
| 476 | |
| 477 | if (send_response_fd(session, stream_data->stream_id, hdrs, ARRLEN(hdrs), |
| 478 | pipefd[0]) != 0) { |
| 479 | close(pipefd[0]); |
| 480 | return -1; |
| 481 | } |
| 482 | |
| 483 | return 0; |
| 484 | } |
| 485 | |
| 486 | |
| 487 | static int timeout_reply(nghttp2_session *session, |
no test coverage detected