You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by Alf Høgemark <al...@i100.no> on 2007/03/23 23:54:50 UTC

Proposal of rewrite of HTTP POST handling code in HttpSampler andHttpSampler2

Hi

I'm working to solve the following bugs for HTTP POST request handling :
27780, 33435, 41518, 25753, 38287, 41305, 41705, and 41837 (and maybe 38115)
and in the near future : 19128

With those bugs solved, I would then move on to improving the HTTP Proxy 
server, so that it handles HTTP POSTing better.
There seems to be several people who have problems with the "http post" 
requests that the http proxy server are creating.

Basically, this boils down to fixing / adding functionality for doing 
HTTP POST application/x-www-url-encoded and multipart/form-data requests.
And making sure that HTTP POST works correctly for iso-8859-1, us-ascii, 
utf-8 and other encodings.

I think this requires rewriting and restructuring the HTTP POST handling 
of the "HTTP Request" and "HTTP Request httpclient" samplers.
I have a patch that is 85-90% ready, which is solving most of the bugs 
mentioned above, I want to do some more testing, and reviewing my code 
once more.
I especially want to add a number of unit tests.

I'm writing this mail now, because I want your feedback on how to best 
proceed.
Since this is changing the code that is doing http post request, it is 
important to get this correct, so I think it would be important to get a 
review for several people.

Should I attach the patch as it is now, to one of the bugs, probably 
27780, so you can review it ? Or should I just attach it in a mail in 
reply to this mail ?
Would someone be willing to review the code, or to apply the patch and 
do some testing, especially if they have "http post" cases which are 
currently not working.

Or should I wait until I think I am 100% done before attaching the patch 
to one of the bug reports ?

Highlights of the patch, in my opinion :
- multipart/form-data working also when you are not uploading file, this 
is needed for apps that demands "multipart/form-data" data
- request headers set correctly, and parameter values encoded correctly, 
so that it should work with any encoding
- content-type and content-length headers are now part of the request
- the sample created now contains the actual multipart data, except the 
actual file content uploaded. This allows you to see the details of the 
request, for example in the "View Results Tree"
- should make it simple to enhance the http proxy server to support more 
http post functionality
- httpsampler and httpsampler2 using the same default encoding if no 
content encoding is specified

Regards
Alf Hogemark


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Proposal of rewrite of HTTP POST handling code in HttpSamplerandHttpSampler2

Posted by sebb <se...@gmail.com>.
On 02/04/07, Alf Høgemark <al...@i100.no> wrote:
> Hi
>
> I must admit I did not know about the "batch tests".

If you run the batchtest Ant target it  will run the only batchtest.

> I'll try to look more into those.
> It sounds like you are going to do some work on it. Let me know if I can
> help.

Thanks, but there's not much to it.

> I agree that it sounds like that approach would make it easier to create
> tests.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Proposal of rewrite of HTTP POST handling code in HttpSamplerandHttpSampler2

Posted by Alf Høgemark <al...@i100.no>.
Hi

I must admit I did not know about the "batch tests".
I'll try to look more into those.
It sounds like you are going to do some work on it. Let me know if I can 
help.
I agree that it sounds like that approach would make it easier to create 
tests.

Regards
Alf Hogemark



