Closed fengyj2022 closed 1 year ago
@lminiero
From your description, it looks like this is a bug you're encountering because you're trying to modify the code of the HTTP plugin for something you need. As such, I don't think it can be considered a bug. I'd only consider it a bug if specific interactions on the HTTP side can lead to the deadlock you described, which from what I understood is not the case.
@lminiero I found that the microhttpd library does not support modifying the header after receiving a callback. Do you have such a problem? Is there a solution?
I don't know, but that's out of scope here. Please ask on their mailing list.
@lminiero Yes, I have built a bugtracker. If you have similar problems, please help me .https://bugs.gnunet.org/view.php?id=7757
How did you implement whep and whip on janus' http c voice library?
I didn't, I implemented WHIP and WHEP as thin layers in front of Janus, not inside Janus itself: https://github.com/meetecho/simple-whip-server https://github.com/meetecho/simple-whep-server
janus transports http bug
MHD_start_daemon
/ Suspend the connection /
MHD_suspend_connection(msg-> connection);
1) 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
/ add response header /
2).MHD_add_response_header (response, "Content-Type", "application/json");
/ add cors header /
3).janus_http_add_cors_headers (msg, response);
ret = MHD_queue_response(msg-> connection, MHD_HTTP_OK, response);
MHD_destroy_response(response);
The callback is received to process send_messages
Assign the received response_text to the response's pyload.
MHD_resume_connection(msg-> connection);
View the microhttpd library source At the end of step 4, 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 6, there is no way to change the header information by re-executing steps 3 and 6. In step 6, the header is updated again; calling MHD_queue_response causes a deadlock.
Please help to solve the bug
The operation I want:modify the response packet header upon receipt of janus_http_send_message