> [I sent this to the users list on Friday - someone sent me email
>  telling me I should send it to this group - sorry for the double
>  post]
>
> I just started using TomCat B5 using the builtin HTTPConnector.
> When POST-ing a form, none of the name-value pairs of the
> "Query string" make it through.
>
> I found the below minor logic bug, and it now is working for me.
>
> --- HttpRequestBase.java.orig   Fri May 18 16:36:30 2001
> +++ HttpRequestBase.java        Fri May 18 16:39:40 2001
> @@ -616,7 +616,7 @@
>          if (semicolon >= 0)
>              contentType = contentType.substring(0, semicolon).trim();
>         if ("POST".equals(getMethod()) && (getContentLength() > 0)
> -            && (this.stream == null)
> +            && (this.stream != null)
>             && "application/x-www-form-urlencoded".equals(contentType)) {
>             try {
>                  int max = getContentLength();

Reading the URL parameters is done just above :
 // Parse any parameters specified in the query string
 String queryString = getQueryString();
        try {
            RequestUtil.parseParameters(results, queryString, encoding);
        } catch (Throwable t) {
        }

This is for reading parameters in the body of the post. The test means that
if the servlet accessed the stream, we should not attempt to parse the
parameters.
The test is a bit too strict (we could check if bytes have been read from
the stream instead), but that's it.
You should check if you don't call getInputStream in your servlet before
calling getParameters.

Remy

Reply via email to