You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2003/05/20 22:43:23 UTC
cvs commit: httpd-apreq-2/env libapreq_cgi.c
joes 2003/05/20 13:43:22
Modified: env libapreq_cgi.c
Log:
Give libapreq_cgi the ability to read POST data from stdin.
Revision Changes Path
1.5 +19 -4 httpd-apreq-2/env/libapreq_cgi.c
Index: libapreq_cgi.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/env/libapreq_cgi.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- libapreq_cgi.c 6 May 2003 19:34:19 -0000 1.4
+++ libapreq_cgi.c 20 May 2003 20:43:22 -0000 1.5
@@ -57,6 +57,7 @@
#include "apreq_params.h"
#include "apreq_parsers.h"
#include "apreq_cookie.h"
+#include "apr_strings.h"
#include <stdlib.h>
#include <stdio.h>
@@ -69,7 +70,8 @@
apreq_request_t *req;
apreq_jar_t *jar;
apr_bucket_brigade *bb;
- int loglevel;
+ int loglevel;
+ apr_status_t status;
};
const char apreq_env[] = "CGI";
@@ -83,7 +85,7 @@
return ctx->pool;
}
-APREQ_DECLARE(const char *)apreq_env_args(void *env)
+APREQ_DECLARE(const char *)apreq_env_query_string(void *env)
{
return getenv("QUERY_STRING");
}
@@ -150,8 +152,21 @@
va_end(vp);
}
-APREQ_DECLARE(apr_status_t) apreq_env_read(void *env, apr_read_type_e block,
+APREQ_DECLARE(apr_status_t) apreq_env_read(void *env,
+ apr_read_type_e block,
apr_off_t bytes)
{
- return APR_ENOTIMPL;
+ dCTX;
+ if (ctx->bb == NULL) {
+ apr_bucket_alloc_t *alloc = apr_bucket_alloc_create(ctx->pool);
+ apr_file_t *in;
+ apr_bucket *stdin_pipe;
+
+ ctx->bb = apr_brigade_create(ctx->pool, alloc);
+ apr_file_open_stdin(&in, ctx->pool);
+ stdin_pipe = apr_bucket_pipe_create(in,alloc);
+ APR_BRIGADE_INSERT_HEAD(ctx->bb, stdin_pipe);
+ }
+
+ return apreq_request_parse(apreq_request(env,NULL), ctx->bb);
}