sebb wrote:
> Sorry it took a long time to get round to it.
>
> As to unit tests, it might be worth extending the existing batch test
> (or writing another) rather than creating JUnit tests - though these
> are good too.
>
> I'm thinking of adding a property to automatically start the Mirror
> Server on a particular port (c.f. the BeanShell server). This would
> then be available to automated test cases. One would need to add a
> Listener to record the response, and compare with the expected one; or
> one could use Assertions. Or indeed enhance the Mirror server to save
> the request as a file.
>
> I think such tests would be easier to develop once the structure is in 
> place.
>
> S.
> On 02/04/07, Alf Høgemark <al...@i100.no> wrote:
>> Thank you.
>>
>> I will look into your issues, and come back with answers and corrections
>> as needed.
>> I will also look into adding a few more unit tests, and then move on to
>> improving HTTP Proxy Server.
>>
>> Regards
>> Alf Hogemark
>>
>> sebb wrote:
>> > Finally got around to applying the additional test cases (for the
>> > original code) and then the Post updates.
>> >
>> > I had to make quite a few changes to the testcases to allow for the
>> > new headers etc; I assume these were in the one of the other test case
>> > patches, so hopefully I have not omitted any test cases.
>> >
>> > One thing I noticed was the encoding is given as ISO-8859-1 in the
>> > test cases, whereas elsewhere it is usually iso-8859-1. Not sure which
>> > is "standard" if either.
>> >
>> > Also, the HTTP Sampler now adds the header:
>> >  Content-Transfer-Encoding: 8bit
>> > whereas HTTPClient adds:
>> > Content-Transfer-Encoding: binary
>> >
>> > Maybe that should be standardised.
>> >
>> > S
>> > On 30/03/07, Alf Høgemark <al...@i100.no> wrote:
>> >>
>> >> Hi
>> >>
>> >> As you have perhaps noticed, I've updated the bugzilla issue 27780 
>> with
>> >> unit tests as described in emails below.
>> >> I have not added commons-fileupload, I think the unit tests are doing
>> >> useful testing without using commons-fileupload.
>> >>
>> >> Some of the unit tests are utilizing the HTTP Mirror server, and 
>> there
>> >> are also tests which are using variables as parameter values.
>> >>
>> >> So the issue 27780 now contains the patch for new HTTP Post
>> >> functionality, and unit tests for the new functionality, and for the
>> >> current functionality.
>> >> I don't think I can contribute more on this issue, until I get some
>> >> feedback on what more to do, or what to improve on the patches.
>> >>
>> >> I'm starting on enhancing the HTTP Proxy server to use the new 
>> HTTP Post
>> >> handling functionality now. I will make a new bugzilla entry for 
>> that,
>> >> and add patches when I'm ready
>> >> with some new functionality for the HTTP Proxy server.
>> >>
>> >> Regards
>> >> Alf Hogemark
>> >>
>> >>
>> >> Alf Høgemark wrote:
>> >> >
>> >> > sebb wrote:
>> >> >> Sorry, not had a chance to look at this in any detail yet.
>> >> >>
>> >> >> Given that these are fairly big changes, I think the first 
>> thing that
>> >> >> needs to be done is to create the test cases.
>> >> >
>> >> > I agree, I'm working on writing test cases now.
>> >> >
>> >> > How do you feel about adding commons-fileupload-1.2.jar as part 
>> of the
>> >> > unit tests I'm writing.
>> >> > I think it would be useful to use that code to "decode" 
>> "requests", to
>> >> > check that everything looks correct.
>> >> > It would only be needed as part of running unit tests, not as 
>> part of
>> >> > running Jmeter itself.
>> >> >
>> >> > This is of course in addition to low level unit tests along the 
>> lines
>> >> > you describe.
>> >> >
>> >> >>
>> >> >> There should be some that succeed (i.e. current code is OK), 
>> and some
>> >> >> that fail (i.e. where current behaviour is wrong).
>> >> >>
>> >> >> In particular, I think there need to be test cases for parameters
>> >> that
>> >> >> are specified as variables/functions - this is quite a complicated
>> >> >> area.
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
>> >> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Proposal of rewrite of HTTP POST handling code in HttpSamplerandHttpSampler2

Posted by sebb <se...@gmail.com>.
Sorry it took a long time to get round to it.

As to unit tests, it might be worth extending the existing batch test
(or writing another) rather than creating JUnit tests - though these
are good too.

I'm thinking of adding a property to automatically start the Mirror
Server on a particular port (c.f. the BeanShell server). This would
then be available to automated test cases. One would need to add a
Listener to record the response, and compare with the expected one; or
one could use Assertions. Or indeed enhance the Mirror server to save
the request as a file.

I think such tests would be easier to develop once the structure is in place.

