Mantis - Squeak
Viewing Issue Advanced Details
5507 Network major always 11-24-06 22:57 11-24-06 22:57
matthias_berth  
cdegroot  
normal  
assigned 3.9  
open  
none    
none  
0005507: [BUG][FIX] HttpResponse>>fromMIMEDocument: does not work when MIME document contents is not a String
Try to make a HttpResponse from a MIMEDocument that contains binary data, e.g. an image, as in

doc := form asMIMEDocument.
^ HttpResponse fromMIMEDocument: doc

Returning that response will fail with ByteArray does not understand #atEnd.

The critical method is

HttpResponse>>fromMIMEDocument: aMIMEDoc
    | content |
    content := aMIMEDoc content.
    content isString
        ifTrue: [content := ReadStream on: content].
    ^ self basicNew status: #ok;
         contentType: aMIMEDoc mimeType;
         contents: aMIMEDoc content;
         yourself"fieldAt: 'Cache-Control' put: 'max-age=86400';"

The next to last line should be

         contents: aMIMEDoc contentStream;

Change set attached below.
 HttpResponse_fromMIMEDocument_fix.1.cs [^] (699 bytes) 11-24-06 22:57

There are no notes attached to this issue.