mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-10-04 16:08:31 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7525475d8 | ||
|
|
f35a36ac02 | ||
|
|
3b53f89a24 | ||
|
|
764d94e41b | ||
|
|
0292e15497 | ||
|
|
bde4ac7b2f | ||
|
|
c71fa3abd1 |
@@ -23,3 +23,4 @@ a5f13497b39269621f8f1e56e14d2cc141452e79 0.9.7.2
|
||||
d1e57707f6317f134fea7d12f6588d8690f74f3f 0.9.8-rc1
|
||||
e91bc724325e14c13b8f548c0b6a315c48a1c32a 0.9.8-rc2
|
||||
4fb424d52f226a0a087fea89709f5eb540e03f25 0.9.8-rc3
|
||||
0f1f3924ee5309a9990d9af1ffc68846e3dfb31b 0.9.8-rc4
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
*** may 2011 ***
|
||||
|
||||
* 0.9.8-rc4 [20110602]
|
||||
|
||||
- fixed REMOTE_ADDR when --protocol=http
|
||||
- official support for OpenIndiana
|
||||
- added a welcome.py test script
|
||||
- new api attribute uwsgi.version_info
|
||||
- improved the admin plugin
|
||||
- two new management flag for backlog queue monitoring
|
||||
- fixed uwsgi_log for bigger loglines
|
||||
- new option --early-emperor to allows out-of-jail emperors
|
||||
- emperor can now spawn other emperors (sub-emperors)
|
||||
- fixed idle mode in single-process
|
||||
- fixed solaris iovec
|
||||
|
||||
* 0.9.8-rc3 [20110530]
|
||||
|
||||
- snapshotting support
|
||||
|
||||
@@ -114,7 +114,6 @@ int init_uwsgi_app(int loader, void *arg1, struct wsgi_request *wsgi_req, PyThre
|
||||
uwsgi_log("%s = %s\n", PyString_AsString(k), PyString_AsString(env_value));
|
||||
|
||||
if (PyObject_SetItem(py_environ, k, env_value)) {
|
||||
uwsgi_log("cazzo\n");
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
@@ -521,6 +520,9 @@ PyObject *uwsgi_file_loader(void *arg1) {
|
||||
PyObject *wsgi_file_module, *wsgi_file_dict;
|
||||
PyObject *wsgi_file_callable;
|
||||
|
||||
char *callable = up.callable;
|
||||
if (!callable) callable = "application";
|
||||
|
||||
wsgi_file_module = uwsgi_pyimport_by_filename("uwsgi_wsgi_file", filename);
|
||||
// no need to check here for module import as it is already done by uwsgi_pyimport_by_file
|
||||
|
||||
@@ -530,7 +532,7 @@ PyObject *uwsgi_file_loader(void *arg1) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
wsgi_file_callable = PyDict_GetItemString(wsgi_file_dict, "application");
|
||||
wsgi_file_callable = PyDict_GetItemString(wsgi_file_dict, callable);
|
||||
if (!wsgi_file_callable) {
|
||||
PyErr_Print();
|
||||
uwsgi_log( "unable to find \"application\" callable in file %s\n", filename);
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ uint16_t proto_base_add_uwsgi_header(struct wsgi_request *wsgi_req, char *key, u
|
||||
key[i] = '_';
|
||||
}
|
||||
else {
|
||||
key[i] = toupper(key[i]);
|
||||
key[i] = toupper((int)key[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ int bind_to_unix(char *socket_name, int listen_queue, int chmod_socket, int abst
|
||||
|
||||
int serverfd;
|
||||
struct sockaddr_un *uws_addr;
|
||||
socklen_t len;
|
||||
|
||||
// leave 1 byte for abstract namespace (108 linux -> 104 bsd/mac)
|
||||
if (strlen(socket_name) > 102) {
|
||||
@@ -16,6 +17,9 @@ int bind_to_unix(char *socket_name, int listen_queue, int chmod_socket, int abst
|
||||
if (socket_name[0] == '@') {
|
||||
abstract_socket = 1;
|
||||
}
|
||||
else if (strlen(socket_name) > 1 && socket_name[0] == '\\' && socket_name[1] == '0') {
|
||||
abstract_socket = 1;
|
||||
}
|
||||
|
||||
uws_addr = malloc(sizeof(struct sockaddr_un));
|
||||
if (uws_addr == NULL) {
|
||||
@@ -41,16 +45,23 @@ int bind_to_unix(char *socket_name, int listen_queue, int chmod_socket, int abst
|
||||
|
||||
uws_addr->sun_family = AF_UNIX;
|
||||
if (socket_name[0] == '@') {
|
||||
memcpy(uws_addr->sun_path + abstract_socket, socket_name+1, strlen(socket_name+1));
|
||||
memcpy(uws_addr->sun_path + abstract_socket, socket_name+1, UMIN(strlen(socket_name+1), 101));
|
||||
len = strlen(socket_name) + 1;
|
||||
}
|
||||
else if (strlen(socket_name) > 1 && socket_name[0] == '\\' && socket_name[1] == '0') {
|
||||
memcpy(uws_addr->sun_path + abstract_socket, socket_name+2, UMIN(strlen(socket_name+2), 101));
|
||||
len = strlen(socket_name+1) + 1;
|
||||
|
||||
}
|
||||
else {
|
||||
memcpy(uws_addr->sun_path + abstract_socket, socket_name, strlen(socket_name));
|
||||
memcpy(uws_addr->sun_path + abstract_socket, socket_name, UMIN(strlen(socket_name), 102));
|
||||
len = strlen(socket_name);
|
||||
}
|
||||
|
||||
#ifdef __HAIKU__
|
||||
if (bind(serverfd, (struct sockaddr *) uws_addr, sizeof(struct sockaddr_un))) {
|
||||
#else
|
||||
if (bind(serverfd, (struct sockaddr *) uws_addr, strlen(socket_name) + abstract_socket + ((void *) uws_addr->sun_path - (void *) uws_addr)) != 0) {
|
||||
if (bind(serverfd, (struct sockaddr *) uws_addr, len + ((void *) uws_addr->sun_path - (void *) uws_addr)) != 0) {
|
||||
#endif
|
||||
uwsgi_error("bind()");
|
||||
uwsgi_nuclear_blast();
|
||||
@@ -265,11 +276,17 @@ int connect_to_unix(char *socket_name, int timeout, int async) {
|
||||
memset(&uws_addr, 0, sizeof(struct sockaddr_un));
|
||||
|
||||
uws_addr.sun_family = AF_UNIX;
|
||||
memcpy(uws_addr.sun_path, socket_name, 102);
|
||||
|
||||
if (socket_name[0] == '@'){
|
||||
un_size = sizeof(uws_addr.sun_family) + strlen(socket_name);
|
||||
uws_addr.sun_path[0] = 0;
|
||||
un_size = sizeof(uws_addr.sun_family) + strlen(socket_name) + 1;
|
||||
memcpy(uws_addr.sun_path+1, socket_name+1, UMIN(strlen(socket_name+1), 101));
|
||||
}
|
||||
else if (strlen(socket_name) > 1 && socket_name[0] == '\\' && socket_name[1] == '0') {
|
||||
un_size = sizeof(uws_addr.sun_family) + strlen(socket_name+1) + 1;
|
||||
memcpy(uws_addr.sun_path+1, socket_name+2, UMIN(strlen(socket_name+2), 101));
|
||||
}
|
||||
else {
|
||||
memcpy(uws_addr.sun_path, socket_name, UMIN(strlen(socket_name), 102));
|
||||
}
|
||||
|
||||
uwsgi_poll.fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
@@ -420,10 +437,15 @@ socklen_t socket_to_un_addr(char *socket_name, struct sockaddr_un *sun_addr) {
|
||||
|
||||
// abstract socket
|
||||
if (socket_name[0] == '@') {
|
||||
memcpy(sun_addr->sun_path+1, socket_name+1, len-1);
|
||||
memcpy(sun_addr->sun_path+1, socket_name+1, UMIN(len-1, 101));
|
||||
len = strlen(socket_name) + 1;
|
||||
}
|
||||
else if (len > 1 && socket_name[0] == '\\' && socket_name[1] == '0') {
|
||||
memcpy(sun_addr->sun_path+1, socket_name+2, UMIN(len-2, 101));
|
||||
len = strlen(socket_name+1) + 1;
|
||||
}
|
||||
else {
|
||||
memcpy(sun_addr->sun_path, socket_name, len);
|
||||
memcpy(sun_addr->sun_path, socket_name, UMIN(len, 102));
|
||||
}
|
||||
|
||||
return sizeof(sun_addr->sun_family)+len;
|
||||
|
||||
@@ -408,6 +408,14 @@ void goodbye_cruel_world() {
|
||||
void kill_them_all(int signum) {
|
||||
int i;
|
||||
uwsgi.to_hell = 1;
|
||||
|
||||
if (uwsgi.reload_mercy > 0) {
|
||||
uwsgi.master_mercy = time(NULL) + uwsgi.reload_mercy;
|
||||
}
|
||||
else {
|
||||
uwsgi.master_mercy = time(NULL) + 5;
|
||||
}
|
||||
|
||||
uwsgi_log("SIGINT/SIGQUIT received...killing workers...\n");
|
||||
for (i = 1; i <= uwsgi.numproc; i++) {
|
||||
if (uwsgi.workers[i].pid > 0)
|
||||
@@ -3788,7 +3796,8 @@ void uwsgi_init_all_apps() {
|
||||
}
|
||||
|
||||
// no app initialized and virtualhosting enabled
|
||||
if (uwsgi.apps_cnt == 0 && uwsgi.vhost) {
|
||||
if (uwsgi.apps_cnt == 0) {
|
||||
uwsgi_log("*** no app loaded. going in full dynamic mode ***\n");
|
||||
uwsgi.apps_cnt = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -671,8 +671,10 @@ struct wsgi_request {
|
||||
struct msghdr msg;
|
||||
union {
|
||||
struct cmsghdr cmsg;
|
||||
#ifndef __NetBSD__
|
||||
char control [CMSG_SPACE (sizeof (int))];
|
||||
} msg_control;
|
||||
#endif
|
||||
} msg_control;
|
||||
|
||||
struct timeval start_of_request;
|
||||
struct timeval end_of_request;
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
# uWSGI build system
|
||||
|
||||
uwsgi_version = '0.9.8-dev'
|
||||
uwsgi_version = '0.9.8'
|
||||
|
||||
import os
|
||||
import re
|
||||
@@ -248,6 +248,7 @@ class uConf(object):
|
||||
if uwsgi_os == 'SunOS':
|
||||
self.libs.append('-lsendfile')
|
||||
self.gcc_list.append('lib/sun_fixes')
|
||||
self.ldflags.append('-L/lib')
|
||||
if not uwsgi_os_v.startswith('Nexenta'):
|
||||
self.libs.remove('-rdynamic')
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
from flask import Flask
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def hello():
|
||||
return "Hello World!"
|
||||
@@ -0,0 +1,6 @@
|
||||
from flask import Flask
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def hello():
|
||||
return "Hello World! app2 !!!"
|
||||
@@ -0,0 +1,6 @@
|
||||
from flask import Flask
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def hello():
|
||||
return "Hello World! app3"
|
||||
@@ -0,0 +1,6 @@
|
||||
from flask import Flask
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def hello():
|
||||
return "Hello World! app4"
|
||||
@@ -0,0 +1,6 @@
|
||||
from flask import Flask
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def hello():
|
||||
return "Hello World! app5"
|
||||
@@ -0,0 +1,49 @@
|
||||
|
||||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
sendfile on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
gzip on;
|
||||
|
||||
upstream uwsgi_server {
|
||||
server 127.0.0.1:3031;
|
||||
}
|
||||
|
||||
include uwsgi_params;
|
||||
uwsgi_param UWSGI_FILE $app;
|
||||
uwsgi_param UWSGI_PYHOME $virtualenv;
|
||||
|
||||
|
||||
server {
|
||||
listen 8026;
|
||||
server_name flask001;
|
||||
set $app vhosttest/flask001/app1.py;
|
||||
set $virtualenv vhosttest/venv001;
|
||||
location / {
|
||||
uwsgi_pass uwsgi_server;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8026;
|
||||
server_name flask002;
|
||||
set $app vhosttest/flask002/app2.py;
|
||||
set $virtualenv vhosttest/venv001;
|
||||
location / {
|
||||
uwsgi_pass uwsgi_server;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -25,6 +25,8 @@ def application(env, start_response):
|
||||
if routes.has_key(env['PATH_INFO']):
|
||||
return routes[env['PATH_INFO']](env, start_response)
|
||||
|
||||
start_response('200 OK', [('Content-Type', 'text/html')])
|
||||
|
||||
return """
|
||||
<img src="/logo"/> version %s<br/>
|
||||
<hr size="1"/>
|
||||
|
||||
Reference in New Issue
Block a user