NEW! Новый релиз 12.0.0 уже доступен! Подробности в Центре заботы

libhtx

0

Описание

Простая http библиотека

Языки

C

  • CMake
Сообщить о нарушении
8 месяцев назад
8 месяцев назад
8 месяцев назад
README.md

Простая библиотека http для выполнения задач. Создана в первую очередь для телеграм бота, который я разрабатываю.

/* * cs stores headers by which you can known what is type file in the filename. * If data POST, then you have only post data without headers in the file. */ void handle_file (struct htx_client_struc *cs, const char *filename) { } int main (int argc, char **argv) { /* alloc struct */ struct htx_pool_http *ph = htx_malloc_and_set (sizeof (struct htx_pool_http), 0); /* create http server ports with max available client in the one time */ struct htx_http_struc *http0 = htx_init_struct ("0.0.0.0", 8080, 5); struct htx_http_struc *http1 = htx_init_struct ("0.0.0.0", 8090, 5); /* set handle file */ htx_http_set_handle_file (http0, handle_file); /* init config data */ struct htx_http_config *http0_config = htx_alloc_http_config (); http0_config->tmp_dir = strdup ("files"); htx_http_set_config (http0, http0_config); struct htx_http_config *http1_config = htx_alloc_http_config (); http1_config->tmp_dir = strdup ("tmp"); htx_http_set_config (http1, http1_config); /* Add some servers in the pool. If ret_pool greaten 0, then is error. */ int ret_pool = 0; ret_pool += htx_pool_http_add (ph, http0); ret_pool += htx_pool_http_add (ph, http1); if (ret_pool > 0) { /* * TODO: free cfg */ htx_pool_http_free (ph); exit (EXIT_FAILURE); } /* Finish. Make threads for incoming connections */ htx_pool_http_make_srv (ph); while (1) { sleep (1); } }

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.