Hi,

I needed to be able to set the content-type in POST type url, for
example to send a file so I added a parameter to the url element.

The patch is attached to this mail for inclusion if it suits you

Philippe
Index: config.h.in
===================================================================
RCS file: /home/cvspublic/httpd-test/flood/config.h.in,v
retrieving revision 1.30
diff -u -b -B -r1.30 config.h.in
--- config.h.in 9 Sep 2003 13:59:17 -0000       1.30
+++ config.h.in 13 Feb 2004 08:35:51 -0000
@@ -22,6 +22,7 @@
 #define XML_URLLIST_METHOD_POST "post"
 #define XML_URLLIST_METHOD_HEAD "head"
 #define XML_URLLIST_PAYLOAD "payload"
+#define XML_URLLIST_CONTENT_TYPE "content-type"
 #define XML_URLLIST_PAYLOAD_TEMPLATE "payloadtemplate"
 #define XML_URLLIST_REQUEST_TEMPLATE "requesttemplate"
 #define XML_URLLIST_RESPONSE_TEMPLATE "responsetemplate"
Index: flood_profile.h
===================================================================
RCS file: /home/cvspublic/httpd-test/flood/flood_profile.h,v
retrieving revision 1.14
diff -u -b -B -r1.14 flood_profile.h
--- flood_profile.h     1 Jan 2004 13:38:36 -0000       1.14
+++ flood_profile.h     13 Feb 2004 08:35:51 -0000
@@ -108,6 +108,9 @@
     /* Following only valid when method == POST */
     apr_size_t payloadsize;
     void * payload;
+
+    apr_size_t contenttypesize;
+    char * contenttype;
     
     apr_uri_t *parsed_uri;
 
Index: flood_round_robin.c
===================================================================
RCS file: /home/cvspublic/httpd-test/flood/flood_round_robin.c,v
retrieving revision 1.38
diff -u -b -B -r1.38 flood_round_robin.c
--- flood_round_robin.c 1 Jan 2004 13:38:36 -0000       1.38
+++ flood_round_robin.c 13 Feb 2004 08:35:52 -0000
@@ -109,6 +109,7 @@
     char *url;
     method_e method;
     char *payload;
+    char *contenttype;
     apr_int64_t predelay;
     apr_int64_t predelayprecision;
     apr_int64_t postdelay;
@@ -346,7 +347,7 @@
                                    "Connection: %s" CRLF
                                    "Host: %s" CRLF
                                    "Content-Length: %d" CRLF 
-                                   "Content-type: 
application/x-www-form-urlencoded" CRLF
+                                   "Content-type: %s" CRLF 
                                    "%s"
                                    "%s" CRLF
                                    "%s",
@@ -356,6 +357,7 @@
                                    r->keepalive ? "Keep-Alive" : "Close",
                                    r->parsed_uri->hostinfo,
                                    r->payloadsize,
+                                  r->contenttype ? r->contenttype : 
"application/x-www-form-urlencoded", 
                                    authz_hdr ? authz_hdr : "",
                                    cookies,
                                    (char*)r->payload);
@@ -432,6 +434,10 @@
                                  FLOOD_STRLEN_MAX) == 0) {
                 url->payload = (char*)attr->value;
             }
+           else if (strncasecmp(attr->name,XML_URLLIST_CONTENT_TYPE,
+                                FLOOD_STRLEN_MAX) == 0) {
+               url->contenttype = (char*)attr->value;
+           }
             else if (strncasecmp(attr->name, XML_URLLIST_PREDELAY,
                                  FLOOD_STRLEN_MAX) == 0) {
                 char *endptr;
@@ -527,6 +533,7 @@
     {
         url->method = GET;
         url->payload = NULL;
+        url->contenttype = NULL;
     }
 
     return APR_SUCCESS;
@@ -821,6 +828,12 @@
         r->payload = parse_param_string(rp, 
                                     rp->url[rp->current_url].payloadtemplate);
         r->payloadsize = strlen(r->payload);
+    }
+
+    if (rp->url[rp->current_url].contenttype)
+    {
+        r->contenttype = parse_param_string(rp, 
rp->url[rp->current_url].contenttype);
+       r->contenttypesize = strlen(r->contenttype);
     }
 
     /* If they want a sleep, do it now. */

Reply via email to