Mantis - Squeak
Viewing Issue Advanced Details
2454 Network major always 01-08-06 19:36 05-29-06 21:53
tb  
tb  
normal  
closed 3.8  
fixed  
none    
none 3.9  
0002454: HttpUrl>>retrieveContents does not use correct mime type
Trying to retrieve a css file from an IIS server will fail if you did something like "http://someserver.com/file.css" [^] because the ACCEPT header is not being set to text/css.

There is a mime-file extensions database already in the image, we should use it specify ACCEPT headers properly. Thus,

HttpUrl>>retrieveContentsArgs: args

    ^self retrieveContentsArgs: args accept: 'application/octet-stream'

should be changed to:

HttpUrl>>retrieveContentsArgs: args

    ^self retrieveContentsArgs: args accept: (MIMEDocument guessTypeFromName: self)
 HttpUrl_RetriveContentsFix.1.cs [^] (270 bytes) 01-20-06 07:05
 HttpUrl_RetriveContentsFix.2.cs [^] (240 bytes) 05-01-06 14:18

Notes
(0003575)
tb   
01-20-06 07:06   
Changeset attached
(0004837)
Etan Wexler   
05-01-06 14:17   
Guessing the Internet media type (MIME type, Content-Type) is very poor practice. Consult section 2.5, “URI Opacity”, of “Architecture of the World Wide Web, Volume One” ( http://www.w3.org/TR/webarch/#uri-opacity [^] ).

The right thing is to accept any Internet media type. Consult section 14.1, “Accept” ( http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 [^] ), of the specification “Hypertext Transfer Protocol -- HTTP/1.1” (RFC 2616, http://www.rfc-editor.org/rfc/rfc2616.txt [^] ). I recommend an explicit header field:

Accept: */*; q=1

The Smalltalk would be as follows:

retrieveContentsArgs: args
 ^self retrieveContentsArgs: args accept: '*/*; q=1'
(0004844)
ducasse   
05-02-06 20:57   
I hope that the IO team will harvest this change.

Stef
(0005053)
tb   
05-25-06 06:21   
Harvested as http://source.squeakfoundation.org/IO/Network-tb.28.mcz [^]
(0005094)
ducasse   
05-29-06 21:53   
in 7033