From issues-return-4444-apmail-commons-issues-archive=commons.apache.org@commons.apache.org Wed Jun 04 10:00:10 2008 Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 23724 invoked from network); 4 Jun 2008 10:00:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jun 2008 10:00:09 -0000 Received: (qmail 15960 invoked by uid 500); 4 Jun 2008 10:00:11 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 15886 invoked by uid 500); 4 Jun 2008 10:00:11 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 15875 invoked by uid 99); 4 Jun 2008 10:00:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jun 2008 03:00:11 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jun 2008 09:59:23 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 12B7B234C12F for ; Wed, 4 Jun 2008 02:59:45 -0700 (PDT) Message-ID: <2073674263.1212573585075.JavaMail.jira@brutus> Date: Wed, 4 Jun 2008 02:59:45 -0700 (PDT) From: "guillaume cottenceau (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (FILEUPLOAD-130) Add ability to get any header from the FileItem and FileItemStream interfaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/FILEUPLOAD-130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602231#action_12602231 ] guillaume cottenceau commented on FILEUPLOAD-130: ------------------------------------------------- Using stable version 1.2.1, I am unable to retrieve the headers in a program. Parsing a part looking like the following from a multipart HTTP POST: Content-Disposition: form-data; name="part2"; filename="fb.jpg.base64"[\r][\n] Content-Type: image/jpeg[\r][\n] Content-Transfer-Encoding: base64[\r][\n] [\r][\n] /9j/4AAQSkZJRgABAQIAHAAcAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a[\n] HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy[\n] MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAoADEDASIA[\n] AhEBAxEB/8QAGgABAAMBAQEAAAAAAAAAAAAAAAUHCAYEA//EAC0QAAEDAwMCBQQCAwAAAAAAAAEC[\n] AwQABREGEiExQRMiUWGBBzJxkUKhFdHw/8QAGQEAAwEBAQAAAAAAAAAAAAAAAAMEAQIF/8QAHhEA[\n] AgMAAgMBAAAAAAAAAAAAAAECAxEhMQQSE4H/2gAMAwEAAhEDEQA/AM/1K2LT82/ylNRQlDaBl19w[\n] 7UNj3NeGE01Inx2X3fCZcdShbh/gkkAn4FaSj25nSV2tbOmNHyXpLiFui0zLlHbUSkJAkhYW4DkF[\n] Q256pKgBtzQwOSi/Ra1u23wlXCSq5KRvQFENZx3ShSfMn8E9uarTUmjbrpqSpEhpTrGcJeQk4/BH[\n] Y/8AAmte3xxUjRLky4RhDmojJkBnxA4WJG3KUhQ4UQs7ePu6dDXHy1Qbu/Jt8hCXMoAcQoYyk9D+[\n] OOvqPalTn6MXOfozKNKs3XX0rcsbTlwtKluxBlSmVnKkjvg96rKmJp8o7TT6FKUrTRWqdNxNPO2K[\n] PcVtMR1paQtDzGGlIwnghScEccVlqOwuTJaYb+91YQn8k4q/tPQdP6dlps93bD7rZCo/jvFSFD02[\n] E4Cgc9umMd8TeTGXDT6B3KqLbWkrNXqPUiXJzN1kuWyKcxg+hAS+ofywlI3AdifjpkwbN0/yhIkb[\n] o9winAcaOFAHuPUHHQ5HHsDXcXLVEVcRxpjbhI24Haqzs8c3jUzyUyPBbxlxwYyRuG4DPGeg545P[\n] pUzc5SPMc7LLG3+ElcdVXGJBcE4IlR20lSlNjCsDr5Tx/dUU+WzIcLQIbKzsB9M8VofU8LSFstC3[\n] ZaHdqkEL3SHPPwRgAH3A/XeqGvT1penLNoiusRwTgLcKsjPvz/f+zXSmlyWUprsjaUpTx5K6fusa[\n] y3RE6TbGbj4Y8jL58gPqRjn5rsLj9VTcrcuA7pyAiMvktoUUgHsRgcH3pSgzDnkawlIQWy0pxrsl[\n] x9R49D2I+K+7Oupkdt3wY6G1rASClR2pAzjy/PrSlL+UN3Dj5Q3cOen3KXc5BflvrdWTxuUSE9uP[\n] 0P1XlpSmDBSlKAP/2Q==[\n] [\r][\n] --xYzZY--[\r][\n] and using that code to retrieve the headers given a FileItem object "fe": if ( fe instanceof FileItemHeadersSupport ) { FileItemHeaders headers = ( (FileItemHeadersSupport) fe ).getHeaders(); ... the "headers" object is unfortunately null (I badly need the "Content-Transfer-Encoding" header, to unbase64 the content). Looking at the code, I suspect the file item parser forgot to set the headers. See attached patch for a fix suggestion. Is that some sort of brown paper bag bug, or am I completely missing something? > Add ability to get any header from the FileItem and FileItemStream interfaces > ----------------------------------------------------------------------------- > > Key: FILEUPLOAD-130 > URL: https://issues.apache.org/jira/browse/FILEUPLOAD-130 > Project: Commons FileUpload > Issue Type: Improvement > Affects Versions: 1.2 > Reporter: Michael Macaluso > Assignee: Jochen Wiedmann > Priority: Minor > Fix For: 1.2.1 > > Attachments: FILEUPLOAD-130.patch, FileUpload-130_1.patch, FileUpload-130_2.patch > > > The FileItem and FileItemStream interfaces should have a way to return back any header that was encountered during the header parsing for an "Item". Currently, from the FileItemStatus you can only get information from the 2 pre-defined headers "Content-Type" and "Content-Disposition" (Sort-of because the header can not be accessed raw). Other than the interface changes (including the change to pass them along in the FileItemFactory interface), it appears that all changes can be made within the FileUploadBase.java file. FileUploadBase.java:859 (as of 1.2) has the headers, but the call to create the FileItemStreamImpl on lines 877 and 887 do not include the headers map. Further, the parseRequest method uses the FileItemStream interface to build the FileItem, so you should always have the headers in question. > The reason for this request is that we have an application that is sending per-part headers (not precluded by the specs as far as we know of) to provide more information than name and content-type and using the FileUpload project means that we can no longer find out those header values. > [Also, not completely sure, but I believe FileUploadBase.createItem(Map, boolean) on line 480 is not referenced anymore in this project.] -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.