webcpp / hi-nginx Goto Github PK
View Code? Open in Web Editor NEWA fast and robust web server and application server for C++,Python,Lua ,Java language
License: BSD 2-Clause "Simplified" License
A fast and robust web server and application server for C++,Python,Lua ,Java language
License: BSD 2-Clause "Simplified" License
如conf中
http
{
server {listen 80; }
server {listen 8080; }
}
http服务监听了两个端口(测试/发布);有没有办法判断同一个http请求是访问那个端口的?
namespace hi::request (c++) 如何添加扩展?
make的时候 报php错误 找不到php/main/php.h 文档没说如何安装php7
小白问题:
支持windows 平台么?
As i am concerned about performance, want to know that if the c++ application code "runs as a seprate process and communicates via Inter process communication with Nginx" or "it is loaded into nginx as .so file, like a plugin does."
I am very excited to know.
version:release-2.2.5
./configure后执行make,报错fatal error: jsoncons/basic_json.hpp: No such file or directory
请问作者平常使用hi-nginx编写cpp模块时,有什么方便点的调试方法(不调试nginx,调试so)?也是直接attach上吗?另外,如果要调试其它如PHP或js等脚本语言写的模块呢?有什么好的调试方法?
php::Variant::jsonEncode(long, long)': variant.cc:(.text+0x4ac): undefined reference to
json_globals'json_globals' variant.cc:(.text+0x4ca): undefined reference to
php_json_encode'json_globals' objs/addon/php-x/variant.o: In function
php::Variant::jsonDecode(long, long)':json_globals' variant.cc:(.text+0x632): undefined reference to
php_json_decode_ex'另外还想请教下,最近出了个nginx unit,和你的hi-nginx异同,谢谢
您好, 能否提供一个cpp的demo例子?感谢!
cp -R /include '/usr/local/nginx/'
cp: 无法获取'/include' 的文件状态(stat): 没有那个文件或目录
objs/Makefile:1170: recipe for target 'install' failed
https://doc.hi-nginx.com/00/0005.html
在hi-nginx中,一共有5个开发:
在hi-nginx中,一共有5个开关:
在hi-nginx上执行跟甩到各语言后端执行的效率跟资源消耗的比较。
你好,尝试将部分代码修改为C语言的时候,发现这个函数没有能正确的获取到body. helloserver就是一个简单的回复helloworld的功能。
另外,问一下,有没有群(QQ 或者 微信)方便沟通交流的地方?
http脚本如下:
use strict;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
if( scalar(@argv) <= 0 ){
print "multipart.pl 123312\n";
exit(-1);
}
my $count = 0 + $ARGV[0];
my $browser = LWP::UserAgent->new();
$browser->agent( "SGMS/2.0". $browser->agent );
print "count = $count\n";
while( $count-- ){
#my $response = $browser->request($req);
my $response = $browser->post('http://192.168.0.204:8080/helloserver?f=e&g=s&p=w',
[
'subject' => 'test for toolmao.com',
'uploadfile' => ["./README.md"], #这里是被上传的文件路径
'user' => 'Yajun Dang',
],
'Content_Type' => 'form-data' #这句不可少,表示类型为 multipart/form-data
);
if( not $response->is_success ){
print "request failed\n";
} else {
print $response->content."\n";
}
}
修改后的get_input_body代码如下:
ngx_str_t http_get_input_body(ngx_http_request_t *r)
{
size_t len;
size_t total = 0;
size_t pos = 0;
ngx_buf_t *buf;
ngx_chain_t *cl;
ngx_str_t body = ngx_null_string;
if (r->request_body == NULL || r->request_body->bufs == NULL)
{
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "[%s]request body is NULL", __FUNCTION__);
return body;
}
cl = r->request_body->bufs;
do { /** 本while循环用来确定申请的buf的长度 */
buf = cl->buf;
total += buf->last - buf->pos;
//body.append((const char *)buf->pos, len);
cl = cl->next;
} while (cl);
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "[BODY] data length = [%zu]", total);
body.data = ngx_palloc(r->pool, sizeof(char)*(total + 1));
if( NULL == body.data ){
return body;
}
body.data[total] = 0;
do {
buf = cl->buf;
len = buf->last - buf->pos;
//body.append((const char *)buf->pos, len);
memcpy( body.data + pos, buf->pos, len);
pos += len;
//ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "[BODY] data = [%s]", len, (const char *)buf->pos);
cl = cl->next;
} while (cl);
if (r->request_body->temp_file){
/*
file_mmap fm;
auto ret = fm.get((char *)r->request_body->temp_file->file.name.data);
body.append(ret.first, ret.second.st_size);
*/
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "[BODY] temp_file = [%s]",
r->request_body->temp_file->file.name.len, (const char *)(char *)r->request_body->temp_file->file.name.data);
}
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "[%s]request body is NULL[%zu]", __FUNCTION__, body.len);
return body;
}
Such a great project, I can't seem to find any usage examples
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.