zaver icon indicating copy to clipboard operation
zaver copied to clipboard

Yet another fast and efficient HTTP server

Results 7 zaver issues
Sort by recently updated
recently updated
newest added

[ERROR] (/home/wiltjames/Desktop/Code/zaver-master/src/util.c:60: errno: Bad file descriptor) fcntl [ERROR] (/home/wiltjames/Desktop/Code/zaver-master/src/zaver.c:117: errno: Bad file descriptor) make_socket_non_blocking [ERROR] (/home/wiltjames/Desktop/Code/zaver-master/src/epoll.c:23: errno: Bad file descriptor) zv_epoll_add: epoll_ctl 请问为什么运行时会出现这些错误?

``` pthread_mutex_t lock; pthread_cond_t cond; ``` https://github.com/zyearn/zaver/blob/master/src/threadpool.h#L29-L30 线程池结构中只有一对互斥锁和条件变量,生产者线程每添加一个新任务,都会调用 pthread_cond_signal 一次,所有线程都会等待同一个`cond`, 但最终只有一个消费者线程从队列里拿到任务去执行,其他线程被唤醒带来不必要的线程调度开销,这就是惊群现象的根源所在,并且是消费者线程数量越多,惊群现象越严重----意味着 CPU 占用越高,线程池的调度性能越低。 一个解决方法是,在共用同一个互斥锁情况下,给每一个消费者线程创建对应的线程条件变量,这样生产者线程有新任务并找到空闲消费者线程时候,将任务添加到队列中并只通知该消费者线程。线程条件变量的通知过程是定向的,未被通知的消费者线程不会被唤醒,这样惊群现象也就不会产生了。

https://github.com/zyearn/zaver/blob/2f43059852f3bfe88b90293a892671e65594c507/src/http_parse.c#L50 我查阅了nginx源码,它不光包含下划线,还包含中划线。 HTTP 方法中不都是大写字母吗?疑惑中。。。

你主页中的线程池的使用都注释了,是线程池没做好吗?

1 `if ((pool = (zv_threadpool_t *)malloc(sizeof(zv_threadpool_t))) == NULL){ goto err; }` 动态申请pool的内存为什么没有释放? 2 `if (pool->shutdown == immediate_shutdown) { break; } else if ((pool->shutdown == graceful_shutdown) && pool->queue_size == 0) {...

add function "zv_remove_double_dots" to fix directory traversal

Directory traversal. Hackers can gain access to a wealth of sensitive information including configuration files. ![image](https://user-images.githubusercontent.com/86256628/186872271-12b858e0-835b-4119-93d8-d21e32b7cad7.png) For example, here I can read my `.bashrc` and `zaver.conf` ![image](https://user-images.githubusercontent.com/86256628/186873163-a520fd47-48ba-44ae-afe1-85b45807f19d.png)