[snip]
>> +#http.getbytes.type=default
>> +#http.getbytes.type=calculate_headers_size+default
>> +#http.getbytes.type=calculate_headers_size+content-length_value
>>
> These values are a bit complicated; I'd prefer to see true/false
> values if possible.
>
Ok I change this to 2 properties true/false.
>
>> + /**
>> + * Get Content-Length value from headers
>> + * @param headers
>> + * @return Content-Length value
>> + */
>> + public static int getHeaderContentLength(String headers) {
>> + LinkedHashMap<String, String> lhm =
>> JMeterUtils.parseHeaders(headers);
>> + Set<Entry<String, String>> keySet = lhm.entrySet();
>> + for (Entry<String, String> entry : keySet) {
>> + if (entry.getKey().equals(HEADER_CONTENT_LENGTH)) {
>> + return Integer.parseInt(entry.getValue());
>> + }
>> + }
>> + return 0; // Content-Length not found
>>
> This does not work for chunked input. It might be better to store the
> actual response size when receiving the response, rather than trying
> to calculate it later.
>
Ok, store in sampleresult when receiving the response. If 0 (no value),
the response data size is used.
With my last submission (r1088748), I try to respond to your feedback.
Please say me if another thing to improve.
Milamber
>
>> + * @see org.apache.jmeter.samplers.SampleResult#getBytes()
>> + */
>> + @Override
>> + public int getBytes() {
>> + if (GETBYTES_TYPE.equals(GETBYTES_TYPE_HEAD_CONTENTLENGTH)) {
>>
> The string comparison should be done once and turned into a static variable.
> But ideally change the properties to use separate variables for:
> - include header size in total
> - use actual length rather than decompressed length
>
>
>
>> + /**
>> + * Calculate response headers size
>> + *
>> + * @return the size response headers (in bytes)
>> + */
>> + private int calculateHeadersSize() {
>> + int headersSize = 0;
>> + headersSize += 9 // Http proto length + 1 space (i.e.: "HTTP/1.x ")
>> + + String.valueOf(this.getResponseCode()).length()
>> + + this.getResponseMessage().length();
>> + headersSize += this.getResponseHeaders().length();
>> + return headersSize;
>> + }
>>
> Again, maybe this can be done when the data is initially retrieved,
> and stored in the HttpSampleResult.
>
>> +
>> }
>>
>> Modified: jakarta/jmeter/trunk/xdocs/changes.xml
>> URL:
>> http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1088435&r1=1088434&r2=1088435&view=diff
>> ==============================================================================
>> --- jakarta/jmeter/trunk/xdocs/changes.xml (original)
>> +++ jakarta/jmeter/trunk/xdocs/changes.xml Sun Apr 3 23:13:09 2011
>> @@ -150,6 +150,7 @@ Fixed RMI startup to provide location of
>> <li>Allow HTTP implementation to be selected at run-time</li>
>> <li>Bug 50684 - Optionally disable Content-Type and Transfer-Encoding in
>> Multipart POST</li>
>> <li>Bug 50943 - Allowing concurrent downloads of embedded resources in html
>> page</li>
>> +<li>Bug 50170 - Bytes reported by http sampler is after GUnZip<br></br>Add
>> an optional property to allow change the method to get response size</li>
>> </ul>
>>
>> <h3>Other samplers</h3>
>>
>> Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
>> URL:
>> http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1088435&r1=1088434&r2=1088435&view=diff
>> ==============================================================================
>> --- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
>> +++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Sun Apr 3
>> 23:13:09 2011
>> @@ -333,6 +333,16 @@ The HttpClient version of the sampler su
>> #httpclient.socket.http.cps=0
>> #httpclient.socket.https.cps=0
>> </pre>
>> +<p><b>Method to calculate Response size</b><br></br>
>> +An optional property to allow change the method to get response
>> size:<br></br>
>> +<ul><li>Default behavior: Size in bytes is the response data length
>> (without response headers)
>> +<pre>http.getbytes.type=default</pre></li>
>> +<li>Response headers length and default (response data length)
>> +<pre>http.getbytes.type=calculate_headers_size+default</pre></li>
>> +<li>Response headers length and value of "Content-length" header (generally
>> provide by web server)<br></br>
>> +Useful when web server uses a deflate/gzip method to compress response data
>> +<pre>http.getbytes.type=calculate_headers_size+content-length_value</pre></li></ul>
>> +</p>
>> <links>
>> <link href="test_plan.html#assertions">Assertion</link>
>> <link href="build-web-test-plan.html">Building a Web Test Plan</link>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]