snapframework / snap

Top-level package for the official Snap Framework libraries, includes the snaplets API as well as infrastructure for sessions, auth, and templates.
http://snapframework.com/
BSD 3-Clause "New" or "Revised" License
455 stars 68 forks source link

SNAP has problems with large files (jpegs) #194

Closed ChasTheSpaz closed 7 years ago

ChasTheSpaz commented 7 years ago

I am developing an image system in Haskell, using the Threepenny webserver. Testing of the prototype system showed problems presenting large jpeg images, from incomplete loading to totally invalidated loading. I consulted with Heinrich Apfelmus about this and he said that SNAP is part of his code that serves the file. I used a small test program directly in SNAP and can consistently produce errors on large jpeg files.

module Main where

import Snap.Core           (Snap, route)
import Snap.Http.Server    (quickHttpServe)
import Snap.Util.FileServe
import Data.ByteString.Char8

site :: Snap ()
site = route
  [ (pack "/files",   serveDirectory                            "static")
  , (pack "/simple",  serveDirectoryWith simpleDirectoryConfig  "static")
  , (pack "/default", serveDirectoryWith defaultDirectoryConfig "static")
  , (pack "/fancy",   serveDirectoryWith fancyDirectoryConfig   "static")
  , (pack "/hy",      serveFile                                 "static/hy.jpg")
  , (pack "/ostriches", serveFile                               "static/ostriches.jpg")
  , (pack "/sunflower", serveFile                               "static/sunflower150x113.png")
  , (pack "/hesperid",  serveFile                               "static/hesperid.jpeg")
  , (pack "/E",         serveFile                               "static/E.png")
  , (pack "/3-14",      serveFile                               "static/3-14.jpg")
  , (pack "/3-20",      serveFile                               "static/3-20.jpg")
  , (pack "/53",        serveFile                               "static/53.jpeg")
  ]

main :: IO ()
main = quickHttpServe site

None of the files listed can be attached for reasons known only to github. Comments: file hy.jpg is 13mb, ostriches.jpg in 7.7 mb, hesperid is 820 kb, the remaining are much smaller files.

mightybyte commented 7 years ago

Closing in favor of the other issue you opened.