S.
On 02/04/07, Alf Høgemark <al...@i100.no> wrote:
> Thank you.
>
> I will look into your issues, and come back with answers and corrections
> as needed.
> I will also look into adding a few more unit tests, and then move on to
> improving HTTP Proxy Server.
>
> Regards
> Alf Hogemark
>
> sebb wrote:
> > Finally got around to applying the additional test cases (for the
> > original code) and then the Post updates.
> >
> > I had to make quite a few changes to the testcases to allow for the
> > new headers etc; I assume these were in the one of the other test case
> > patches, so hopefully I have not omitted any test cases.
> >
> > One thing I noticed was the encoding is given as ISO-8859-1 in the
> > test cases, whereas elsewhere it is usually iso-8859-1. Not sure which
> > is "standard" if either.
> >
> > Also, the HTTP Sampler now adds the header:
> >  Content-Transfer-Encoding: 8bit
> > whereas HTTPClient adds:
> > Content-Transfer-Encoding: binary
> >
> > Maybe that should be standardised.
> >
> > S
> > On 30/03/07, Alf Høgemark <al...@i100.no> wrote:
> >>
> >> Hi
> >>
> >> As you have perhaps noticed, I've updated the bugzilla issue 27780 with
> >> unit tests as described in emails below.
> >> I have not added commons-fileupload, I think the unit tests are doing
> >> useful testing without using commons-fileupload.
> >>
> >> Some of the unit tests are utilizing the HTTP Mirror server, and there
> >> are also tests which are using variables as parameter values.
> >>
> >> So the issue 27780 now contains the patch for new HTTP Post
> >> functionality, and unit tests for the new functionality, and for the
> >> current functionality.
> >> I don't think I can contribute more on this issue, until I get some
> >> feedback on what more to do, or what to improve on the patches.
> >>
> >> I'm starting on enhancing the HTTP Proxy server to use the new HTTP Post
> >> handling functionality now. I will make a new bugzilla entry for that,
> >> and add patches when I'm ready
> >> with some new functionality for the HTTP Proxy server.
> >>
> >> Regards
> >> Alf Hogemark
> >>
> >>
> >> Alf Høgemark wrote:
> >> >
> >> > sebb wrote:
> >> >> Sorry, not had a chance to look at this in any detail yet.
> >> >>
> >> >> Given that these are fairly big changes, I think the first thing that
> >> >> needs to be done is to create the test cases.
> >> >
> >> > I agree, I'm working on writing test cases now.
> >> >
> >> > How do you feel about adding commons-fileupload-1.2.jar as part of the
> >> > unit tests I'm writing.
> >> > I think it would be useful to use that code to "decode" "requests", to
> >> > check that everything looks correct.
> >> > It would only be needed as part of running unit tests, not as part of
> >> > running Jmeter itself.
> >> >
> >> > This is of course in addition to low level unit tests along the lines
> >> > you describe.
> >> >
> >> >>
> >> >> There should be some that succeed (i.e. current code is OK), and some
> >> >> that fail (i.e. where current behaviour is wrong).
> >> >>
> >> >> In particular, I think there need to be test cases for parameters
> >> that
> >> >> are specified as variables/functions - this is quite a complicated
> >> >> area.
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Proposal of rewrite of HTTP POST handling code in HttpSamplerandHttpSampler2

Posted by Alf Høgemark <al...@i100.no>.
Thank you.

I will look into your issues, and come back with answers and corrections 
as needed.
I will also look into adding a few more unit tests, and then move on to 
improving HTTP Proxy Server.

Regards
Alf Hogemark

