Re: svn commit: r723627 - in /httpd/httpd/branches/wombat-integration: include/util_script.h server/util_script.c
On 12/05/2008 08:15 AM, [EMAIL PROTECTED] wrote: Author: pquerna Date: Thu Dec 4 23:15:22 2008 New Revision: 723627 URL: http://svn.apache.org/viewvc?rev=723627view=rev Log: Add new api, ap_args_to_table, to parse a request's arguments into a table. Modified: httpd/httpd/branches/wombat-integration/include/util_script.h httpd/httpd/branches/wombat-integration/server/util_script.c Modified: httpd/httpd/branches/wombat-integration/include/util_script.h URL: http://svn.apache.org/viewvc/httpd/httpd/branches/wombat-integration/include/util_script.h?rev=723627r1=723626r2=723627view=diff == --- httpd/httpd/branches/wombat-integration/include/util_script.h (original) +++ httpd/httpd/branches/wombat-integration/include/util_script.h Thu Dec 4 23:15:22 2008 @@ -140,6 +140,8 @@ int (*getsfunc) (char *, int, void *), void *getsfunc_data); +AP_DECLARE(void) ap_args_to_table(request_rec *r, apr_table_t **table); + Hm. This requires a minor bump. #ifdef __cplusplus } #endif Modified: httpd/httpd/branches/wombat-integration/server/util_script.c URL: http://svn.apache.org/viewvc/httpd/httpd/branches/wombat-integration/server/util_script.c?rev=723627r1=723626r2=723627view=diff == --- httpd/httpd/branches/wombat-integration/server/util_script.c (original) +++ httpd/httpd/branches/wombat-integration/server/util_script.c Thu Dec 4 23:15:22 2008 @@ -721,3 +721,41 @@ va_end(strs.args); return res; } + + +static void +argstr_to_table(apr_pool_t *p, char *str, apr_table_t *parms) +{ +char *key; +char *value; +char *strtok_state; + Hm, we should make a copy of str before changing it in the while lopp below. +key = apr_strtok(str, , strtok_state); +while (key) { +value = strchr(key, '='); +if (value) { +*value = '\0'; /* Split the string in two */ +value++;/* Skip passed the = */ +} +else { +value = 1; +} +ap_unescape_url(key); +ap_unescape_url(value); +apr_table_set(parms, key, value); +/* + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, r is no parameter for this function. + Found query arg: %s = %s, key, value); + */ +key = apr_strtok(NULL, , strtok_state); +} +} + +AP_DECLARE(void) ap_args_to_table(request_rec *r, apr_table_t **table) +{ +apr_table_t *t = apr_table_make(r-pool, 10); +argstr_to_table(r-pool, r-args, t); +*table = t; +} + +
Re: svn commit: r723652 - in /httpd/httpd/branches/wombat-integration: include/httpd.h include/util_script.h server/util_script.c
On 12/05/2008 09:36 AM, [EMAIL PROTECTED] wrote: Author: pquerna Date: Fri Dec 5 00:36:26 2008 New Revision: 723652 URL: http://svn.apache.org/viewvc?rev=723652view=rev Log: New API, ap_body_to_table, a very ineffeicent and bad hack to remove an apreq dependency. Modified: httpd/httpd/branches/wombat-integration/include/httpd.h httpd/httpd/branches/wombat-integration/include/util_script.h httpd/httpd/branches/wombat-integration/server/util_script.c Modified: httpd/httpd/branches/wombat-integration/include/httpd.h URL: http://svn.apache.org/viewvc/httpd/httpd/branches/wombat-integration/include/httpd.h?rev=723652r1=723651r2=723652view=diff == --- httpd/httpd/branches/wombat-integration/include/httpd.h (original) +++ httpd/httpd/branches/wombat-integration/include/httpd.h Fri Dec 5 00:36:26 2008 @@ -1005,6 +1005,7 @@ apr_thread_mutex_t *invoke_mtx; +apr_table_t *body_table; This requires a minor bump. /* Things placed at the end of the record to avoid breaking binary * compatibility. It would be nice to remember to reorder the entire * record to improve 64bit alignment the next time we need to break Modified: httpd/httpd/branches/wombat-integration/include/util_script.h URL: http://svn.apache.org/viewvc/httpd/httpd/branches/wombat-integration/include/util_script.h?rev=723652r1=723651r2=723652view=diff == --- httpd/httpd/branches/wombat-integration/include/util_script.h (original) +++ httpd/httpd/branches/wombat-integration/include/util_script.h Fri Dec 5 00:36:26 2008 @@ -142,6 +142,8 @@ AP_DECLARE(void) ap_args_to_table(request_rec *r, apr_table_t **table); +AP_DECLARE(apr_status_t) ap_body_to_table(request_rec *r, apr_table_t **table); + #ifdef __cplusplus } #endif Modified: httpd/httpd/branches/wombat-integration/server/util_script.c URL: http://svn.apache.org/viewvc/httpd/httpd/branches/wombat-integration/server/util_script.c?rev=723652r1=723651r2=723652view=diff == --- httpd/httpd/branches/wombat-integration/server/util_script.c (original) +++ httpd/httpd/branches/wombat-integration/server/util_script.c Fri Dec 5 00:36:26 2008 @@ -729,6 +729,10 @@ char *key; char *value; char *strtok_state; + +if (str == NULL) { +return; +} key = apr_strtok(str, , strtok_state); while (key) { @@ -758,4 +762,77 @@ *table = t; } +AP_DECLARE(apr_status_t) ap_body_to_table(request_rec *r, apr_table_t **table) +{ +apr_bucket_brigade *bb; +apr_bucket_brigade *tmpbb; +apr_status_t rv = APR_SUCCESS; + +if (r-body_table) { +*table = r-body_table; +return APR_SUCCESS; +} + +*table = NULL; + +bb = apr_brigade_create(r-pool, r-connection-bucket_alloc); +tmpbb = apr_brigade_create(r-pool, r-connection-bucket_alloc); + +do { +apr_off_t len; + +rv = ap_get_brigade(r-input_filters, tmpbb, AP_MODE_READBYTES, +APR_BLOCK_READ, AP_IOBUFSIZE); +if (rv) { +break; +} + +rv = apr_brigade_length(tmpbb, 1, len); +if (rv) { +break; +} + +if (len == 0) { +break; +} + +APR_BRIGADE_CONCAT(bb, tmpbb); +} while(1); + +if (!rv) { +r-body_table = apr_table_make(r-pool, 10); + +if (!APR_BRIGADE_EMPTY(bb)) { +char *buffer; +apr_off_t len; +apr_pool_t *tpool; + +apr_pool_create(tpool, r-pool); + +rv = apr_brigade_length(bb, 1, len); + +if (!rv) { +apr_size_t total; +buffer = apr_palloc(tpool, len+1); + +total = len+1; + +rv = apr_brigade_flatten(bb, buffer, total); + +buffer[total] = '\0'; + +argstr_to_table(r-pool, buffer, r-body_table); +} +apr_pool_destroy(tpool); +} +} I guess in the user of this function should advice the end user to carefully thing about setting LimitRequestBody. Otherwise this can be easily used for DoS. + +apr_brigade_destroy(bb); +apr_brigade_destroy(tmpbb); + +*table = r-body_table; + +return rv; +} + Regards Rüdiger
Re: svn commit: r723627 - in /httpd/httpd/branches/wombat-integration: include/util_script.h server/util_script.c
On 12/06/2008 09:46 AM, Ruediger Pluem wrote: On 12/05/2008 08:15 AM, [EMAIL PROTECTED] wrote: Author: pquerna Date: Thu Dec 4 23:15:22 2008 New Revision: 723627 URL: http://svn.apache.org/viewvc?rev=723627view=rev Log: Add new api, ap_args_to_table, to parse a request's arguments into a table. Modified: httpd/httpd/branches/wombat-integration/include/util_script.h httpd/httpd/branches/wombat-integration/server/util_script.c Modified: httpd/httpd/branches/wombat-integration/include/util_script.h URL: http://svn.apache.org/viewvc/httpd/httpd/branches/wombat-integration/include/util_script.h?rev=723627r1=723626r2=723627view=diff == --- httpd/httpd/branches/wombat-integration/include/util_script.h (original) +++ httpd/httpd/branches/wombat-integration/include/util_script.h Thu Dec 4 23:15:22 2008 @@ -140,6 +140,8 @@ int (*getsfunc) (char *, int, void *), void *getsfunc_data); +AP_DECLARE(void) ap_args_to_table(request_rec *r, apr_table_t **table); + Hm. This requires a minor bump. #ifdef __cplusplus } #endif Modified: httpd/httpd/branches/wombat-integration/server/util_script.c URL: http://svn.apache.org/viewvc/httpd/httpd/branches/wombat-integration/server/util_script.c?rev=723627r1=723626r2=723627view=diff == --- httpd/httpd/branches/wombat-integration/server/util_script.c (original) +++ httpd/httpd/branches/wombat-integration/server/util_script.c Thu Dec 4 23:15:22 2008 @@ -721,3 +721,41 @@ va_end(strs.args); return res; } + + +static void +argstr_to_table(apr_pool_t *p, char *str, apr_table_t *parms) +{ +char *key; +char *value; +char *strtok_state; + Hm, we should make a copy of str before changing it in the while lopp below. Reading further on in the commits I changed my mind. We should not do a copy here, but passing the pool as argument to the function seems to be pointless to me. +key = apr_strtok(str, , strtok_state); +while (key) { +value = strchr(key, '='); +if (value) { +*value = '\0'; /* Split the string in two */ +value++;/* Skip passed the = */ +} +else { +value = 1; +} +ap_unescape_url(key); +ap_unescape_url(value); +apr_table_set(parms, key, value); +/* + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, r is no parameter for this function. + Found query arg: %s = %s, key, value); + */ +key = apr_strtok(NULL, , strtok_state); +} +} + +AP_DECLARE(void) ap_args_to_table(request_rec *r, apr_table_t **table) +{ +apr_table_t *t = apr_table_make(r-pool, 10); +argstr_to_table(r-pool, r-args, t); We should make a copy of r-args here before passing as argstr_to_table changes the contents of the second parameter. Regards Rüdiger
Re: svn commit: r721952 - in /httpd/httpd/trunk: ./ modules/ modules/cluster/
On Mon, 01 Dec 2008 02:55:15 - [EMAIL PROTECTED] wrote: Author: pquerna Date: Sun Nov 30 18:55:14 2008 New Revision: 721952 URL: http://svn.apache.org/viewvc?rev=721952view=rev Log: Add two new modules, originally written at Joost, to handle load balancing across multiple apache servers within the same datacenter. mod_heartbeat generates multicast status messages with the current number of clients connected, but the formated can easily be extended to include other things. mod_heartmonitor collects these messages into a static file, which then can be used for other modules to make load balancing decisions on. Added: httpd/httpd/trunk/modules/cluster/ (with props) httpd/httpd/trunk/modules/cluster/Makefile.in (with props) httpd/httpd/trunk/modules/cluster/README.heartbeat httpd/httpd/trunk/modules/cluster/README.heartmonitor httpd/httpd/trunk/modules/cluster/config.m4 httpd/httpd/trunk/modules/cluster/mod_heartbeat.c (with props) httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c (with props) Modified: httpd/httpd/trunk/CHANGES httpd/httpd/trunk/modules/README [cut] Added: httpd/httpd/trunk/modules/cluster/mod_heartbeat.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cluster/mod_heartbeat.c?rev=721952view=auto == --- httpd/httpd/trunk/modules/cluster/mod_heartbeat.c (added) +++ httpd/httpd/trunk/modules/cluster/mod_heartbeat.c Sun Nov 30 18:55:14 2008 @@ -0,0 +1,354 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more [cut] +typedef struct hb_ctx_t +{ +int active; +apr_sockaddr_t *mcast_addr; +int server_limit; +int thread_limit; +int status; [cut] + +static void *hb_worker(apr_thread_t *thd, void *data) Don't this need to be APR_THREAD_FUNC? +{ +hb_ctx_t *ctx = (hb_ctx_t *) data; +apr_status_t rv; + +apr_pool_t *pool = apr_thread_pool_get(thd); +apr_pool_tag(pool, heartbeat_worker); +ctx-status = 0; The meaning of status zero is unclear. [cut] +static void start_hb_worker(apr_pool_t *p, hb_ctx_t *ctx) +{ +apr_status_t rv; + +rv = apr_thread_mutex_create(ctx-start_mtx, APR_THREAD_MUTEX_UNNESTED, + p); + +if (rv) { +ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + Heartbeat: apr_thread_cond_create failed); +ctx-status = rv; +return; +} status is apr_status_t? + +apr_thread_mutex_lock(ctx-start_mtx); + +apr_pool_cleanup_register(p, ctx, hb_pool_cleanup, apr_pool_cleanup_null); + +rv = apr_thread_create(ctx-thread, NULL, hb_worker, ctx, p); +if (rv) { +apr_pool_cleanup_kill(p, ctx, hb_pool_cleanup); +ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, + Heartbeat: apr_thread_create failed); +ctx-status = rv; +} Same above. + +apr_thread_mutex_lock(ctx-start_mtx); +apr_thread_mutex_unlock(ctx-start_mtx); +apr_thread_mutex_destroy(ctx-start_mtx); +} + +static void hb_child_init(apr_pool_t *p, server_rec *s) +{ +hb_ctx_t *ctx = ap_get_module_config(s-module_config, heartbeat_module); + +apr_proc_mutex_child_init(ctx-mutex, ctx-mutex_path, p); + +ctx-status = -1; I don't like this. status -1 is unclear. + +if (ctx-active) { +start_hb_worker(p, ctx); +if (ctx-status != 0) { Same above. Why not change the type of hb_ctx_t::status to apr_status_t ? [cut] +static const char *cmd_hb_address(cmd_parms *cmd, + void *dconf, const char *addr) +{ +apr_status_t rv; +char *host_str; +char *scope_id; +apr_port_t port = 0; +apr_pool_t *p = cmd-pool; +hb_ctx_t *ctx = +(hb_ctx_t *) ap_get_module_config(cmd-server-module_config, + heartbeat_module); +const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); + +if (err != NULL) { +return err; +} + +ctx-active = 1; + +rv = apr_parse_addr_port(host_str, scope_id, port, addr, p); cmd-temp_pool is better than cmd-pool. + +if (rv) { +return HeartbeatAddress: Unable to parse address.; +} + +if (host_str == NULL) { +return HeartbeatAddress: No host provided in address; +} + +if (port == 0) { +return HeartbeatAddress: No port provided in address; +} + +rv = apr_sockaddr_info_get(ctx-mcast_addr, host_str, APR_INET, port, 0, + p); + +if (rv) { +return HeartbeatAddress: apr_sockaddr_info_get failed.; +} + +const char *tmpdir = NULL; +rv = apr_temp_dir_get(tmpdir, p); Same above. +if (rv) { +return HeartbeatAddress: unable to find temp directory.; +} + +char *path =
[VOTE] Release Apache HTTP server 2.2.11
Test tarballs for Apache httpd 2.2.11 are available at: http://httpd.apache.org/dev/dist/ Your votes please; +/-1 [ ] Release httpd-2.2.11 as GA Regards Rüdiger
Re: [VOTE] Release Apache HTTP server 2.2.11
Den Saturday 06 December 2008 17:30:05 skrev Ruediger Pluem: Test tarballs for Apache httpd 2.2.11 are available at: http://httpd.apache.org/dev/dist/ Your votes please; +/-1 [ ] Release httpd-2.2.11 as GA Regards Rüdiger It builds fine on Mandriva. -- Regards // Oden Eriksson
Re: [VOTE] Release Apache HTTP server 2.2.11
When will you close the vote? On Dec 6, 2008, at 11:30 AM, Ruediger Pluem wrote: Test tarballs for Apache httpd 2.2.11 are available at: http://httpd.apache.org/dev/dist/ Your votes please; +/-1 [ ] Release httpd-2.2.11 as GA Regards Rüdiger
Re: [VOTE] Release Apache HTTP server 2.2.11
Ruediger Pluem [EMAIL PROTECTED] writes: Test tarballs for Apache httpd 2.2.11 are available at: http://httpd.apache.org/dev/dist/ Your votes please; +/-1 [ ] Release httpd-2.2.11 as GA Regards Rüdiger Builds on Ubuntu 8.10. Best Regards. -- Cafer Şimşek http://cafer.org/
Re: [VOTE] Release Apache HTTP server 2.2.11
On 12/06/2008 07:25 PM, Jim Jagielski wrote: When will you close the vote? Sorry for missing this point. I plan to close it on December 13th, 12:00 UTC. That should give everybody enough time for testing and voting. If not please let me know and will adjust the timing Furthermore I can prepare the announcements on the weekend and upload the files so that the mirrors are synced until Monday, such that the announcement can happen on Monday the 15th (Provided the vote passes of course). Regards Rüdiger
Re: [VOTE] Release Apache HTTP server 2.2.11
On 12/06/2008 05:30 PM, Ruediger Pluem wrote: Test tarballs for Apache httpd 2.2.11 are available at: http://httpd.apache.org/dev/dist/ Your votes please; +/-1 [ ] Release httpd-2.2.11 as GA +1 Tested on the following environments: Solaris 8 SPARC Solaris 9 SPARC Solaris 10 SPARC Red Hat AS 4 32 Bit (x86) Red Hat AS 4 64 Bit (x86_64) Red Hat AS 5 32 Bit (x86) Red Hat AS 5 64 Bit (x86_64) SuSE Linux 10.2 32 Bit (x86) SuSE Linux 11.0 32 Bit (x86) SuSE Linux 10.1 64 Bit (x86_64) Regards Rüdiger
Re: svn commit: r723652 - in /httpd/httpd/branches/wombat-integration: include/httpd.h include/util_script.h server/util_script.c
Ruediger Pluem wrote: +AP_DECLARE(apr_status_t) ap_body_to_table(request_rec *r, apr_table_t **table) . I guess in the user of this function should advice the end user to carefully thing about setting LimitRequestBody. Otherwise this can be easily used for DoS. Yes, I believe before 2.4.0/stable, we should replace this function with one powered by apreq, which has a more-streamy parser that handles much more without duplicating the entire body. -Paul
Re: svn commit: r723627 - in /httpd/httpd/branches/wombat-integration: include/util_script.h server/util_script.c
Ruediger Pluem wrote: On 12/05/2008 08:15 AM, [EMAIL PROTECTED] wrote: Author: pquerna Date: Thu Dec 4 23:15:22 2008 New Revision: 723627 URL: http://svn.apache.org/viewvc?rev=723627view=rev Log: Add new api, ap_args_to_table, to parse a request's arguments into a table. void *getsfunc_data); +AP_DECLARE(void) ap_args_to_table(request_rec *r, apr_table_t **table); + Hm. This requires a minor bump. Bumped r724083. ... +static void +argstr_to_table(apr_pool_t *p, char *str, apr_table_t *parms) +{ +char *key; +char *value; +char *strtok_state; + Hm, we should make a copy of str before changing it in the while lopp below. Yah, fixed in r724080. +key = apr_strtok(str, , strtok_state); +while (key) { +value = strchr(key, '='); +if (value) { +*value = '\0'; /* Split the string in two */ +value++;/* Skip passed the = */ +} +else { +value = 1; +} +ap_unescape_url(key); +ap_unescape_url(value); +apr_table_set(parms, key, value); +/* + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, r is no parameter for this function. Removed this old commented out block in r724084. Thanks, Paul
Re: svn commit: r721952 - in /httpd/httpd/trunk: ./ modules/ modules/cluster/
Takashi Sato wrote: On Mon, 01 Dec 2008 02:55:15 - [EMAIL PROTECTED] wrote: Author: pquerna Date: Sun Nov 30 18:55:14 2008 New Revision: 721952 + +static void *hb_worker(apr_thread_t *thd, void *data) Don't this need to be APR_THREAD_FUNC? Fixed in r724090. +{ +hb_ctx_t *ctx = (hb_ctx_t *) data; +apr_status_t rv; + +apr_pool_t *pool = apr_thread_pool_get(thd); +apr_pool_tag(pool, heartbeat_worker); +ctx-status = 0; The meaning of status zero is unclear. Fixed all of the ctx-status things to use apr_status_t values in r724091. [cut] +static const char *cmd_hb_address(cmd_parms *cmd, + void *dconf, const char *addr) +{ +apr_status_t rv; +char *host_str; +char *scope_id; +apr_port_t port = 0; +apr_pool_t *p = cmd-pool; +hb_ctx_t *ctx = +(hb_ctx_t *) ap_get_module_config(cmd-server-module_config, + heartbeat_module); +const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); + +if (err != NULL) { +return err; +} + +ctx-active = 1; + +rv = apr_parse_addr_port(host_str, scope_id, port, addr, p); cmd-temp_pool is better than cmd-pool. Fixed up the config code to use the temp pool in r724092. Thanks, Paul
Re: mod_cache not caching some RFC valid cacheable requests
Alex Polvi wrote: Hi there, I ran into a weird case where *I think* mod_cache should be caching a request that it is not. Thought I would try to fix it myself, but would like to seek your feedback as it is my first httpd patch (thanks to pquerna for the help/encouragement). Caching a 302 is generally not valid (RFC2616 13.4), unless the response headers includes an Expires or Cache Control header (section 13.4, last paragraph). This makes the fix a matter of messing with the cacheability logic. I optimized for least amount of code change, but there are surely different ways to do this. Feedback on the best approach would be greatly appreciated! Thanks, -Alex PS: I also filed a bug, if that is a better forum for this discussion: https://issues.apache.org/bugzilla/show_bug.cgi?id=46346 Committed to trunk in r724093, Thanks, -Paul
[VOTE] Release Apache HTTP server 2.3.0-alpha
Test tarballs for Apache httpd 2.3.0-alpha are available at: http://httpd.apache.org/dev/dist/ Your votes please; ±1 [ ] Release httpd-2.3.0 as Alpha Vote closes at 7:00 UTC on Tuesday December 9 2008. Thanks, Paul
Re: [VOTE] Release Apache HTTP server 2.3.0-alpha
Paul Querna wrote: Your votes please; ±1 [ ] Release httpd-2.3.0 as Alpha Vote closes at 7:00 UTC on Tuesday December 9 2008. 72 hours for a first alpha? Really sounds rushed to me, I may or may not have a chance to look at it in time.
Re: [VOTE] Release Apache HTTP server 2.3.0-alpha
William A. Rowe, Jr. wrote: Paul Querna wrote: Your votes please; ±1 [ ] Release httpd-2.3.0 as Alpha Vote closes at 7:00 UTC on Tuesday December 9 2008. 72 hours for a first alpha? Really sounds rushed to me, I may or may not have a chance to look at it in time. It was 72 hours form when I tagged it. /me shrugs. I'm not strongly stuck to it, if its controversial, we can extend it for a day, but I expect its either gonna work, or have fatal flaw, it is just an alpha after all :) -Paul