View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007757 | libmicrohttpd | libmicrohttpd API | public | 2023-03-09 07:06 | 2023-03-09 07:55 |
Reporter | fengyingjie | Assigned To | |||
Priority | immediate | Severity | major | Reproducibility | always |
Status | new | Resolution | open | ||
Platform | linux | OS | centos | OS Version | 7.4.1708 |
Product Version | 0.9.75 | ||||
Summary | 0007757: MHD_add_response_header set by MHD_create_response_from_callback continues to execute MHD_queue_response and cannot continue to | ||||
Description | MHD_add_response_header set by MHD_create_response_from_callback continues to execute MHD_queue_response and cannot continue to modify the response after receiving the callback asynchronously header | ||||
Steps To Reproduce | // Create the service instance 1. MHD_start_daemon 2. struct MHD_Response *response = MHD_create_response_from_callback(MHD_SIZE_UNKNOWN, 500, &janus_http_response_callback, msg, NULL); // The callback to get the response data and copy the body of the callback into the pyload of the response janus_http_response_callback /* Suspend the connection */ 3. MHD_suspend_connection(msg-> connection); /* add response header */ 4. MHD_add_response_header(response, "Content-Type", "application/json"); /* add cors header */ 5. janus_http_add_cors_headers(msg, response); // Queue the response for transmission to the client as soon as possible, but only after MHD_AccessHandlerCallback returns. This function checks if it is legal to queue a response for a given connection at this time. It also increments the internal reference counter of the response object (the counter is automatically decremented once the response is transmitted). 6. ret = MHD_queue_response(msg-> connection, MHD_HTTP_OK, response); // Destroy the response object and associated resources (decrement the reference count) 7. MHD_destroy_response(response); The callback is received to process send_messages Assign the received response_text to the response's pyload /* resume the connection */ 9. MHD_resume_connection(msg-> connection); 10. View the microhttpd library source At step 6, the connection-> state is set from MHD_CONNECTION_HEADERS_PROCESSED to MHD_CONNECTION_FOOTERS_RECEIVED, In MHD_CONNECTION_FOOTERS_RECEIVED the thread copies the header into the header of the sent packet So at step 8, there is no way to change the header information by reruning steps 4 and 6. | ||||
Tags | No tags attached. | ||||
|
At step 6, there is no way to change the header information by reexecuting steps 3 and 6. In step 6, the header is updated again; calling MHD_queue_response causes a deadlock. |
Date Modified | Username | Field | Change |
---|---|---|---|
2023-03-09 07:06 | fengyingjie | New Issue | |
2023-03-09 07:55 | fengyingjie | Note Added: 0019939 |