sebb wrote:
> Finally got around to applying the additional test cases (for the
> original code) and then the Post updates.
>
> I had to make quite a few changes to the testcases to allow for the
> new headers etc; I assume these were in the one of the other test case
> patches, so hopefully I have not omitted any test cases.
>
> One thing I noticed was the encoding is given as ISO-8859-1 in the
> test cases, whereas elsewhere it is usually iso-8859-1. Not sure which
> is "standard" if either.
>
> Also, the HTTP Sampler now adds the header:
>  Content-Transfer-Encoding: 8bit
> whereas HTTPClient adds:
> Content-Transfer-Encoding: binary
>
> Maybe that should be standardised.
>
> S
> On 30/03/07, Alf Høgemark <al...@i100.no> wrote:
>>
>> Hi
>>
>> As you have perhaps noticed, I've updated the bugzilla issue 27780 with
>> unit tests as described in emails below.
>> I have not added commons-fileupload, I think the unit tests are doing
>> useful testing without using commons-fileupload.
>>
>> Some of the unit tests are utilizing the HTTP Mirror server, and there
>> are also tests which are using variables as parameter values.
>>
>> So the issue 27780 now contains the patch for new HTTP Post
>> functionality, and unit tests for the new functionality, and for the
>> current functionality.
>> I don't think I can contribute more on this issue, until I get some
>> feedback on what more to do, or what to improve on the patches.
>>
>> I'm starting on enhancing the HTTP Proxy server to use the new HTTP Post
>> handling functionality now. I will make a new bugzilla entry for that,
>> and add patches when I'm ready
>> with some new functionality for the HTTP Proxy server.
>>
>> Regards
>> Alf Hogemark
>>
>>
>> Alf Høgemark wrote:
>> >
>> > sebb wrote:
>> >> Sorry, not had a chance to look at this in any detail yet.
>> >>
>> >> Given that these are fairly big changes, I think the first thing that
>> >> needs to be done is to create the test cases.
>> >
>> > I agree, I'm working on writing test cases now.
>> >
>> > How do you feel about adding commons-fileupload-1.2.jar as part of the
>> > unit tests I'm writing.
>> > I think it would be useful to use that code to "decode" "requests", to
>> > check that everything looks correct.
>> > It would only be needed as part of running unit tests, not as part of
>> > running Jmeter itself.
>> >
>> > This is of course in addition to low level unit tests along the lines
>> > you describe.
>> >
>> >>
>> >> There should be some that succeed (i.e. current code is OK), and some
>> >> that fail (i.e. where current behaviour is wrong).
>> >>
>> >> In particular, I think there need to be test cases for parameters 
>> that
>> >> are specified as variables/functions - this is quite a complicated
>> >> area.
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Proposal of rewrite of HTTP POST handling code in HttpSamplerandHttpSampler2

Posted by sebb <se...@gmail.com>.
On 02/04/07, Alf Høgemark <al...@i100.no> wrote:
> Hi
>
> I've checked the unit tests in SVN, and the
> TestHTTPSamplersAgainstHttpMirrorServer still had some tests commented out.

Forgot about that.

> I've made a patch for enabling all the unit tests, and also adding unit
> tests for file upload.
>
> On the "ISO-8859-1" / "iso-8859-1", I think it is most common to use
> uppercase.

OK.

> The "Content-Transfer-Encoding: 8bit" for PostWriter was a bug, thanks
> for spotting that.
>
> I've updated bugzilla 27780 with a patch which solves the issues I
> describe above.

OK.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Proposal of rewrite of HTTP POST handling code in HttpSamplerandHttpSampler2

Posted by Alf Høgemark <al...@i100.no>.
Hi

I've checked the unit tests in SVN, and the 
TestHTTPSamplersAgainstHttpMirrorServer still had some tests commented out.
I've made a patch for enabling all the unit tests, and also adding unit 
tests for file upload.

On the "ISO-8859-1" / "iso-8859-1", I think it is most common to use 
uppercase.

The "Content-Transfer-Encoding: 8bit" for PostWriter was a bug, thanks 
for spotting that.

I've updated bugzilla 27780 with a patch which solves the issues I 
describe above.

Regards
Alf Hogemark

