Bug 44611 - DirContextURLConnection Header Bugs
Summary: DirContextURLConnection Header Bugs
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2008-03-15 21:32 UTC by Chris Hubick
Modified: 2008-05-29 13:44 UTC (History)
0 users

Fix DirContextURLConnection bugs. (11.71 KB, patch)
2008-03-15 21:32 UTC, Chris Hubick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Hubick 2008-03-15 21:32:08 UTC
Created attachment 21673 [details]
Fix DirContextURLConnection bugs.

DirContextURLConnection has bugs:
1) Does not implement the getHeaderFields() method
2) It's implementation of getHeaderField(String name) is case sensitive.
3) It returns an empty string "", rather than null, for header values which don't exist.

This means that there is no way to know what header information Tomcat exposes for a file, and calling getHeaderField("Content-Type") will return "", even though there is an attribute stored as "content-type".

The attached patch should fix these bugs.
Comment 1 Mark Thomas 2008-03-24 14:32:56 UTC
Many thanks for the patch. It has been applied to trunk and proposed for inclusion in the next release of 6.0.x.
Comment 2 Mark Thomas 2008-04-05 11:25:35 UTC
The patch has been applied to 6.0.x and will be included in the next release.

Many thanks.
Comment 3 Chris Hubick 2008-04-05 15:07:03 UTC
Thanks a lot Mark.

I should get off my but and write a follow up patch to this which formats Date fields as proper HTTP header date values (RFC 1123 - "EEE, dd MMM yyyy HH:mm:ss zzz") when returned as strings, which is another current bug.
Comment 4 Mark Thomas 2008-04-06 08:42:49 UTC
That would be great. When you are ready, open a new bug, add your patch and I'll take a look.
Comment 5 Chris Hubick 2008-05-29 13:44:49 UTC
(In reply to comment #4)
> That would be great. When you are ready, open a new bug, add your patch and
> I'll take a look.

Filed bug 45101 :)