On Sun, Nov 17, 2013 at 2:15 AM, Henrik Grubbström (Lysator) @ Pike (-) developers forum <[email protected]> wrote: > And now the branch and Pike 8.0.1 exist: > > | Pike v8.0 release 1 running Hilfe v3.5 (Incremental Pike Frontend) > | >
Cool! This looks like a good opportunity to mention a few patches that I haven't heard back regarding. They're mostly fairly trivial/simple. Is there a better way to suggest patches than posting them to this list or pike@roxen? ChrisA
From c81cbe6479179f3082c64efe1d501c691f384f2e Mon Sep 17 00:00:00 2001 From: Chris Angelico <[email protected]> Date: Thu, 1 Nov 2012 06:03:20 +1100 Subject: [PATCH 1/6] Add convenience function get_ip to HTTP Request objects, and document my_fd member --- .../Protocols.pmod/HTTP.pmod/Server.pmod/Request.pike | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/Request.pike b/lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/Request.pike index 7eda95e..7ca6e69 100644 --- a/lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/Request.pike +++ b/lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/Request.pike @@ -51,7 +51,9 @@ protected class Port { void destroy(); } +//! The socket that this request came in on. Stdio.File my_fd; + Port server_port; .HeaderParser headerparser; @@ -581,6 +583,17 @@ string make_response_header(mapping m) return res*"\r\n"+"\r\n\r\n"; } +//! Return the IP address that originated the request, or 0 if +//! the IP address could not be determined. In the event of an +//! error, @[my_fd]@tt{->errno()@} will be set. +string get_ip() +{ + string addr = my_fd?->query_address(); + if (!addr) return 0; + sscanf(addr,"%s ",addr); + return addr; +} + //! return a properly formatted response to the HTTP client //! @param m //! Contains elements for generating a response to the client. -- 1.7.10.4
From a281fa9b3f4826f6541e1dc0247b8a523d317fff Mon Sep 17 00:00:00 2001 From: Chris Angelico <[email protected]> Date: Sat, 16 Mar 2013 23:56:42 +1100 Subject: [PATCH 2/6] low_read_file: Show length read as unsigned int with %u for safety --- src/object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/object.c b/src/object.c index 3495a01..e78fb62 100644 --- a/src/object.c +++ b/src/object.c @@ -491,8 +491,8 @@ static struct pike_string *low_read_file(const char *file) Pike_fatal("low_read_file(%s) failed, errno=%d\n",file,errno); } Pike_fatal("low_read_file(%s) failed, short read: " - "%"PRINTPIKEOFFT"d < %"PRINTPIKEOFFT"d\n", - file, pos, len); + "%u < %"PRINTPIKEOFFT"d\n", + file, (unsigned)pos, len); } pos+=tmp; } -- 1.7.10.4
From d9619cdba197f15fc22d71c6335e9b8c77951aa1 Mon Sep 17 00:00:00 2001 From: Chris Angelico <[email protected]> Date: Mon, 18 Mar 2013 22:59:47 +1100 Subject: [PATCH 3/6] Configure: Halt the OOB check on poll error to prevent hang --- src/configure.in | 1 + 1 file changed, 1 insertion(+) diff --git a/src/configure.in b/src/configure.in index 1c5453f..6872de3 100644 --- a/src/configure.in +++ b/src/configure.in @@ -7451,6 +7451,7 @@ int main(int argc, char **argv) for(e=0;e<2;e++) { + if(pollset[e].revents & POLLERR) exit(1); if(pollset[e].revents & POLLRDBAND) pong(e); if(pollset[e].revents & POLLWRBAND) ping(e); if(pollset[e].revents & POLLIN) pang(e); -- 1.7.10.4
From 8495d82553364d171e974133c6531efda39008aa Mon Sep 17 00:00:00 2001 From: Chris Angelico <[email protected]> Date: Sat, 23 Mar 2013 01:37:06 +1100 Subject: [PATCH 4/6] GTK2.TreePath: Query the depth for get_indices() rather than looking for a terminator --- src/post_modules/GTK2/source/gtktreepath.pre | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/post_modules/GTK2/source/gtktreepath.pre b/src/post_modules/GTK2/source/gtktreepath.pre index 7e5dd93..13a1407 100644 --- a/src/post_modules/GTK2/source/gtktreepath.pre +++ b/src/post_modules/GTK2/source/gtktreepath.pre @@ -104,14 +104,16 @@ array(int) get_indices() //! of integers, each representing a node in a tree. { int n=0; + gint depth=gtk_tree_path_get_depth((GtkTreePath *)THIS->obj); gint *arr=gtk_tree_path_get_indices((GtkTreePath *)THIS->obj); pgtk2_pop_n_elems(args); - while (arr[n]) - PGTK_PUSH_INT(arr[n++]); - if (!n) - ref_push_array(&empty_array); + if (!depth) ref_push_array(&empty_array); else + { + while (n<depth) + PGTK_PUSH_INT(arr[n++]); f_aggregate(n); + } } void destroy() -- 1.7.10.4
From 7d870ad3306d3d78db60287d73cf5a7c17bb81f5 Mon Sep 17 00:00:00 2001 From: Chris Angelico <[email protected]> Date: Sun, 9 Jun 2013 04:51:45 +1000 Subject: [PATCH 5/6] Shorten/simplify the recording of string flags upper/lowercase --- src/stralloc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/stralloc.c b/src/stralloc.c index 0374964..951aa76 100644 --- a/src/stralloc.c +++ b/src/stralloc.c @@ -179,12 +179,10 @@ PMOD_EXPORT void check_string_range( struct pike_string *str, if( s_max < 128 ) { - if( upper && !lower ) + if( !lower ) str->flags |= STRING_IS_UPPERCASE; - if( lower && !upper ) + if( !upper ) str->flags |= STRING_IS_LOWERCASE; - if( !lower && !upper ) - str->flags |= STRING_IS_LOWERCASE|STRING_IS_UPPERCASE; } } str->min = s_min; -- 1.7.10.4
From a6ff5bd2b2659b9e0043458dd6881f88ad764c7f Mon Sep 17 00:00:00 2001 From: Chris Angelico <[email protected]> Date: Sat, 13 Jul 2013 10:16:52 +1000 Subject: [PATCH 6/6] Document that function_name can describe programs too --- src/builtin.cmod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/builtin.cmod b/src/builtin.cmod index a2b183f..acda79f 100644 --- a/src/builtin.cmod +++ b/src/builtin.cmod @@ -1776,9 +1776,9 @@ static struct pike_string *delambda(struct pike_string *str) return make_shared_binary_pcharp(pcharp, len); } -/*! @decl string function_name(function f) +/*! @decl string function_name(function|program f) *! - *! Return the name of the function @[f]. + *! Return the name of the function or program @[f]. *! *! If @[f] is a global function defined in the runtime @expr{0@} *! (zero) will be returned. -- 1.7.10.4