sebb wrote:
> Finally got around to applying the additional test cases (for the
> original code) and then the Post updates.
>
> I had to make quite a few changes to the testcases to allow for the
> new headers etc; I assume these were in the one of the other test case
> patches, so hopefully I have not omitted any test cases.
>
> One thing I noticed was the encoding is given as ISO-8859-1 in the
> test cases, whereas elsewhere it is usually iso-8859-1. Not sure which
> is "standard" if either.
>
> Also, the HTTP Sampler now adds the header:
>  Content-Transfer-Encoding: 8bit
> whereas HTTPClient adds:
> Content-Transfer-Encoding: binary
>
> Maybe that should be standardised.
>
> S
> On 30/03/07, Alf Høgemark <al...@i100.no> wrote:
>>
>> Hi
>>
>> As you have perhaps noticed, I've updated the bugzilla issue 27780 with
>> unit tests as described in emails below.
>> I have not added commons-fileupload, I think the unit tests are doing
>> useful testing without using commons-fileupload.
>>
>> Some of the unit tests are utilizing the HTTP Mirror server, and there
>> are also tests which are using variables as parameter values.
>>
>> So the issue 27780 now contains the patch for new HTTP Post
>> functionality, and unit tests for the new functionality, and for the
>> current functionality.
>> I don't think I can contribute more on this issue, until I get some
>> feedback on what more to do, or what to improve on the patches.
>>
>> I'm starting on enhancing the HTTP Proxy server to use the new HTTP Post
>> handling functionality now. I will make a new bugzilla entry for that,
>> and add patches when I'm ready
>> with some new functionality for the HTTP Proxy server.
>>
>> Regards
>> Alf Hogemark
>>
>>
>> Alf Høgemark wrote:
>> >
>> > sebb wrote:
>> >> Sorry, not had a chance to look at this in any detail yet.
>> >>
>> >> Given that these are fairly big changes, I think the first thing that
>> >> needs to be done is to create the test cases.
>> >
>> > I agree, I'm working on writing test cases now.
>> >
>> > How do you feel about adding commons-fileupload-1.2.jar as part of the
>> > unit tests I'm writing.
>> > I think it would be useful to use that code to "decode" "requests", to
>> > check that everything looks correct.
>> > It would only be needed as part of running unit tests, not as part of
>> > running Jmeter itself.
>> >
>> > This is of course in addition to low level unit tests along the lines
>> > you describe.
>> >
>> >>
>> >> There should be some that succeed (i.e. current code is OK), and some
>> >> that fail (i.e. where current behaviour is wrong).
>> >>
>> >> In particular, I think there need to be test cases for parameters 
>> that
>> >> are specified as variables/functions - this is quite a complicated
>> >> area.
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Proposal of rewrite of HTTP POST handling code in HttpSamplerand HttpSampler2

Posted by sebb <se...@gmail.com>.
Finally got around to applying the additional test cases (for the
original code) and then the Post updates.

I had to make quite a few changes to the testcases to allow for the
new headers etc; I assume these were in the one of the other test case
patches, so hopefully I have not omitted any test cases.

One thing I noticed was the encoding is given as ISO-8859-1 in the
test cases, whereas elsewhere it is usually iso-8859-1. Not sure which
is "standard" if either.

Also, the HTTP Sampler now adds the header:
  Content-Transfer-Encoding: 8bit
whereas HTTPClient adds:
 Content-Transfer-Encoding: binary

Maybe that should be standardised.

S
On 30/03/07, Alf Høgemark <al...@i100.no> wrote:
>
> Hi
>
> As you have perhaps noticed, I've updated the bugzilla issue 27780 with
> unit tests as described in emails below.
> I have not added commons-fileupload, I think the unit tests are doing
> useful testing without using commons-fileupload.
>
> Some of the unit tests are utilizing the HTTP Mirror server, and there
> are also tests which are using variables as parameter values.
>
> So the issue 27780 now contains the patch for new HTTP Post
> functionality, and unit tests for the new functionality, and for the
> current functionality.
> I don't think I can contribute more on this issue, until I get some
> feedback on what more to do, or what to improve on the patches.
>
> I'm starting on enhancing the HTTP Proxy server to use the new HTTP Post
> handling functionality now. I will make a new bugzilla entry for that,
> and add patches when I'm ready
> with some new functionality for the HTTP Proxy server.
>
> Regards
> Alf Hogemark
>
>
> Alf Høgemark wrote:
> >
> > sebb wrote:
> >> Sorry, not had a chance to look at this in any detail yet.
> >>
> >> Given that these are fairly big changes, I think the first thing that
> >> needs to be done is to create the test cases.
> >
> > I agree, I'm working on writing test cases now.
> >
> > How do you feel about adding commons-fileupload-1.2.jar as part of the
> > unit tests I'm writing.
> > I think it would be useful to use that code to "decode" "requests", to
> > check that everything looks correct.
> > It would only be needed as part of running unit tests, not as part of
> > running Jmeter itself.
> >
> > This is of course in addition to low level unit tests along the lines
> > you describe.
> >
> >>
> >> There should be some that succeed (i.e. current code is OK), and some
> >> that fail (i.e. where current behaviour is wrong).
> >>
> >> In particular, I think there need to be test cases for parameters that
> >> are specified as variables/functions - this is quite a complicated
> >> area.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Proposal of rewrite of HTTP POST handling code in HttpSamplerand HttpSampler2

