julia
julia copied to clipboard
A lightweight high performance http server
疑惑和bug?
从知乎而来,看了楼主的代码,感觉受益匪浅。有几个疑惑: 1 hashmap那个结构,第一次见到这种写法,感觉有点意思,这种写法是什么专门的写法吗? 2 有没有可能buffer里面一次读取的是一个完整的包和第二个包的一部分(百度了下,这种是不是叫粘包?),那该怎么处理? 3 在server.c 中124行为什么要调用get_pid()?132行 daemon(1, 0);没有看到这个函数实现? 下面有几个我感觉是bug的地方。 4 get_pid函数中中没有关闭文件。 5 request_handle_uri函数中用了 r->port = atoi(uri->port.data);uri->port.data 并不是用‘\0’结尾的字符串,同理header_handle_content_length函数中int len = atoi(val->data)。 6 parse_uri函数中解析uri,uri->port.data没有设置值,uri->host.len没有设置值。 再次感谢楼主的代码。
The server does not support pipelining. A new request may reach without receiving response from server first. Thus, it is possible that two separate requests be in single recv buffer.