mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-10-05 00:18:36 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7d3a27225 | ||
|
|
4f50b4aafc | ||
|
|
d172fb4909 | ||
|
|
c842bb4917 | ||
|
|
d6da6848be | ||
|
|
b1caf56f49 |
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env ruby
|
||||
cmd = File.expand_path "#{File.dirname(__FILE__)}/../ext/uwsgi/uwsgi.ruby"
|
||||
|
||||
exec(cmd, *ARGV)
|
||||
+6
-1
@@ -41,6 +41,10 @@ struct uwsgi_gateway *register_gateway(char *name, void (*loop) (int, void *), v
|
||||
return ug;
|
||||
}
|
||||
|
||||
static void gateway_brutal_end() {
|
||||
_exit(UWSGI_END_CODE);
|
||||
}
|
||||
|
||||
void gateway_respawn(int id) {
|
||||
|
||||
pid_t gw_pid;
|
||||
@@ -65,6 +69,7 @@ void gateway_respawn(int id) {
|
||||
}
|
||||
#endif
|
||||
uwsgi.mypid = getpid();
|
||||
atexit(gateway_brutal_end);
|
||||
signal(SIGALRM, SIG_IGN);
|
||||
signal(SIGHUP, SIG_IGN);
|
||||
signal(SIGINT, end_me);
|
||||
@@ -77,7 +82,7 @@ void gateway_respawn(int id) {
|
||||
|
||||
ug->loop(id, ug->data);
|
||||
// never here !!! (i hope)
|
||||
exit(1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
ug->pid = gw_pid;
|
||||
|
||||
@@ -38,6 +38,8 @@ static struct uwsgi_option uwsgi_base_options[] = {
|
||||
{"socket", required_argument, 's', "bind to the specified UNIX/TCP socket using default protocol", uwsgi_opt_add_socket, NULL, 0},
|
||||
{"uwsgi-socket", required_argument, 's', "bind to the specified UNIX/TCP socket using uwsgi protocol", uwsgi_opt_add_socket, "uwsgi", 0},
|
||||
{"http-socket", required_argument, 0, "bind to the specified UNIX/TCP socket using HTTP protocol", uwsgi_opt_add_socket, "http", 0},
|
||||
{"http-socket-modifier1", required_argument, 0, "force the specified modifier1 when using HTTP protocol", uwsgi_opt_set_64bit, &uwsgi.http_modifier1, 0},
|
||||
{"http-socket-modifier2", required_argument, 0, "force the specified modifier2 when using HTTP protocol", uwsgi_opt_set_64bit, &uwsgi.http_modifier2, 0},
|
||||
{"fastcgi-socket", required_argument, 0, "bind to the specified UNIX/TCP socket using FastCGI protocol", uwsgi_opt_add_socket, "fastcgi", 0},
|
||||
{"protocol", required_argument, 0, "force the specified protocol for default sockets", uwsgi_opt_set_str, &uwsgi.protocol, 0},
|
||||
{"socket-protocol", required_argument, 0, "force the specified protocol for default sockets", uwsgi_opt_set_str, &uwsgi.protocol, 0},
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
require 'net/http'
|
||||
|
||||
Net::HTTP.start("uwsgi.it") do |http|
|
||||
resp = http.get("/install")
|
||||
open("install.sh", "wb") do |file|
|
||||
file.write(resp.body)
|
||||
end
|
||||
end
|
||||
|
||||
system("bash install.sh rack #{Dir.pwd}/uwsgi.ruby")
|
||||
|
||||
open("Makefile", "w") do |file|
|
||||
file.write("all:\n")
|
||||
file.write("\t\n")
|
||||
end
|
||||
@@ -834,23 +834,7 @@ void uwsgi_corerouter_loop(int id, void *data) {
|
||||
}
|
||||
|
||||
// not having a hook could mean a previous event in the loop cleared it...
|
||||
if (!hook) {
|
||||
// a single event cannot be unexpected..
|
||||
if (nevents == 1) {
|
||||
if (interesting_fd == cr_session->instance_fd) {
|
||||
uwsgi_log("[uwsgi-corerouter] BUG, unexpected event received from backend instance (fd: %d nevents: %d) !!!\n", interesting_fd, nevents);
|
||||
}
|
||||
else if (interesting_fd == cr_session->fd) {
|
||||
uwsgi_log("[uwsgi-corerouter] BUG, unexpected event received from client (fd: %d nevents: %d)!!!\n", interesting_fd, nevents);
|
||||
}
|
||||
else {
|
||||
uwsgi_log("[uwsgi-corerouter] BUG, unexpected event received !!!\n");
|
||||
}
|
||||
corerouter_close_session(ucr, cr_session);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!hook) continue;
|
||||
// reset errno (as we use it for internal signalling)
|
||||
errno = 0;
|
||||
ssize_t ret = hook(cr_session);
|
||||
|
||||
@@ -230,7 +230,7 @@ ssize_t uwsgi_gevent_hook_input_read(struct wsgi_request *wsgi_req, char *tmp_bu
|
||||
}
|
||||
Py_DECREF(ret);
|
||||
|
||||
ret = PyObject_CallMethod(timer, "start", "OO", current, timer);
|
||||
ret = PyObject_CallMethod(timer, "again", "OO", current, timer);
|
||||
if (!ret) {
|
||||
stop_the_watchers_and_clear
|
||||
return -1;
|
||||
@@ -298,7 +298,7 @@ ssize_t uwsgi_gevent_hook_input_readline(struct wsgi_request *wsgi_req, char *re
|
||||
}
|
||||
Py_DECREF(ret);
|
||||
|
||||
ret = PyObject_CallMethod(timer, "start", "OO", current, timer);
|
||||
ret = PyObject_CallMethod(timer, "again", "OO", current, timer);
|
||||
if (!ret) {
|
||||
stop_the_watchers_and_clear
|
||||
return -1;
|
||||
@@ -364,7 +364,7 @@ void uwsgi_gevent_nb_write(struct wsgi_request *wsgi_req, PyObject *str) {
|
||||
}
|
||||
Py_DECREF(ret);
|
||||
|
||||
ret = PyObject_CallMethod(timer, "start", "OO", current, timer);
|
||||
ret = PyObject_CallMethod(timer, "again", "OO", current, timer);
|
||||
if (!ret) {
|
||||
stop_the_watchers_and_clear
|
||||
goto error;
|
||||
@@ -431,7 +431,7 @@ PyObject *uwsgi_gevent_wait(PyObject *watcher, PyObject *timer, PyObject *curren
|
||||
Py_DECREF(ret);
|
||||
|
||||
// start the timeout handler
|
||||
ret = PyObject_CallMethod(timer, "start", "OO", current, timer);
|
||||
ret = PyObject_CallMethod(timer, "again", "OO", current, timer);
|
||||
if (!ret) return NULL;
|
||||
Py_DECREF(ret);
|
||||
|
||||
|
||||
+8
-8
@@ -551,8 +551,8 @@ ssize_t hr_read_ssl_body(struct corerouter_session * cs) {
|
||||
if (err == SSL_ERROR_WANT_READ) {
|
||||
if (cs->event_hook_write) {
|
||||
uwsgi_cr_hook_write(cs, NULL);
|
||||
uwsgi_cr_hook_read(cs, hr_read_ssl_body);
|
||||
}
|
||||
uwsgi_cr_hook_read(cs, hr_read_ssl_body);
|
||||
errno = EINPROGRESS;
|
||||
return -1;
|
||||
}
|
||||
@@ -560,8 +560,8 @@ ssize_t hr_read_ssl_body(struct corerouter_session * cs) {
|
||||
else if (err == SSL_ERROR_WANT_WRITE) {
|
||||
if (cs->event_hook_read) {
|
||||
uwsgi_cr_hook_read(cs, NULL);
|
||||
uwsgi_cr_hook_write(cs, hr_read_ssl_body);
|
||||
}
|
||||
uwsgi_cr_hook_write(cs, hr_read_ssl_body);
|
||||
errno = EINPROGRESS;
|
||||
return -1;
|
||||
}
|
||||
@@ -625,16 +625,16 @@ ssize_t hr_write_ssl_response(struct corerouter_session * cs) {
|
||||
if (err == SSL_ERROR_WANT_READ) {
|
||||
if (cs->event_hook_write) {
|
||||
uwsgi_cr_hook_write(cs, NULL);
|
||||
uwsgi_cr_hook_read(cs, hr_write_ssl_response);
|
||||
}
|
||||
uwsgi_cr_hook_read(cs, hr_write_ssl_response);
|
||||
errno = EINPROGRESS;
|
||||
return -1;
|
||||
}
|
||||
else if (err == SSL_ERROR_WANT_WRITE) {
|
||||
if (cs->event_hook_read) {
|
||||
uwsgi_cr_hook_read(cs, NULL);
|
||||
uwsgi_cr_hook_write(cs, hr_write_ssl_response);
|
||||
}
|
||||
uwsgi_cr_hook_write(cs, hr_write_ssl_response);
|
||||
errno = EINPROGRESS;
|
||||
return -1;
|
||||
}
|
||||
@@ -839,16 +839,16 @@ ssize_t hr_send_expect_continue(struct corerouter_session * cs) {
|
||||
if (err == SSL_ERROR_WANT_READ) {
|
||||
if (cs->event_hook_write) {
|
||||
uwsgi_cr_hook_write(cs, NULL);
|
||||
uwsgi_cr_hook_read(cs, hr_write_ssl_response);
|
||||
}
|
||||
uwsgi_cr_hook_read(cs, hr_write_ssl_response);
|
||||
errno = EINPROGRESS;
|
||||
return -1;
|
||||
}
|
||||
else if (err == SSL_ERROR_WANT_WRITE) {
|
||||
if (cs->event_hook_read) {
|
||||
uwsgi_cr_hook_read(cs, NULL);
|
||||
uwsgi_cr_hook_write(cs, hr_write_ssl_response);
|
||||
}
|
||||
uwsgi_cr_hook_write(cs, hr_write_ssl_response);
|
||||
errno = EINPROGRESS;
|
||||
return -1;
|
||||
}
|
||||
@@ -949,8 +949,8 @@ ssize_t hr_recv_http_ssl(struct corerouter_session * cs) {
|
||||
if (err == SSL_ERROR_WANT_READ) {
|
||||
if (cs->event_hook_write) {
|
||||
uwsgi_cr_hook_write(cs, NULL);
|
||||
uwsgi_cr_hook_read(cs, hr_recv_http_ssl);
|
||||
}
|
||||
uwsgi_cr_hook_read(cs, hr_recv_http_ssl);
|
||||
errno = EINPROGRESS;
|
||||
return -1;
|
||||
}
|
||||
@@ -958,8 +958,8 @@ ssize_t hr_recv_http_ssl(struct corerouter_session * cs) {
|
||||
else if (err == SSL_ERROR_WANT_WRITE) {
|
||||
if (cs->event_hook_read) {
|
||||
uwsgi_cr_hook_read(cs, NULL);
|
||||
uwsgi_cr_hook_write(cs, hr_recv_http_ssl);
|
||||
}
|
||||
uwsgi_cr_hook_write(cs, hr_recv_http_ssl);
|
||||
errno = EINPROGRESS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -34,10 +34,18 @@ else:
|
||||
CFLAGS.append('-I' + archdir + '/' + arch)
|
||||
CFLAGS.append('-I' + includedir + '/' + arch)
|
||||
|
||||
|
||||
LDFLAGS = os.popen(RUBYPATH + " -e \"require 'rbconfig';print %s::CONFIG['LDFLAGS']\"" % rbconfig).read().rstrip().split()
|
||||
|
||||
libpath = os.popen(RUBYPATH + " -e \"require 'rbconfig';print %s::CONFIG['libdir']\"" % rbconfig).read().rstrip()
|
||||
LDFLAGS.append('-L' + libpath )
|
||||
os.environ['LD_RUN_PATH'] = libpath
|
||||
LIBS = os.popen(RUBYPATH + " -e \"require 'rbconfig';print '-l' + %s::CONFIG['RUBY_SO_NAME']\"" % rbconfig).read().rstrip().split()
|
||||
|
||||
has_shared = os.popen(RUBYPATH + " -e \"require 'rbconfig';print %s::CONFIG['ENABLE_SHARED']\"" % rbconfig).read().rstrip()
|
||||
|
||||
LIBS = os.popen(RUBYPATH + " -e \"require 'rbconfig';print %s::CONFIG['LIBS']\"" % rbconfig).read().rstrip().split()
|
||||
|
||||
if has_shared == 'yes':
|
||||
LDFLAGS.append('-L' + libpath )
|
||||
os.environ['LD_RUN_PATH'] = libpath
|
||||
LIBS.append(os.popen(RUBYPATH + " -e \"require 'rbconfig';print '-l' + %s::CONFIG['RUBY_SO_NAME']\"" % rbconfig).read().rstrip())
|
||||
else:
|
||||
GCC_LIST.append("%s/%s" % (libpath, os.popen(RUBYPATH + " -e \"require 'rbconfig';print %s::CONFIG['LIBRUBY_A']\"" % rbconfig).read().rstrip()))
|
||||
|
||||
|
||||
@@ -338,6 +338,8 @@ int uwsgi_proto_http_parser(struct wsgi_request *wsgi_req) {
|
||||
memcpy(post_tail, ptr, remains);
|
||||
}
|
||||
http_parse(wsgi_req, ptr);
|
||||
wsgi_req->uh.modifier1 = uwsgi.http_modifier1;
|
||||
wsgi_req->uh.modifier2 = uwsgi.http_modifier2;
|
||||
//is there a Content_Length ?
|
||||
if (wsgi_req->post_cl > 0) {
|
||||
wsgi_req->async_post = tmpfile();
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
Gem::Specification.new do |s|
|
||||
s.name = 'uwsgi'
|
||||
s.license = 'GPL-2'
|
||||
s.version = `python -c "import uwsgiconfig as uc; print uc.uwsgi_version"`.sub(/-dev-.*/,'')
|
||||
s.date = '2013-03-02'
|
||||
s.summary = "uWSGI"
|
||||
s.description = "The uWSGI server for Ruby/Rack"
|
||||
s.authors = ["Unbit"]
|
||||
s.email = 'info@unbit.it'
|
||||
s.extensions = ['ext/uwsgi/extconf.rb']
|
||||
s.files = []
|
||||
s.require_paths = ['.']
|
||||
s.executables << 'uwsgi'
|
||||
s.homepage = 'http://projects.unbit.it/uwsgi'
|
||||
end
|
||||
@@ -1309,6 +1309,9 @@ struct uwsgi_server {
|
||||
|
||||
int reuse_port;
|
||||
|
||||
uint64_t http_modifier1;
|
||||
uint64_t http_modifier2;
|
||||
|
||||
// enable lazy mode
|
||||
int lazy;
|
||||
// enable lazy-apps mode
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# uWSGI build system
|
||||
|
||||
uwsgi_version = '1.4.7'
|
||||
uwsgi_version = '1.4.8'
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
Reference in New Issue
Block a user