Skip to content
Discussion options

You must be logged in to vote

Yes, nc->pfn_data = NULL is the 7.24 replacement for is_resp = 0 when you wrote the response yourself with mg_printf/mg_send. mg_http_reply does the same thing at the end (http.c#L471). http_cb sets pfn_data = c before MG_EV_HTTP_MSG and won't parse the next pipelined request until it's NULL again (L1150-L1152, L1245-L1246).

The crash comes from doing it after mg_http_serve_file/mg_http_serve_dir. In 7.24 pfn_data is no longer just a flag: while a file is streaming, it holds the open struct mg_fd * and pfn is static_cb (L672-L673). static_cb reads the file from c->pfn_data on the next poll (L489-L497), so setting it to NULL there gives you a NULL fd and that SEGV. In 7.23 is_resp was a se…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@jcorporation
Comment options

Answer selected by jcorporation
Comment options

You must be logged in to vote
4 replies
@jcorporation
Comment options

@scaprile
Comment options

@dylanpulver
Comment options

@scaprile
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants