【Node.js 自己封装的库 http_parse, libuv】

本文深入介绍了Node.js网络框架及其核心组件http_parser和libuv库的功能与实现,包括它们在HTTP协议解析、异步事件处理方面的应用及与Nginx的联系。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

【Node.js 自己封装的库 http_parse, libuv】

 

Node.js 

介绍:一个网络框架,更多:http://www.oschina.net/p/nodejs

官网:http://nodejs.org/

 

 

代码库地址:https://github.com/joyent

 

http_parser:

介绍:一个解析http协议的东西,有部分内容来自于Nginx

代码:https://github.com/joyent/http-parser

 

 

libuv

介绍:基于异步事件的封装,比 libevent/libev 更容易使用,跨平台性更好,代码部分来源 libev和nginx,目前微软使用libUV把redis移植到了Windows

代码:https://github.com/joyent/libuv

相关:

http://blog.codingnow.com/2012/01/libuv.html

http://c.chinaitlab.com/others/875170.html

与 Python 的 SimpleHTTPServer,Node.js 的 serve 不同,serve2 是一个支持动态文件的工具,前者们只支持静态文件,而serve2支持编写代码动态处理和返回http请求。 常常我们可能会有这样的需求场景:无论是在开发时还是尝试某个框架时,往往需要处理请求参数、Cookies、Http headers等,这样简单的静态文件服务器便无法满足这种需求了。 于是serve2便应运而生了,基于Tj的serve开发,使用起来跟一般的静态文件服务器相同,执行一条命令即可。详细的用法介绍如下。 1. 下载安装 npm install -g serve2 2. 使用运行 λ serve2 --help   Usage: serve2 [options] [dir]   Options:     -h, --help                output usage information     -V, --version             output the version number     -a, --auth <user>:<pass>  specify basic auth credentials     -F, --format <fmt>        specify the log format string     -p, --port <port>         specify the port [3000]     -H, --hidden              enable hidden file serving     -S, --no-stylus           disable stylus rendering     -J, --no-jade             disable jade rendering         --no-less             disable less css rendering     -I, --no-icons            disable icons     -L, --no-logs             disable request logging     -D, --no-dirs             disable directory serving     -f, --favicon <path>      serve the given favicon     -M, --mocks <path>        mock files directory         --cookies             add cookies parse support     -C, --cors                allows cross origin access serving         --compress            gzip or deflate the response         --exec <cmd>          execute command on each request 标签:serve2 分享 window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": [], "bdPic": "", "bdStyle": "1", "bdSize": "24" }, "share": {} }; with (document)0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' ~(-new Date() / 36e5)];\r\n \r\n \r\n \r\n \r\n \u8f6f\u4ef6\u9996\u9875\r\n \u8f6f\u4ef6\u4e0b\u8f7d\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\nwindow.changyan.api.config({\r\nappid: 'cysXjLKDf', conf: 'prod_33c27aefa42004c9b2c12a759c851039' });
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值