]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Added support for reading raw PUT/POST data from HTTP request
authorMartin Willi <martin@revosec.ch>
Thu, 27 May 2010 07:30:14 +0000 (09:30 +0200)
committerMartin Willi <martin@revosec.ch>
Thu, 27 May 2010 07:30:14 +0000 (09:30 +0200)
src/libfast/request.c
src/libfast/request.h

index 6bf596fd88ed0a792ea62a3f656f53658df08eb4..16c1ae5831fb2348d30b6d2354d585574d3924d3 100644 (file)
@@ -203,6 +203,14 @@ static char* get_query_data(private_request_t *this, char *name)
        return hdf_get_valuef(this->hdf, "Query.%s", name);
 }
 
+/**
+ * Implementation of request_t.read_data.
+ */
+static int read_data(private_request_t *this, char *buf, int len)
+{
+       return FCGX_GetStr(buf, len, this->req.in);
+}
+
 /**
  * Implementation of request_t.get_base.
  */
@@ -407,6 +415,7 @@ request_t *request_create(int fd, bool debug)
        this->public.add_cookie = (void(*)(request_t*, char *name, char *value))add_cookie;
        this->public.get_cookie = (char*(*)(request_t*,char*))get_cookie;
        this->public.get_query_data = (char*(*)(request_t*, char *name))get_query_data;
+       this->public.read_data = (int(*)(request_t*, char*, int))read_data;
        this->public.session_closed = (bool(*)(request_t*))session_closed;
        this->public.close_session = (void(*)(request_t*))close_session;
        this->public.redirect = (void(*)(request_t*, char *fmt,...))redirect;
index af0f8e4f5e56ac0957a70824514a95e715a6610b..9ca74a91e6e0a2eaba14fbc9eaecda68a34a7cff 100644 (file)
@@ -85,6 +85,15 @@ struct request_t {
         */
        char* (*get_query_data)(request_t *this, char *name);
 
+       /**
+        * Read raw POST/PUT data from HTTP request.
+        *
+        * @param buf           buffer to read data into
+        * @param len           size of the supplied buffer
+        * @return                      number of bytes read, < 0 on error
+        */
+       int (*read_data)(request_t *this, char *buf, int len);
+
        /**
         * Close the session and it's context after handling.
         */