Mantis - Squeak Packages
Viewing Issue Advanced Details
7397 KomHttpServer major always 09-24-09 07:45 09-24-09 07:45
gherolyants  
gcorriga  
normal  
assigned  
open  
none    
none  
0007397: Handling files on Windows is broken.
I use the following script (in Pharo) to start Seaside, allowing Kom server handle static files.

| ma seaside vmDir |

vmDir := FileDirectory on: SmalltalkImage current vmPath.

"Kill all existing Kom HTTP servers"
HttpService allInstancesDo: [:each | each stop. each unregister].

"Start a new server on port 9090 servering both static content and seaside apps"
seaside := WAKomEncoded default.
ma := ModuleAssembly core.
ma serverRoot: vmDir fullName.
ma alias: '/seaside' to: [ma addPlug: [:request | seaside process: request]].
ma documentRoot: (vmDir directoryNamed: 'files') fullName.
ma directoryIndex: 'index.html index.htm'.
ma serveFiles.
(HttpService startOn: 9090 named: 'httpd') plug: ma rootModule.

I'm on Windows and the full path to the 'files' directory is (for example): C:\work\myproject\files. When I try to load style.css file placed in this directory, I get an:

Internal Server Error
MessageNotUnderstood: OpaqueURI>>extension

It happens because MIME type guessing algorithm treats "C:" as URI schema. And URI class suggested is OpaqueURI instead of HierarchicalURI.

The attachment contains fix that works on Windows (and should work on other systems too, I guess).
OS: Windows Vista x64 Home Basic
Pharo: Pharo1.0beta Latest update: #10451.
 StandardFileStream-mimeType.st [^] (247 bytes) 09-24-09 07:45

There are no notes attached to this issue.