Posted by Alf Høgemark <al...@i100.no>.
Hi

As you have perhaps noticed, I've updated the bugzilla issue 27780 with 
unit tests as described in emails below.
I have not added commons-fileupload, I think the unit tests are doing 
useful testing without using commons-fileupload.

Some of the unit tests are utilizing the HTTP Mirror server, and there 
are also tests which are using variables as parameter values.

So the issue 27780 now contains the patch for new HTTP Post 
functionality, and unit tests for the new functionality, and for the 
current functionality.
I don't think I can contribute more on this issue, until I get some 
feedback on what more to do, or what to improve on the patches.

I'm starting on enhancing the HTTP Proxy server to use the new HTTP Post 
handling functionality now. I will make a new bugzilla entry for that, 
and add patches when I'm ready
with some new functionality for the HTTP Proxy server.

Regards
Alf Hogemark


Alf Høgemark wrote:
>
> sebb wrote:
>> Sorry, not had a chance to look at this in any detail yet.
>>
>> Given that these are fairly big changes, I think the first thing that
>> needs to be done is to create the test cases.
>
> I agree, I'm working on writing test cases now.
>
> How do you feel about adding commons-fileupload-1.2.jar as part of the 
> unit tests I'm writing.
> I think it would be useful to use that code to "decode" "requests", to 
> check that everything looks correct.
> It would only be needed as part of running unit tests, not as part of 
> running Jmeter itself.
>
> This is of course in addition to low level unit tests along the lines 
> you describe.
>
>>
>> There should be some that succeed (i.e. current code is OK), and some
>> that fail (i.e. where current behaviour is wrong).
>>
>> In particular, I think there need to be test cases for parameters that
>> are specified as variables/functions - this is quite a complicated
>> area.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Proposal of rewrite of HTTP POST handling code in HttpSamplerandHttpSampler2

Posted by Alf Høgemark <al...@i100.no>.
sebb wrote:
> Sorry, not had a chance to look at this in any detail yet.
>
> Given that these are fairly big changes, I think the first thing that
> needs to be done is to create the test cases.

I agree, I'm working on writing test cases now.

How do you feel about adding commons-fileupload-1.2.jar as part of the 
unit tests I'm writing.
I think it would be useful to use that code to "decode" "requests", to 
check that everything looks correct.
It would only be needed as part of running unit tests, not as part of 
running Jmeter itself.

This is of course in addition to low level unit tests along the lines 
you describe.

>
> There should be some that succeed (i.e. current code is OK), and some
> that fail (i.e. where current behaviour is wrong).
>
> In particular, I think there need to be test cases for parameters that
> are specified as variables/functions - this is quite a complicated
> area.
Do you have any example unit tests in other areas that are using 
parameters that are variables / functions ?
>
> S
>
Regards
Alf Hogemark

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Proposal of rewrite of HTTP POST handling code in HttpSamplerandHttpSampler2

Posted by sebb <se...@gmail.com>.
Sorry, not had a chance to look at this in any detail yet.

Given that these are fairly big changes, I think the first thing that
needs to be done is to create the test cases.

There should be some that succeed (i.e. current code is OK), and some
that fail (i.e. where current behaviour is wrong).

In particular, I think there need to be test cases for parameters that
are specified as variables/functions - this is quite a complicated
area.

