commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "guillaume cottenceau (JIRA)" <j...@apache.org>
Subject [jira] Commented: (FILEUPLOAD-130) Add ability to get any header from the FileItem and FileItemStream interfaces
Date Wed, 04 Jun 2008 09:59:45 GMT

    [ 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.


Mime
View raw message