Bug 44611

Summary: DirContextURLConnection Header Bugs
Product: Tomcat 6 Reporter: Chris Hubick <chris>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: default   
Hardware: All   
OS: All   
Attachments: Fix DirContextURLConnection bugs.

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 :)