| 716 | } |
| 717 | |
| 718 | static void DoraXrtHttpStreamOnClose(ptr owner, xnetstream* stream, xnet_result reason) { |
| 719 | DoraXrtHttpStreamContext* ctx = (DoraXrtHttpStreamContext*)owner; |
| 720 | xnet_result status; |
| 721 | (void)stream; |
| 722 | if (!ctx) { |
| 723 | return; |
| 724 | } |
| 725 | if (ctx->finalStatus == XRT_NET_AGAIN) { |
| 726 | (void)DoraXrtHttpStreamProcess(ctx); |
| 727 | } |
| 728 | if (ctx->finalStatus == XRT_NET_AGAIN) { |
| 729 | if (ctx->streamError) { |
| 730 | status = XRT_NET_ERROR; |
| 731 | } else if (!ctx->headerParsed) { |
| 732 | status = reason == XRT_NET_CANCELLED ? XRT_NET_CANCELLED : XRT_NET_ERROR; |
| 733 | } else if (ctx->bodyMode == DORA_XRT_HTTP_BODY_CHUNKED) { |
| 734 | status = XRT_NET_ERROR; |
| 735 | } else if (ctx->bodyMode == DORA_XRT_HTTP_BODY_CONTENT_LENGTH && ctx->received < ctx->contentLength) { |
| 736 | status = XRT_NET_ERROR; |
| 737 | } else { |
| 738 | status = XRT_NET_OK; |
| 739 | } |
| 740 | ctx->finalStatus = status; |
| 741 | } |
| 742 | DoraXrtHttpStreamResolve(ctx, ctx->finalStatus); |
| 743 | } |
| 744 | |
| 745 | static void DoraXrtHttpStreamOnError(ptr owner, xnetstream* stream, int sysErr) { |
| 746 | (void)stream; |
nothing calls this directly
no test coverage detected