GithubHelp home page GithubHelp logo

webcpp / hi-nginx Goto Github PK

View Code? Open in Web Editor NEW
376.0 376.0 72.0 97.58 MB

A fast and robust web server and application server for C++,Python,Lua ,Java language

License: BSD 2-Clause "Simplified" License

Perl 0.06% HTML 0.01% Shell 0.03% C 53.81% C++ 44.87% XS 0.22% Lua 0.01% Python 0.01% Vim Script 0.99% Makefile 0.01%
application-server cpp groovy hi-nginx http java javascript jsr-223 jvm-languages lua nginx php php7 python server web web-server

hi-nginx's People

Contributors

webcpp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hi-nginx's Issues

ubuntu 18 gcc 7 编译错误

启用php支持:
./configure --prefix=/opt/hi
--enable-http-hi-cpp=YES
--enable-http-hi-python=NO
--enable-http-hi-lua=NO
--enable-http-hi-java=NO
--enable-http-hi-php=YES
--add-module=ngx_http_hi_module
--with-threads --with-file-aio

objs/ngx_modules.o
-lhiredis -lphp7 -ldl -lpthread -lcrypt -lstdc++ -lpcre -lssl -lcrypto -ldl -lpthread -lz
-Wl,-E
objs/addon/php-x/variant.o: In function php::Variant::jsonEncode(long, long)': variant.cc:(.text+0x4ac): undefined reference to json_globals'
variant.cc:(.text+0x4ba): undefined reference to json_globals' variant.cc:(.text+0x4ca): undefined reference to php_json_encode'
variant.cc:(.text+0x4d0): undefined reference to json_globals' objs/addon/php-x/variant.o: In function php::Variant::jsonDecode(long, long)':
variant.cc:(.text+0x5a8): undefined reference to json_globals' variant.cc:(.text+0x632): undefined reference to php_json_decode_ex'
variant.cc:(.text+0x6b2): undefined reference to `json_globals'
collect2: error: ld returned 1 exit status
objs/Makefile:346: recipe for target 'objs/nginx' failed
make[1]: *** [objs/nginx] Error 1
make[1]: Leaving directory '/opt/hi-nginx'
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2

另外还想请教下,最近出了个nginx unit,和你的hi-nginx异同,谢谢

Question: Does the cpp lib runs as a different process.

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.

cpp的例子

您好, 能否提供一个cpp的demo例子?感谢!

小白问题

小白问题:

  1. 如何部署到公网并绑定域名?
  2. 如何支持HTTS访问;
  3. 希望给出一个上传&下载文件的例子(C++);

修改后的get_input_body不能正确获取到post上传的文本信息

你好,尝试将部分代码修改为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;

}

使用CPP模块时,如何调试比较方便

请问作者平常使用hi-nginx编写cpp模块时,有什么方便点的调试方法(不调试nginx,调试so)?也是直接attach上吗?另外,如果要调试其它如PHP或js等脚本语言写的模块呢?有什么好的调试方法?

sudo make install error

cp -R /include '/usr/local/nginx/'
cp: 无法获取'/include' 的文件状态(stat): 没有那个文件或目录
objs/Makefile:1170: recipe for target 'install' failed

  1. cp -R /include /usr/local/nginx/ 是否应该为:cp -R include /usr/local/nginx/
  2. 如果1成立,hi-nginx 目录下并没有include目录

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.