You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Philippe Marzouk <ph...@ozigo.org> on 2004/02/13 09:44:15 UTC

[PATCH] flood and content-type setting

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

Re: [PATCH] flood and content-type setting

Posted by Philippe Marzouk <ph...@ozigo.org>.
On Thu, Apr 15, 2004 at 12:22:03PM +0200, Jacek Prucia wrote:
> 
> Philippe,
> 
> Would you have something against a little simplification? Your example
> payload has many parts, where I think two parts would be sufficient. I
> would like to replace your payload with something like this:
> 

Fine with me

The way I sent it is the way I need to have it to make it work with my
application it will be different with different applications so it's
better if it is more readable.

Philippe

Re: [PATCH] flood and content-type setting

Posted by Jacek Prucia <ja...@acn.waw.pl>.
On Wed, 28 Apr 2004 17:17:16 -0700
Justin Erenkrantz <ju...@erenkrantz.com> wrote:

> --On Thursday, April 15, 2004 12:22 PM +0200 Jacek Prucia 
> <ja...@acn.waw.pl> wrote:
> 
> > I have just commited a fix to manual. However, I do not have enough
> > karma to put manual on flood page, so we need a config file to make
> > people aware of new feature.
> 
> You do now.  ;-)  You should be able to modify httpd-site and
> httpd-dist as you see fit.

Thanks :)

I'll put Flood manual on-line as soon, as I get some free time. Maybe
automatic builds (read cron jobs) are also possible. I'll see if icarus
has everything installed (xslt processor, docbook etc.)

Write access to httpd-dist actually allows me to release flood-1.1
tarball. The only question is: is it really worth it? flood-1.1 tarball
is like 1 year old. I think it would be better to update STATUS with
"tagged, not released" and wait for next release.

regards,
--
Jacek Prucia


Re: [PATCH] flood and content-type setting

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Thursday, April 15, 2004 12:22 PM +0200 Jacek Prucia 
<ja...@acn.waw.pl> wrote:

> I have just commited a fix to manual. However, I do not have enough
> karma to put manual on flood page, so we need a config file to make
> people aware of new feature.

You do now.  ;-)  You should be able to modify httpd-site and httpd-dist as 
you see fit.

/me goes back to cave  -- justin

Re: [PATCH] flood and content-type setting

Posted by Jacek Prucia <ja...@acn.waw.pl>.
On Mon, 22 Mar 2004 11:58:25 +0100
Philippe Marzouk <ph...@ozigo.org> wrote:

> On Thu, Mar 18, 2004 at 10:29:39AM -0800, Aaron Bannert wrote:
[...]
> > Could you provide an example xml input file that I could stick
> > in the examples/ directory that shows usage of this new parameter?
> > 

I have just commited a fix to manual. However, I do not have enough
karma to put manual on flood page, so we need a config file to make
people aware of new feature.

> I attached a file with the way I use it.
> 
> I use it to test the upload of a file, in this case a text file
> containing 'toto' (a french friend of foobar) to an application
> developped by the company I work for. There are a few params taken
> from the fieldq in the web form and the included file.
> Obviously you need support for uploading on the application running on
> the web server.

Philippe,

Would you have something against a little simplification? Your example
payload has many parts, where I think two parts would be sufficient. I
would like to replace your payload with something like this:

-----------------------------18042893838469308861681692777
Content-Disposition: form-data;

foo=bar&bar=foo
-----------------------------18042893838469308861681692777
Content-Disposition: form-data; name="myFile"; filename="MyFile.dat"
Content-Type: application/octet-stram

<!-- few bytes encoded as XML entities (&#xxx;) -->
-----------------------------18042893838469308861681692777

...as a typical example (few form data fields, and file contents). Also
I would like to have payload with bare new lines (that is -- without
entities &#10; and &#13;). This would make such example more readable
for people not using fancy editors to read XML (me ;).

regards,
--
Jacek Prucia


Re: [PATCH] flood and content-type setting

Posted by Philippe Marzouk <ph...@ozigo.org>.
On Thu, Mar 18, 2004 at 10:29:39AM -0800, Aaron Bannert wrote:
> On Mon, Mar 15, 2004 at 09:13:45AM +0100, Philippe Marzouk wrote:
> > On Sun, Mar 14, 2004 at 05:27:16PM -0800, Aaron Bannert wrote:
> > > This sounds reasonable to me, did it ever get committed?
> > 
> > I imagine you asked the flood developers but I just did a cvs diff and
> > this patch was not committed.
> 
> Nope, I was just catching up on old mailings and wanted to see if
> this was ever addressed.
> 
> 
> I've committed it, thanks for the patch.
> 
> Could you provide an example xml input file that I could stick
> in the examples/ directory that shows usage of this new parameter?
> 

I attached a file with the way I use it.

I use it to test the upload of a file, in this case a text file
containing 'toto' (a french friend of foobar) to an application
developped by the company I work for. There are a few params taken from
the fieldq in the web form and the included file.
Obviously you need support for uploading on the application running on
the web server.

HTH,
Philippe

Re: [PATCH] flood and content-type setting

Posted by Aaron Bannert <aa...@clove.org>.
On Mon, Mar 15, 2004 at 09:13:45AM +0100, Philippe Marzouk wrote:
> On Sun, Mar 14, 2004 at 05:27:16PM -0800, Aaron Bannert wrote:
> > This sounds reasonable to me, did it ever get committed?
> 
> I imagine you asked the flood developers but I just did a cvs diff and
> this patch was not committed.

Nope, I was just catching up on old mailings and wanted to see if
this was ever addressed.


I've committed it, thanks for the patch.

Could you provide an example xml input file that I could stick
in the examples/ directory that shows usage of this new parameter?

-aaron

Re: [PATCH] flood and content-type setting

Posted by Philippe Marzouk <ph...@ozigo.org>.
On Sun, Mar 14, 2004 at 05:27:16PM -0800, Aaron Bannert wrote:
> This sounds reasonable to me, did it ever get committed?

I imagine you asked the flood developers but I just did a cvs diff and
this patch was not committed.

Philippe

Re: [PATCH] flood and content-type setting

Posted by Aaron Bannert <aa...@clove.org>.
This sounds reasonable to me, did it ever get committed?
-aaron

On Fri, Feb 13, 2004 at 09:44:15AM +0100, Philippe Marzouk wrote:
> 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. */