It is already fixed in 2.0.3, the release version:

    private Hashtable readHeaders(TokenStream in)
throws IOException {

        Hashtable headers = new Hashtable();
        String hdrline = readln(in);

        while (!"".equals(hdrline)) {
            StringTokenizer tokenizer = new
StringTokenizer(hdrline);

            headers.put(tokenizer.nextToken("
:").toLowerCase(),
                        tokenizer.nextToken(" :;"));

                // The extra tokenizer.hasMoreTokens() in
headers.put
                // handles the filename="" case IE6 submits
for an empty
                // upload field.
            while (tokenizer.hasMoreTokens()) {
                headers.put(tokenizer.nextToken("
;=\""),
                            tokenizer.hasMoreTokens()
? tokenizer.nextToken("=\"") : "");
            }

            hdrline = readln(in);
        }

        return headers;
    }


--- Volker Schneider <[EMAIL PROTECTED]>
wrote:
> Hi myself,
> 
> this is a bug in MultipartParser.java in the
> readHeaders() method within
> Cocoon 2.0.2.
> 
> When you define <form name="form2"
> enctype="multipart/form-data"
> method="post"> and you use a <input
> name="uploadedfile" type="file"> field,
> the header will contain:
> 
> ...name="uploadedfile"; filename=""
> 
> When filename is empty the StringTokenizer in
> readHeaders() will have no
> more tokens, but will get a nextToken() call.
> 
> Here's an approach for a bug fix:
> 
> ...
> while (tokenizer.hasMoreTokens())
> {
>   //---- old code
>   //  headers.put(tokenizer.nextToken(" ;=\""),
>   //          tokenizer.nextToken("=\""));
> 
>   //---- new code
>   String key = tokenizer.nextToken(" ;=\"");
>   String value = "";
>   if (tokenizer.hasMoreTokens())
>   {
>     value = tokenizer.nextToken("=\"");
>   }
>   else
>   {
>     value = "";
>   }
> 
>   headers.put(key, value);
>   //---- end of new code
> }
> 
> This helps unless the filename="" is not followed by
> an additional
> attribute, but it helps for the moment.
> 
> Please fix this bug, if it is not done yet.
> 
> Best regards
> - Volker -
> 
> 
> -----Original Message-----
> From: Volker Schneider
> [mailto:volker.schneider@;danet.de]
> Sent: Sonntag, 10. November 2002 22:32
> To: [EMAIL PROTECTED]
> Subject: enctype="multipart/form-data" problem
> 
> 
> Dear colleagues,
> 
> if have a form and I want to upload a file from that
> form. When I define my
> form as
> 
> <form name="form2" enctype="multipart/form-data"
> method="post">
> 
> the ordinary input fields will not be transferred.
> 
> When I use method="get" it works. Unfortunately I
> have to use the "post"
> method because I have to transfer a lot of data and
> I'm not sure, whether
> this is possible with the "get" method (because of
> limited URL length).
> 
> Splitting the form is not possible, because I need
> the rest of the data too.
> 
> Please help me, what can I do?
> 
> Thank you, best regards
> - Volker -
> 
> 
>
---------------------------------------------------------------------
> Please check that your question  has not already
> been answered in the
> FAQ before posting.    
> <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:    
> <[EMAIL PROTECTED]>
> For additional commands, e-mail:  
> <[EMAIL PROTECTED]>
> 
> 
>
---------------------------------------------------------------------
> Please check that your question  has not already
> been answered in the
> FAQ before posting.    
> <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:    
> <[EMAIL PROTECTED]>
> For additional commands, e-mail:  
> <[EMAIL PROTECTED]>
> 


__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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

Reply via email to