summaryrefslogtreecommitdiff
path: root/modules/generators
diff options
context:
space:
mode:
authorStefan Fritsch <sf@sfritsch.de>2011-12-27 19:42:33 +0100
committerStefan Fritsch <sf@sfritsch.de>2011-12-27 19:42:33 +0100
commitad14e19ad0400e289b06fb7728aea815e6ed49be (patch)
treebd29489cafb04b303940169ae7b00c1171a5a34c /modules/generators
parent02a0e3b89d2ea1b984365e692c910668d75c6dcd (diff)
downloadapache2-ad14e19ad0400e289b06fb7728aea815e6ed49be.tar.gz
Upstream tarball 2.2.12upstream/2.2.12
Diffstat (limited to 'modules/generators')
-rw-r--r--modules/generators/mod_cgid.c59
-rw-r--r--modules/generators/mod_info.c14
2 files changed, 57 insertions, 16 deletions
diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c
index 5ee3df07..99ae84b5 100644
--- a/modules/generators/mod_cgid.c
+++ b/modules/generators/mod_cgid.c
@@ -344,6 +344,33 @@ static apr_status_t sock_write(int fd, const void *buf, size_t buf_size)
return APR_SUCCESS;
}
+static apr_status_t sock_writev(int fd, request_rec *r, int count, ...)
+{
+ va_list ap;
+ int rc;
+ struct iovec *vec;
+ int i;
+ int total_bytes = 0;
+
+ vec = (struct iovec *)apr_palloc(r->pool, count * sizeof(struct iovec));
+ va_start(ap, count);
+ for (i = 0; i < count; i++) {
+ vec[i].iov_base = va_arg(ap, caddr_t);
+ vec[i].iov_len = va_arg(ap, apr_size_t);
+ total_bytes += vec[i].iov_len;
+ }
+ va_end(ap);
+
+ do {
+ rc = writev(fd, vec, count);
+ } while (rc < 0 && errno == EINTR);
+ if (rc < 0) {
+ return errno;
+ }
+
+ return APR_SUCCESS;
+}
+
static apr_status_t get_req(int fd, request_rec *r, char **argv0, char ***env,
cgid_req_t *req)
{
@@ -472,31 +499,31 @@ static apr_status_t send_req(int fd, request_rec *r, char *argv0, char **env,
req.loglevel = r->server->loglevel;
/* Write the request header */
- if ((stat = sock_write(fd, &req, sizeof(req))) != APR_SUCCESS) {
- return stat;
+ if (req.args_len) {
+ stat = sock_writev(fd, r, 5,
+ &req, sizeof(req),
+ r->filename, req.filename_len,
+ argv0, req.argv0_len,
+ r->uri, req.uri_len,
+ r->args, req.args_len);
+ } else {
+ stat = sock_writev(fd, r, 4,
+ &req, sizeof(req),
+ r->filename, req.filename_len,
+ argv0, req.argv0_len,
+ r->uri, req.uri_len);
}
- /* Write filename, argv0, uri, and args */
- if ((stat = sock_write(fd, r->filename, req.filename_len)) != APR_SUCCESS ||
- (stat = sock_write(fd, argv0, req.argv0_len)) != APR_SUCCESS ||
- (stat = sock_write(fd, r->uri, req.uri_len)) != APR_SUCCESS) {
+ if (stat != APR_SUCCESS) {
return stat;
}
- if (req.args_len) {
- if ((stat = sock_write(fd, r->args, req.args_len)) != APR_SUCCESS) {
- return stat;
- }
- }
/* write the environment variables */
for (i = 0; i < req.env_count; i++) {
apr_size_t curlen = strlen(env[i]);
- if ((stat = sock_write(fd, &curlen, sizeof(curlen))) != APR_SUCCESS) {
- return stat;
- }
-
- if ((stat = sock_write(fd, env[i], curlen)) != APR_SUCCESS) {
+ if ((stat = sock_writev(fd, r, 2, &curlen, sizeof(curlen),
+ env[i], curlen)) != APR_SUCCESS) {
return stat;
}
}
diff --git a/modules/generators/mod_info.c b/modules/generators/mod_info.c
index 9d8495ca..297953fd 100644
--- a/modules/generators/mod_info.c
+++ b/modules/generators/mod_info.c
@@ -44,6 +44,8 @@
#include "apr.h"
#include "apr_strings.h"
#include "apr_lib.h"
+#include "apr_version.h"
+#include "apu_version.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
@@ -352,6 +354,18 @@ static int show_server_settings(request_rec * r)
"<font size=\"+1\"><tt>%s</tt></font></dt>\n",
ap_get_server_built());
ap_rprintf(r,
+ "<dt><strong>Server loaded APR Version:</strong> "
+ "<tt>%s</tt></dt>\n", apr_version_string());
+ ap_rprintf(r,
+ "<dt><strong>Compiled with APR Version:</strong> "
+ "<tt>%s</tt></dt>\n", APR_VERSION_STRING);
+ ap_rprintf(r,
+ "<dt><strong>Server loaded APU Version:</strong> "
+ "<tt>%s</tt></dt>\n", apu_version_string());
+ ap_rprintf(r,
+ "<dt><strong>Compiled with APU Version:</strong> "
+ "<tt>%s</tt></dt>\n", APU_VERSION_STRING);
+ ap_rprintf(r,
"<dt><strong>Module Magic Number:</strong> "
"<tt>%d:%d</tt></dt>\n", MODULE_MAGIC_NUMBER_MAJOR,
MODULE_MAGIC_NUMBER_MINOR);