Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

Is it safe to ignore MG_EV_HTTP_CHUNK events?

The documentation says:

MG_EV_HTTP_CHUNK: An HTTP chunked-encoding chunk has arrived. The parsed HTTP reply is passed as struct http_message through the handler's void *ev_data pointer. http_message::body would contain incomplete, reassembled HTTP body. It will grow with every new chunk that arrives, and it can potentially consume a lot of memory. The event handler may process the body as chunks are coming, and signal Mongoose to delete processed body by setting MG_F_DELETE_CHUNK in mg_connection::flags. When the last zero chunk is received, Mongoose sends MG_EV_HTTP_REPLY event with full reassembled body (if handler did not signal to delete chunks) or with empty body (if handler did signal to delete chunks).

Is it then safe to ignore MG_EV_HTTP_CHUNK events and just wait until MG_EV_HTTP_REPLY event was received with all data inside?

Sign In or Register to comment.