-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let us know if you're using libasyncd #1
Comments
@wolkykim i'm trying to use libasyncd - i'm unable to link to the libraries in debian. is there something other than |
Sorry for late response. I hope you have resolved the issue already. |
Hi TixLo, |
Hi Wolkykim, I replaced my_conn_handler function with my_https_handler in according to helloworld_http_server.c in helloworld_ssl_server.c but it would crashed when received a HTTPS request. I tried to fixed but failed. Would you check this issue, please? ad_server_t *server = ad_server_new();
ad_server_set_option(server, "server.port", "8888");
ad_server_set_option(server, "server.enable_ssl", "1");
ad_server_set_option(server, "server.ssl_cert", "ssl.cert");
ad_server_set_option(server, "server.ssl_pkey", "ssl.pkey");
//ad_server_register_hook(server, my_conn_handler, NULL);
ad_server_register_hook(server, ad_https_handler, NULL); // HTTP Parser is also a hook.
ad_server_register_hook_on_method(server, "POST", my_http_post_handler, NULL);
ad_server_register_hook(server, my_http_default_handler, NULL);
return ad_server_start(server); the callstack of segmentation fault is below and I tried to return 0 when it happened. It didn't work. int ad_http_is_keepalive_request(ad_conn_t *conn) {
ad_http_t *http = (ad_http_t *) ad_conn_get_extra(conn); // http is NULL pointer
if (http->request.httpver == NULL) {
return 0;
} |
Does it launch a thread in my-https-handler? If then possibily the connection was terminated already and conn was reset? Not sure, can you send me the core dump file and the full code to [email protected]? |
Hey @wolkykim, I started learning C this month and wanted to make a server in it. I chose this library after googling because it was small. In theory I could read it and learn. One thing I quickly wanted was a router, so I made a small one. I don't know much C(coming from Python) so the code is probably filled with bugs, I wanted to share my ideas though. Thanks for an awesome library! #include <asyncd/asyncd.h>
#include <asyncdext/asyncdext.h>
#include <asyncdext/router.h>
int index(short event, ad_conn_t *conn, void *userdata) {
ad_http_response(conn, 200, "text/html", "Home page", 9);
return AD_DONE;
}
int about(short event, ad_conn_t *conn, void *userdata) {
ad_http_response(conn, 200, "text/html", "About page", 10);
return AD_DONE;
}
int main(int argc, char *argv[]) {
ad_server_t *server = ad_server_new();
ad_server_set_option(server, "server.port", "8888");
adext_router_t *router = adext_router_new(2);
adext_router_add(router, "^/$", index);
adext_router_add(router, "^/about/$", about);
ad_server_register_hook(server, ad_http_handler, NULL);
adext_router_register_hook(router, server);
return ad_server_start(server);
} I think we can add more than one router per server, haven't tried it. I'm planning to add more features. |
I'm using it to make a proof of concept for a certain way of deployment & building. Part of it is to expose an HTTPS server interface and one possible implementation is using libasyncd. |
Hi, |
It's always my great pleasure to know how it gets used.
Please leave your comment if you're using libasyncd.
Many thanks.
The text was updated successfully, but these errors were encountered: