Compare commits

..
3 Commits
Author SHA1 Message Date
Unbit 41bc23bb40 backports from 1.9.19 2013-10-16 20:58:20 +02:00
Unbit 79a7797409 fixed #415 2013-10-12 08:05:56 +02:00
Unbit 3b13de3e6e check for NULL dictionary values in python autoreloader 2013-10-12 00:34:31 +02:00
6 changed files with 42 additions and 7 deletions
+2
View File
@@ -472,6 +472,7 @@ char *uwsgi_open_and_read(char *url, size_t *size, int add_zero, char *magic_tab
// stdin ?
if (!strcmp(url, "-")) {
buffer = uwsgi_read_fd(0, size, add_zero);
goto end;
}
#ifdef UWSGI_EMBED_CONFIG
else if (url[0] == 0) {
@@ -482,6 +483,7 @@ char *uwsgi_open_and_read(char *url, size_t *size, int add_zero, char *magic_tab
buffer = uwsgi_malloc(*size);
memset(buffer, 0, *size);
memcpy(buffer, &UWSGI_EMBED_CONFIG, &UWSGI_EMBED_CONFIG_END - &UWSGI_EMBED_CONFIG);
goto end;
}
#endif
+31 -2
View File
@@ -1548,7 +1548,15 @@ void parse_sys_envs(char **envs) {
char *earg, *eq_pos;
while (*uenvs) {
if (!strncmp(*uenvs, "UWSGI_", 6) && strncmp(*uenvs, "UWSGI_RELOADS=", 14) && strncmp(*uenvs, "UWSGI_ORIGINAL_PROC_NAME=", 25)) {
if (!strncmp(*uenvs, "UWSGI_", 6) &&
strncmp(*uenvs, "UWSGI_RELOADS=", 14) &&
strncmp(*uenvs, "UWSGI_VASSALS_DIR=", 18) &&
strncmp(*uenvs, "UWSGI_EMPEROR_FD=", 17) &&
strncmp(*uenvs, "UWSGI_BROODLORD_NUM=", 20) &&
strncmp(*uenvs, "UWSGI_EMPEROR_FD_CONFIG=", 24) &&
strncmp(*uenvs, "UWSGI_EMPEROR_PROXY=", 20) &&
strncmp(*uenvs, "UWSGI_JAIL_PID=", 15) &&
strncmp(*uenvs, "UWSGI_ORIGINAL_PROC_NAME=", 25)) {
earg = uwsgi_malloc(strlen(*uenvs + 6) + 1);
env_to_arg(*uenvs + 6, earg);
eq_pos = strchr(earg, '=');
@@ -3834,7 +3842,28 @@ void uwsgi_uuid(char *buf) {
uuid_generate(uuid_zmq);
uuid_unparse(uuid_zmq, buf);
#else
snprintf(buf, 37, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", rand(), rand(), rand(), rand(), rand(), rand(), rand(), rand(), rand(), rand(), rand());
int i,r[11];
static int srand_called = 0;
if (!uwsgi_file_exists("/dev/urandom")) goto fallback;
int fd = open("/dev/urandom", O_RDONLY);
if (fd < 0) goto fallback;
for(i=0;i<11;i++) {
if (read(fd, &r[i], 4) != 4) {
close(fd); goto fallback;
}
}
close(fd);
goto done;
fallback:
if (!srand_called) {
srand((unsigned int) getpid());
srand_called = 1;
}
for(i=0;i<11;i++) {
r[i] = rand();
}
done:
snprintf(buf, 37, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10]);
#endif
}
+1
View File
@@ -881,6 +881,7 @@ static struct uwsgi_option uwsgi_base_options[] = {
{"show-config", no_argument, 0, "show the current config reformatted as ini", uwsgi_opt_true, &uwsgi.show_config, 0},
{"binary-append-data", required_argument, 0, "return the content of a resource to stdout for appending to a uwsgi binary (for data:// usage)", uwsgi_opt_binary_append_data, NULL, UWSGI_OPT_IMMEDIATE},
{"print", required_argument, 0, "simple print", uwsgi_opt_print, NULL, 0},
{"iprint", required_argument, 0, "simple print (immediate version)", uwsgi_opt_print, NULL, UWSGI_OPT_IMMEDIATE},
{"exit", optional_argument, 0, "force exit() of the instance", uwsgi_opt_exit, NULL, UWSGI_OPT_IMMEDIATE},
{"cflags", no_argument, 0, "report uWSGI CFLAGS (useful for building external plugins)", uwsgi_opt_cflags, NULL, UWSGI_OPT_IMMEDIATE},
{"dot-h", no_argument, 0, "dump the uwsgi.h used for building the core (useful for building external plugins)", uwsgi_opt_dot_h, NULL, UWSGI_OPT_IMMEDIATE},
+6 -4
View File
@@ -190,21 +190,23 @@ static ssize_t fr_instance_connected(struct corerouter_peer *peer) {
// called after receaving the uwsgi header (read vars)
static ssize_t fr_recv_uwsgi_vars(struct corerouter_peer *main_peer) {
struct uwsgi_header *uh = (struct uwsgi_header *) main_peer->in->buf;
// better to store it as the original buf address could change
uint16_t pktsize = uh->pktsize;
// increase buffer if needed
if (uwsgi_buffer_fix(main_peer->in, uh->pktsize+4))
if (uwsgi_buffer_fix(main_peer->in, pktsize+4))
return -1;
ssize_t len = cr_read_exact(main_peer, uh->pktsize+4, "fr_recv_uwsgi_vars()");
ssize_t len = cr_read_exact(main_peer, pktsize+4, "fr_recv_uwsgi_vars()");
if (!len) return 0;
// headers received, ready to choose the instance
if (main_peer->in->pos == (size_t)(uh->pktsize+4)) {
if (main_peer->in->pos == (size_t)(pktsize+4)) {
struct uwsgi_corerouter *ucr = main_peer->session->corerouter;
struct corerouter_peer *new_peer = uwsgi_cr_peer_add(main_peer->session);
new_peer->last_hook_read = fr_instance_read;
// find the hostname
if (uwsgi_hooked_parse(main_peer->in->buf+4, uh->pktsize, fr_get_hostname, (void *) new_peer)) {
if (uwsgi_hooked_parse(main_peer->in->buf+4, pktsize, fr_get_hostname, (void *) new_peer)) {
return -1;
}
+1
View File
@@ -1380,6 +1380,7 @@ void *uwsgi_python_autoreloader_thread(void *foobar) {
#endif
PyObject *mod_name, *mod;
while (PyDict_Next(modules, &pos, &mod_name, &mod)) {
if (mod == NULL) continue;
int found = 0;
struct uwsgi_string_list *usl = up.auto_reload_ignore;
while(usl) {
+1 -1
View File
@@ -1,6 +1,6 @@
# uWSGI build system
uwsgi_version = '1.9.18.1'
uwsgi_version = '1.9.18.2'
import os
import re