[httperf] Content-type patch for wsesslog

Arlitt, Martin martin.arlitt at hp.com
Fri Jun 1 06:06:02 PDT 2007


Hi Jaime

Thanks for the feedback and your patch.

Martin

> -----Original Message-----
> From: httperf-bounces at napali.hpl.hp.com [mailto:httperf-
> bounces at napali.hpl.hp.com] On Behalf Of Jaime Peñalba
> Sent: Thursday, May 31, 2007 9:27 PM
> To: httperf at napali.hpl.hp.com
> Cc: carter at hpl.hp.com
> Subject: [httperf] Content-type patch for wsesslog
> 
> Hi,
> 
> First of all, thanks to all the developers who contributed to httperf
> for this handy tool.
> 
> After playing a bit with httperf to see if it meets my needs for some
> http benchmarking, i found some weird behaviors at wsesslog when
> building POST commands.
> 
> Lets see the following example:
> 
> httperf -d 5 --server=www.pc-workshop.da.ru --wsesslog=1,1,content-test2
> 
> content-test2 contains the following text:
> ------- content-test2 START --------
> # session 1 definition
> /test.php method=POST contents="user=jaime&pass=password"
> ------- content-test2 END --------
> 
> test.php contains the following code:
> ------- test.php START --------
> <?php
> echo "user: ".$_POST['user']."<br>\n";
> echo "pass: ".$_POST['pass']."<br>\n";
> ?>
> ------- test.php END --------
> 
> Request is generated and sent fine, anyway the apache+php combo at my
> server ignores post contents.
> 
> ---- Debug START ----
> do_recv.0: received reply data:
>   0000: 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d  HTTP/1.1 200 OK.
>   0010: 0a 44 61 74 65 3a 20 46 72 69 2c 20 30 31 20 4a  .Date: Fri, 01 J
>   0020: 75 6e 20 32 30 30 37 20 30 34 3a 31 30 3a 34 30  un 2007 04:10:40
>   0030: 20 47 4d 54 0d 0a 53 65 72 76 65 72 3a 20 41 70   GMT..Server: Ap
>   0040: 61 63 68 65 0d 0a 58 2d 50 6f 77 65 72 65 64 2d  ache..X-Powered-
>   0050: 42 79 3a 20 50 48 50 2f 34 2e 34 2e 34 2d 38 2b  By: PHP/4.4.4-8+
>   0060: 65 74 63 68 33 0d 0a 43 6f 6e 74 65 6e 74 2d 4c  etch3..Content-L
>   0070: 65 6e 67 74 68 3a 20 32 34 0d 0a 43 6f 6e 74 65  ength: 24..Conte
>   0080: 6e 74 2d 54 79 70 65 3a 20 74 65 78 74 2f 68 74  nt-Type: text/ht
>   0090: 6d 6c 0d 0a 0d 0a 75 73 65 72 3a 20 3c 62 72 3e  ml....user: <br>
>   00a0: 0a 70 61 73 73 3a 20 3c 62 72 3e 0a 0a 0a        .pass: <br>...
> ---- Debug END ----
> 
> After some small research looking for differences between firefox post
> request and httperf, i found it was related to the lack of
> "Content-type" header at the request, so i added a small patch
> attached to this mail to support this header.
> 
> Now if desired, the file supplied to wsseslog can contain a ctype
> directive which may look like:
> ------- content-test2 START --------
> # session 1 definition
> /test.php method=POST ctype=application/x-www-form-urlencoded
> contents="user=jaime&pass=password"
> ------- content-test2 END --------
> 
> This way my server handles POST contents on the right way, producing
> the expected output:
> ---- Debug START ----
> do_recv.0: received reply data:
>   0000: 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d  HTTP/1.1 200 OK.
>   0010: 0a 44 61 74 65 3a 20 46 72 69 2c 20 30 31 20 4a  .Date: Fri, 01 J
>   0020: 75 6e 20 32 30 30 37 20 30 34 3a 31 37 3a 31 31  un 2007 04:17:11
>   0030: 20 47 4d 54 0d 0a 53 65 72 76 65 72 3a 20 41 70   GMT..Server: Ap
>   0040: 61 63 68 65 0d 0a 58 2d 50 6f 77 65 72 65 64 2d  ache..X-Powered-
>   0050: 42 79 3a 20 50 48 50 2f 34 2e 34 2e 34 2d 38 2b  By: PHP/4.4.4-8+
>   0060: 65 74 63 68 33 0d 0a 43 6f 6e 74 65 6e 74 2d 4c  etch3..Content-L
>   0070: 65 6e 67 74 68 3a 20 33 37 0d 0a 43 6f 6e 74 65  ength: 37..Conte
>   0080: 6e 74 2d 54 79 70 65 3a 20 74 65 78 74 2f 68 74  nt-Type: text/ht
>   0090: 6d 6c 0d 0a 0d 0a 75 73 65 72 3a 20 6a 61 69 6d  ml....user: jaim
>   00a0: 65 3c 62 72 3e 0a 70 61 73 73 3a 20 70 61 73 73  e<br>.pass: pass
>   00b0: 77 6f 72 64 3c 62 72 3e 0a 0a 0a                 word<br>...
> ---- Debug END ----
> 
> Patch code can be improved and probably a better way to handle maximum
> lengths for content-type and content-length can be achieved as the
> patch is just a proof of concept.
> 
> I hope this could help someone as its basic (at least for me) when
> trying to simulate sessions which use POST to authenticate and
> retrieve a valid cookie to be handled by the new --session-cookies
> option.
> 
> 
> Regards,
> Jaime.



More information about the httperf mailing list