Skip to content

Commit

Permalink
Add Handler::recvLargeFile
Browse files Browse the repository at this point in the history
  • Loading branch information
ithewei committed Aug 10, 2022
1 parent 0dfcffe commit addef5d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions examples/httpd/handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ int Handler::recvLargeFile(const HttpContextPtr& ctx, http_parser_state state, c
}
ctx->userdata = file;
}
break;
case HP_BODY:
{
HFile* file = (HFile*)ctx->userdata;
Expand All @@ -241,14 +242,20 @@ int Handler::recvLargeFile(const HttpContextPtr& ctx, http_parser_state state, c
case HP_MESSAGE_COMPLETE:
{
HFile* file = (HFile*)ctx->userdata;
delete file;
if (file) {
delete file;
ctx->userdata = NULL;
}
return response_status(ctx, HTTP_STATUS_OK);
}
break;
case HP_ERROR:
{
HFile* file = (HFile*)ctx->userdata;
delete file;
if (file) {
delete file;
ctx->userdata = NULL;
}
}
break;
default:
Expand Down

0 comments on commit addef5d

Please sign in to comment.