[web-devel] FilePath in WAI

Kazu Yamamoto ( 山本和彦 ) kazu at iij.ad.jp
Wed Jun 13 09:41:33 CEST 2012


To implement high-performance web servers, I would like to remove
overhead of String and want to use ByteString instead. Unfortunately,
WAI is using FilePath (String) in ResponseFile.

	ResponseFile Status ResponseHeaders FilePath (Maybe FilePart)

To my experience, the third argument is created from rawPathInfo
(ByteString) in many cases. So, using FilePath is overhead.

Since new Haskell Platform is released, I think I can implement new
simple-sendfile which provides Network.Sendfile.ByteString:

	sendfile :: Socket -> RawFilePath -> FileRange -> IO () -> IO ()

Note that RawFilePath is a type synonym of ByteString.

What do you think of this?

A1) It's too late.
A2) We can change FilePath to RawFilePath in ReponseFile.
A3) We can provide a new constructor: ReponseRawFile
A4) Others


More information about the web-devel mailing list