S
On 24/03/07, Alf Høgemark <al...@i100.no> wrote:
> Hi
>
> I have now attached the patch to bugzilla bug 27780  (
> http://issues.apache.org/bugzilla/show_bug.cgi?id=27780 )
>
> I think this patch has potential for solving a number of issues related
> to HTTP POST handling.
> But please have a review of the code, and ask and comment about the code.
> Any comments are appreciated.
>
> I had ideas on how to restructure the code even more, but I think this
> is a good starting point for discussions.
>
> I'll also look into making some automated tests for HTTP POST handling,
> and possibly a patch to the HTTP Proxy Server, to use the new http post
> functionality, because that could make it easier for people to test if
> this patch solves some of their problems.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Proposal of rewrite of HTTP POST handling code in HttpSamplerandHttpSampler2

Posted by Alf Høgemark <al...@i100.no>.
Hi

I have now attached the patch to bugzilla bug 27780  ( 
http://issues.apache.org/bugzilla/show_bug.cgi?id=27780 )

I think this patch has potential for solving a number of issues related 
to HTTP POST handling.
But please have a review of the code, and ask and comment about the code.
Any comments are appreciated.

I had ideas on how to restructure the code even more, but I think this 
is a good starting point for discussions.

I'll also look into making some automated tests for HTTP POST handling, 
and possibly a patch to the HTTP Proxy Server, to use the new http post 
functionality, because that could make it easier for people to test if 
this patch solves some of their problems.

Regards
Alf Hogemark

sebb wrote:
> On 23/03/07, Alf Høgemark <al...@i100.no> wrote:
>>
>> Hi
>>
>> I'm working to solve the following bugs for HTTP POST request handling :
>> 27780, 33435, 41518, 25753, 38287, 41305, 41705, and 41837 (and maybe 
>> 38115)
>> and in the near future : 19128
>
> That would be great.
>
>> With those bugs solved, I would then move on to improving the HTTP Proxy
>> server, so that it handles HTTP POSTing better.
>> There seems to be several people who have problems with the "http post"
>> requests that the http proxy server are creating.
>
> Agreed.
>
>> Basically, this boils down to fixing / adding functionality for doing
>> HTTP POST application/x-www-url-encoded and multipart/form-data 
>> requests.
>> And making sure that HTTP POST works correctly for iso-8859-1, us-ascii,
>> utf-8 and other encodings.
>>
>> I think this requires rewriting and restructuring the HTTP POST handling
>> of the "HTTP Request" and "HTTP Request httpclient" samplers.
>
> OK, so long as the protected/public API does not change.
>
>> I have a patch that is 85-90% ready, which is solving most of the bugs
>> mentioned above, I want to do some more testing, and reviewing my code
>> once more.
>> I especially want to add a number of unit tests.
>
> Yes, very important.
>
> Now that there is a functioning Mirror Server, it could potentially be
> added to unit tests (just need to add a way of starting it from
> batch). This could be useful in developing HTTP unit tests - perhaps
> in conjunction with the Save Responses Post-Processor so the files
> could be compared as for the existing batch test.
>
>> I'm writing this mail now, because I want your feedback on how to best
>> proceed.
>> Since this is changing the code that is doing http post request, it is
>> important to get this correct, so I think it would be important to get a
>> review for several people.
>
> That would be good - hopefully some others will chip in.
>
>> Should I attach the patch as it is now, to one of the bugs, probably
>> 27780, so you can review it ? Or should I just attach it in a mail in
>> reply to this mail ?
>
> Bugzilla attachments are best; mailed attachments can be dropped or 
> forgotten.
>
>> Would someone be willing to review the code, or to apply the patch and
>> do some testing, especially if they have "http post" cases which are
>> currently not working.
>>
>> Or should I wait until I think I am 100% done before attaching the patch
>> to one of the bug reports ?
>
> So long as the patch is an improvement, it can be applied - it does
> not have to fix everything all at once.
>
>> Highlights of the patch, in my opinion :
>> - multipart/form-data working also when you are not uploading file, this
>> is needed for apps that demands "multipart/form-data" data
>> - request headers set correctly, and parameter values encoded correctly,
>> so that it should work with any encoding
>> - content-type and content-length headers are now part of the request
>> - the sample created now contains the actual multipart data, except the
>> actual file content uploaded. This allows you to see the details of the
>> request, for example in the "View Results Tree"
>> - should make it simple to enhance the http proxy server to support more
>> http post functionality
>> - httpsampler and httpsampler2 using the same default encoding if no
>> content encoding is specified
>
> If there is common code, presumably it can go into HTTPSamplerBase.
>
>> Regards
>> Alf Hogemark
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Proposal of rewrite of HTTP POST handling code in HttpSamplerandHttpSampler2

Posted by Alf Høgemark <al...@i100.no>.
Just a short comment to the unit testing.
Your suggestion of using the Mirror Server sounds like a great idea.
I am also looking into using the httpclient "fileupload" functionality, 
to see if I can use that to "decode" the HTTP post request made in a 
unit test, so that I can use the httpclient "fileupload" to see that I 
get what I expect.

Regards
Alf Hogemark

>
>> I have a patch that is 85-90% ready, which is solving most of the bugs
>> mentioned above, I want to do some more testing, and reviewing my code
>> once more.
>> I especially want to add a number of unit tests.
>
> Yes, very important.
>
> Now that there is a functioning Mirror Server, it could potentially be
> added to unit tests (just need to add a way of starting it from
> batch). This could be useful in developing HTTP unit tests - perhaps
> in conjunction with the Save Responses Post-Processor so the files
> could be compared as for the existing batch test.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Re: Proposal of rewrite of HTTP POST handling code in HttpSampler andHttpSampler2

Posted by sebb <se...@gmail.com>.
On 23/03/07, Alf Høgemark <al...@i100.no> wrote:
>
> Hi
>
> I'm working to solve the following bugs for HTTP POST request handling :
> 27780, 33435, 41518, 25753, 38287, 41305, 41705, and 41837 (and maybe 38115)
> and in the near future : 19128

That would be great.

> With those bugs solved, I would then move on to improving the HTTP Proxy
> server, so that it handles HTTP POSTing better.
> There seems to be several people who have problems with the "http post"
> requests that the http proxy server are creating.

Agreed.

> Basically, this boils down to fixing / adding functionality for doing
> HTTP POST application/x-www-url-encoded and multipart/form-data requests.
> And making sure that HTTP POST works correctly for iso-8859-1, us-ascii,
> utf-8 and other encodings.
>
> I think this requires rewriting and restructuring the HTTP POST handling
> of the "HTTP Request" and "HTTP Request httpclient" samplers.

OK, so long as the protected/public API does not change.

> I have a patch that is 85-90% ready, which is solving most of the bugs
> mentioned above, I want to do some more testing, and reviewing my code
> once more.
> I especially want to add a number of unit tests.

Yes, very important.

Now that there is a functioning Mirror Server, it could potentially be
added to unit tests (just need to add a way of starting it from
batch). This could be useful in developing HTTP unit tests - perhaps
in conjunction with the Save Responses Post-Processor so the files
could be compared as for the existing batch test.

> I'm writing this mail now, because I want your feedback on how to best
> proceed.
> Since this is changing the code that is doing http post request, it is
> important to get this correct, so I think it would be important to get a
> review for several people.

That would be good - hopefully some others will chip in.

> Should I attach the patch as it is now, to one of the bugs, probably
> 27780, so you can review it ? Or should I just attach it in a mail in
> reply to this mail ?

Bugzilla attachments are best; mailed attachments can be dropped or forgotten.

> Would someone be willing to review the code, or to apply the patch and
> do some testing, especially if they have "http post" cases which are
> currently not working.
>
> Or should I wait until I think I am 100% done before attaching the patch
> to one of the bug reports ?

So long as the patch is an improvement, it can be applied - it does
not have to fix everything all at once.

> Highlights of the patch, in my opinion :
> - multipart/form-data working also when you are not uploading file, this
> is needed for apps that demands "multipart/form-data" data
> - request headers set correctly, and parameter values encoded correctly,
> so that it should work with any encoding
> - content-type and content-length headers are now part of the request
> - the sample created now contains the actual multipart data, except the
> actual file content uploaded. This allows you to see the details of the
> request, for example in the "View Results Tree"
> - should make it simple to enhance the http proxy server to support more
> http post functionality
> - httpsampler and httpsampler2 using the same default encoding if no
> content encoding is specified

If there is common code, presumably it can go into HTTPSamplerBase.

> Regards
> Alf Hogemark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org