Ability to have custom http request handler #478
-
Is it possible to have a custom http request handler in addition to webui_set_file_handler? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Is POST, DELETE... are not routed to webui_set_file_handler right now? |
Beta Was this translation helpful? Give feedback.
-
I thought this if:
https://github.com/webui-dev/webui/blob/ead99700e99d25500f8a4a4b5ca9efcc6f28b47d/src/webui.c#L7854
would prevent it.
I guess, I should test it.
пн, 26 авг. 2024 г., 22:10 Showns ***@***.***>:
… Is POST, DELETE... are not routed to webui_set_file_handler right now?
—
Reply to this email directly, view it on GitHub
<#478 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOAHKH37HMJ62JDHIAIFTTZTN4UFAVCNFSM6AAAAABNBNFXJOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANBVGUZTIOI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
But webui_set_file_handler doesn't receive method or reqest data just url.
We would need a new handler function for this, wouldn't we?
вт, 27 авг. 2024 г., 00:21 Showns ***@***.***>:
… Probably you are right. You can try:
if (strcmp(ri->request_method, "GET") == 0 ||
strcmp(ri->request_method, "POST") == 0 ||
strcmp(ri->request_method, "PUT") == 0 ||
strcmp(ri->request_method, "DELETE") == 0 ||
strcmp(ri->request_method, "PATCH") == 0)
{
// ...
}
If this worked for you, and all the C examples still working, then you can
create a PR. Thank you.
—
Reply to this email directly, view it on GitHub
<#478 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOAHKBTYAZVTRYOYFFU4Y3ZTOL4BAVCNFSM6AAAAABNBNFXJOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANBVGYZTOMI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Thank you! This is exactly what I need. |
Beta Was this translation helpful? Give feedback.
Yes, only the URLs, I guess the solution is to use a custom web server (apache, python server, nginx...)
See this example: https://github.com/webui-dev/webui/tree/main/examples/C/custom_web_server