Skip to content

Commit

Permalink
Merge branch 'release/v1.7.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
zedshaw committed Jun 10, 2011
2 parents 429019d + 86bc940 commit d9aa68d
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 46 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -32,9 +32,9 @@ Features
Download
--------

Mongrel2 is now 1.7 as of *Mon Jun 6 11:15:26 PDT 2011*:
Mongrel2 is now 1.7.2 as of *Fri Jun 10 08:35:51 PDT 2011*:

* [mongrel2-1.7.tar.bz2](http://mongrel2.org/static/downloads/mongrel2-1.7.tar.bz2) MD5: 3f7ec3fa4cf10d71e6a1ef34b60a8106
* [mongrel2-1.7.2.tar.bz2](http://mongrel2.org/static/downloads/mongrel2-1.7.2.tar.bz2) MD5:

Documentation
-------------
Expand Down
8 changes: 2 additions & 6 deletions docs/manual/hacking.tex
Expand Up @@ -678,18 +678,14 @@ \section{Config From Anything: Experimental}
inputs to the configuration system. Here's the code to the module:

\begin{code}{The null Config Module}
\begin{lstlisting}
<< d['tools/config_modules/null.c'] >>
\end{lstlisting}
<< d['tools/config_modules/null.c|pyg|l'] >>
\end{code}

You can then get Mongrel2 to load this module directly by passing it as a
fourth parameter to the \file{mongrel2} executable:

\begin{code}{Loading The null Config}
\begin{lstlisting}
<< d['docs/manual/inputs/null_config_run.sh'] >>
\end{lstlisting}
<< d['docs/manual/inputs/null_config_run.sh|pyg|l'] >>
\end{code}

In this run, Mongrel2 detected that you gave it a fourth option and
Expand Down
4 changes: 2 additions & 2 deletions docs/wiki/mongrel2.wiki
Expand Up @@ -28,10 +28,10 @@ technologies. <img src="http://mongrel2.org/static/logo.png" align="right"></p>

<h2><a name="download">Download</a></h2>

<p>Mongrel2 is now 1.7 as of Mon Jun 6 11:15:26 PDT 2011</p>
<p>Mongrel2 is now 1.7.2 as of Fri Jun 10 08:36:14 PDT 2011</p>

<ul>
<li><a href="/static/downloads/mongrel2-1.7.tar.bz2">mongrel2-1.7.tar.bz2</a></li>
<li><a href="/static/downloads/mongrel2-1.7.2.tar.bz2">mongrel2-1.7.2.tar.bz2</a></li>
</ul>


Expand Down
2 changes: 1 addition & 1 deletion examples/python/mongrel2/config/commands.py
Expand Up @@ -502,7 +502,7 @@ def version_command():
Prints out the version of your mongrel2 binary."
"""

print "Mongrel2/1.7"
print "Mongrel2/1.7.2"



Expand Down
2 changes: 1 addition & 1 deletion examples/python/setup.py
Expand Up @@ -10,7 +10,7 @@
'url': 'http://pypi.python.org/pypi/mongrel2-python',
'download_url': 'http://pypi.python.org/pypi/mongrel2-python',
'author_email': 'zedshaw@zedshaw.com',
'version': '1.6',
'version': '1.7.2',
'install_requires': ['nose', 'simplejson', 'pyrepl', 'storm'],
'packages': ['mongrel2', 'mongrel2.config'],
'package_data': {'mongrel2': ['sql/config.sql']},
Expand Down
10 changes: 6 additions & 4 deletions src/adt/darray.c
Expand Up @@ -7,12 +7,13 @@ darray_t *darray_create(size_t element_size, size_t initial_max)
{
darray_t *array = h_malloc(sizeof(darray_t));
check_mem(array);
array->max = initial_max;
check(array->max > 0, "You must set an initial_max > 0.");

array->contents = h_calloc(sizeof(void *), initial_max);
check_mem(array->contents);
hattach(array->contents, array);

array->max = initial_max;
array->end = 0;
array->element_size = element_size;
array->expand_rate = DEFAULT_EXPAND_RATE;
Expand All @@ -39,6 +40,7 @@ void darray_clear(darray_t *array)
static inline int darray_resize(darray_t *array, size_t newsize)
{
array->max = newsize;
check(array->max > 0, "The newsize must be > 0.");
array->contents = h_realloc(array->contents, array->max * sizeof(void *));
check_mem(array->contents);
return 0;
Expand All @@ -51,7 +53,7 @@ int darray_expand(darray_t *array)
size_t old_max = array->max;
check(darray_resize(array, array->max + array->expand_rate) == 0,
"Failed to expand array to new size: %d",
(int)array->max + (int)array->expand_rate);
array->max + (int)array->expand_rate);

memset(array->contents + old_max, 0, array->expand_rate + 1);
return 0;
Expand All @@ -62,7 +64,7 @@ int darray_expand(darray_t *array)

int darray_contract(darray_t *array)
{
int new_size = array->end < array->expand_rate ? array->expand_rate : array->end;
int new_size = array->end < (int)array->expand_rate ? (int)array->expand_rate : array->end;

return darray_resize(array, new_size + 1);
}
Expand Down Expand Up @@ -93,7 +95,7 @@ void *darray_pop(darray_t *array)
void *el = darray_remove(array, array->end - 1);
array->end--;

if(darray_end(array) > array->expand_rate && darray_end(array) % array->expand_rate) {
if(darray_end(array) > (int)array->expand_rate && darray_end(array) % array->expand_rate) {
darray_contract(array);
}

Expand Down
2 changes: 1 addition & 1 deletion src/adt/darray.h
Expand Up @@ -6,7 +6,7 @@

typedef struct darray_t {
int end;
size_t max;
int max;
size_t element_size;
size_t expand_rate;
void **contents;
Expand Down
6 changes: 3 additions & 3 deletions src/adt/tst.c
Expand Up @@ -64,7 +64,7 @@ list_t *tst_collect(tst_t *root, const char *s, size_t len, tst_collect_test_cb
tst_collect_t results = {.values = NULL, .tester = tester, .key = s, .len = len};
tst_t *p = root;
tst_t *last = p;
int i = 0;
size_t i = 0;
results.values = list_create(LISTCOUNT_T_MAX);

// first we get to where we match the prefix
Expand Down Expand Up @@ -127,7 +127,7 @@ void *tst_search_prefix(tst_t *root, const char *s, size_t len)

tst_t *p = root;
tst_t *last = NULL;
int i = 0;
size_t i = 0;

while(i < len && p) {
if (s[i] < p->splitchar) {
Expand Down Expand Up @@ -156,7 +156,7 @@ void *tst_search_prefix(tst_t *root, const char *s, size_t len)
void *tst_search(tst_t *root, const char *s, size_t len)
{
tst_t *p = root;
int i = 0;
size_t i = 0;

while(i < len && p) {

Expand Down
7 changes: 6 additions & 1 deletion src/bsd_specific.c
Expand Up @@ -81,9 +81,14 @@ extern int fdsend(int fd, void *buf, int n);

int bsd_sendfile(int out_fd, int in_fd, off_t *offset, size_t count) {
char buf[BSD_SENDFILE_BUF_SIZE];
int tot, cur, rem, sent;
int ret = -1;
off_t orig_offset = 0;
int cur = 0;
int rem = count;
int sent = 0;
size_t tot = 0;

check(rem > 0, "Possible integer overflow in count.");

if (offset != NULL) {
orig_offset = lseek(in_fd, 0, SEEK_CUR);
Expand Down
4 changes: 2 additions & 2 deletions src/dir.c
Expand Up @@ -53,7 +53,7 @@ struct tagbstring ETAG_PATTERN = bsStatic("[a-e0-9]+-[a-e0-9]+");
const char *RESPONSE_FORMAT = "HTTP/1.1 200 OK\r\n"
"Date: %s\r\n"
"Content-Type: %s\r\n"
"Content-Length: %zd\r\n"
"Content-Length: %llu\r\n"
"Last-Modified: %s\r\n"
"ETag: %s\r\n"
"Server: " VERSION
Expand Down Expand Up @@ -482,7 +482,7 @@ int Dir_serve_file(Dir *dir, Request *req, Connection *conn)
} else if(is_get) {
rc = Dir_stream_file(file, conn);
req->response_size = rc;
check_debug(rc == file->file_size, "Didn't send all of the file, sent %ll of %s.", rc, bdata(path));
check_debug(rc == file->file_size, "Didn't send all of the file, sent %lld of %s.", rc, bdata(path));
} else if(is_head) {
rc = Dir_send_header(file, conn);
check_debug(rc, "Failed to write header to socket.");
Expand Down
6 changes: 1 addition & 5 deletions src/handler.c
Expand Up @@ -186,10 +186,6 @@ static inline int handler_recv_parse(Handler *handler, HandlerParser *parser)
check(parser->target_count > 0, "Message sent had 0 targets: %.*s",
(int)zmq_msg_size(inmsg), (char *)zmq_msg_data(inmsg));

debug("Parsed message with %d targets, first: %d, uuid: %s, and body: %d",
(int)parser->target_count, parser->targets[0],
bdata(parser->uuid), blength(parser->body));

zmq_msg_close(inmsg);
free(inmsg);
return 0;
Expand Down Expand Up @@ -330,7 +326,7 @@ const int DEFAULT_HANDLER_STACK = 100 * 1024;
Handler *Handler_create(bstring send_spec, bstring send_ident,
bstring recv_spec, bstring recv_ident)
{
debug("Creating handler %s:%s", send_spec, send_ident);
debug("Creating handler %s:%s", bdata(send_spec), bdata(send_ident));

if(!HANDLER_STACK) {
HANDLER_STACK = Setting_get_int("limits.handler_stack", DEFAULT_HANDLER_STACK);
Expand Down
2 changes: 1 addition & 1 deletion src/io.c
Expand Up @@ -152,7 +152,7 @@ static ssize_t ssl_stream_file(IOBuf *iob, int fd, off_t len)
while(sent < tosend) {
amt = ssl_send(iob, buff, tosend);
check_debug(amt > 0, "ssl_send failed in ssl_stream_file with "
"return code %d", amt);
"return code %zd", amt);
sent += amt;
}

Expand Down
2 changes: 1 addition & 1 deletion src/proxy.c
Expand Up @@ -107,7 +107,7 @@ int Proxy_read_and_parse(Connection *conn)
}

check(tries < PROXY_READ_RETRIES, "Backend proxy sends too many small packets, tried %d times to read from it.", tries);
check(conn->client->body_start <= avail, "Read too much.");
check((int)conn->client->body_start <= avail, "Read too much.");


return nparsed;
Expand Down
2 changes: 1 addition & 1 deletion src/superpoll.c
Expand Up @@ -477,7 +477,7 @@ static inline int SuperPoll_add_idle_hits(SuperPoll *sp, PollResult *result)
node = list_delete(sp->idle_active, node);
list_append(sp->idle_free, node);

assert(list_count(sp->idle_active) + list_count(sp->idle_free) == sp->max_idle && "We lost one somewhere.");
assert(list_count(sp->idle_active) + list_count(sp->idle_free) == (int)sp->max_idle && "We lost one somewhere.");
}

result->idle_fds = nfds;
Expand Down
7 changes: 3 additions & 4 deletions src/task/fd.c
Expand Up @@ -77,7 +77,7 @@ static inline void wake_sleepers()
}
}

static inline void fdtask_shutdown(int signal)
static inline void fdtask_shutdown()
{
int i = 0;

Expand All @@ -93,8 +93,7 @@ static inline void fdtask_shutdown(int signal)
}
}

void
fdtask(void *v)
void fdtask(void *v)
{
int i, ms;
PollResult result;
Expand All @@ -119,7 +118,7 @@ fdtask(void *v)
ms = next_task_sleeptime(500);

if(task_was_signaled()) {
fdtask_shutdown(task_was_signaled());
fdtask_shutdown();
task_clear_signal();
break;
} else {
Expand Down
8 changes: 2 additions & 6 deletions src/task/net.c
Expand Up @@ -116,7 +116,6 @@ static int cb_connect(int fd, int istcp, struct sockaddr *psa, socklen_t sn)

/* Get a bound or connected socket */
static int netgetsocket(int istcp, char *server, int port,
struct sockaddr_in6 *psa,
int is_active_open)
{
int rc = 0;
Expand Down Expand Up @@ -208,9 +207,7 @@ static int netgetsocket(int istcp, char *server, int port,

int netannounce(int istcp, char *server, int port)
{
struct sockaddr_in6 sa;

return netgetsocket(istcp, server, port, &sa, CB_BIND);
return netgetsocket(istcp, server, port, CB_BIND);
}

int netaccept(int fd, char *server, int *port)
Expand Down Expand Up @@ -277,7 +274,6 @@ int netaccept(int fd, char *server, int *port)

int netdial(int istcp, char *server, int port)
{
struct sockaddr_in6 sa;
return netgetsocket(istcp, server, port, &sa, CB_CONNECT);
return netgetsocket(istcp, server, port, CB_CONNECT);
}

14 changes: 13 additions & 1 deletion src/tnetstrings_impl.h
Expand Up @@ -87,15 +87,27 @@ static inline void *tns_parse_string(const char *data, size_t len)
static inline void *tns_parse_integer(const char *data, size_t len)
{
tns_value_t *t = tns_value_create(tns_tag_number);
t->value.number = strtol(data, NULL, 10);
char *endptr = NULL;
t->value.number = strtol(data, &endptr, 10);
check(endptr != NULL && endptr - data == (int)len, "Failed to parse integer.");
check(errno != ERANGE, "Integer is too large.");

return t;
error:
return NULL;
}

static inline void *tns_parse_float(const char *data, size_t len)
{
tns_value_t *t = tns_value_create(tns_tag_float);
char *endptr = NULL;
t->value.fpoint = strtod(data, NULL);
check(endptr != NULL && endptr - data == (int)len, "Failed to parse float.");
check(errno != ERANGE, "Float is too large.");

return t;
error:
return NULL;
}


Expand Down
4 changes: 2 additions & 2 deletions src/upload.c
Expand Up @@ -36,7 +36,7 @@ static inline int stream_to_disk(IOBuf *iob, int content_len, int tmpfd)
int Upload_notify(Connection *conn, Handler *handler, const char *stage, bstring tmp_name)
{
bstring key = bformat("x-mongrel2-upload-%s", stage);
Request_set(conn->req, key, tmp_name, 1);
Request_set(conn->req, key, bstrcpy(tmp_name), 1);

return Connection_send_to_handler(conn, handler, "", 0);
}
Expand Down Expand Up @@ -67,7 +67,7 @@ int Upload_file(Connection *conn, Handler *handler, int content_len)
rc = stream_to_disk(conn->iob, content_len, tmpfd);
check(rc == 0, "Failed to stream to disk.");

rc = Upload_notify(conn, handler, "done", bstrcpy(tmp_name));
rc = Upload_notify(conn, handler, "done", tmp_name);
check(rc == 0, "Failed to notify the end of the upload.");

bdestroy(result);
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
@@ -1,3 +1,3 @@
#define VERSION "Mongrel2/1.7"
#define VERSION "Mongrel2/1.7.2"


3 changes: 3 additions & 0 deletions tools/config_modules/.dexy
@@ -0,0 +1,3 @@
{
"*.c|pyg|l" : {}
}
2 changes: 1 addition & 1 deletion tools/m2sh/src/config_file.c
Expand Up @@ -72,7 +72,7 @@ int Handler_load(tst_t *settings, tst_t *params)
const char *protocol = AST_str(settings, params, "protocol", VAL_QSTRING);
protocol = protocol != NULL ? protocol : "json";

res = DB_exec(bdata(&HANDLER_PROTOCOL_SQL));
res = DB_exec(bdata(&HANDLER_PROTOCOL_SQL), protocol);
check(res != NULL, "Invalid SQL with your protocol setting: '%s'", protocol);
tns_value_destroy(res);
}
Expand Down

0 comments on commit d9aa68d

Please sign in to comment.