https://issues.apache.org/bugzilla/show_bug.cgi?id=44784

           Summary: Web Proxy does not handle malformed Content Type
                    gracefully
           Product: JMeter
           Version: Nightly (Please specify date)
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P3
         Component: HTTP
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


I was using the Web Proxy to capture a transaction on a website that was
sending malformed ContentType in the response. The content type was of the
format: charset=x;charset=x.

After extraction the store of the sample failed showing a 503 error on the
browser and a UnsupportedEncoding exception in the log (the encoding being
passed to the String constructor being of the form "x;charset=x").

Looking into the error I saw that the problem was occurring in the
Proxy.getContentEncoding method. I also noticed that there were three
getContentEncoding methods at different levels (document, etc) all of which use
slightly different versions of the indexOf followed by substring index strategy
for extraction.

I solved my problem by using the regexp below and defaulting to the platform
encoding if the expression does not match.

Pattern p = Pattern.compile("charset=([\\d\\w-]+)");

This simply extracted the first sequence in the charset.

I think the Proxy needs to be more forgiving in its parsing of the Content-Type
and if it is malformed use a sensible default as browsers do. I also think that
the Content Type extractor should check whether the coding extracted is
actually one supported by the Java platform that is running JMeter. It is
easier to debug if the failure occurs closer to the source of the problem
instead of failing on the store of the Sampler.

This problem occurred on an SVN tip build of 28th of March and is still
occurring as far as I know.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to