Questions tagged [haskell-warp]

A Haskell high-performance HTTP server that implements the WAI protocol

warp is a Haskell high-performance HTTP server that implements the WAI protocol.

Being developed by the same authors as Yesod, it is optimized for high performance and low overhead, being interoperable with many other frameworks.

58 questions
1
vote
0 answers

Trying to make haskell warp-tls authenticate the client

I'm trying to make a https server that authenticates the client but it serves curl --verbose --cacert ca.crt https://localhost:3443 successfully. I think it should reject for lack of client creds and require curl --verbose --cert client.crt --key…
Adrian May
  • 2,127
  • 15
  • 24
1
vote
2 answers

Parse dynamic String into HostPreference

Using the Warp library, the setHost function will not accept a dynamic String as a host value, however it will be perfectly happy with a string literal: > import Network.Wai.Handler.Warp > apiHost = "0.0.0.0" :: String > getHost $ setHost…
Jivan
  • 21,522
  • 15
  • 80
  • 131
1
vote
1 answer

How to formulate the wai queryString properly?

I'm trying to formulate code, which would allow me to print something inside an html input field, and then the Haskell code will return what I have printed in the next div (to make an Ajax search engine in the long run). The connection between the…
Heligo
  • 165
  • 9
1
vote
1 answer

Only accepting a WAI Websocket request if the user is logged in

I am using the wai-websockets package (version 3.0.1.1) and I would like to only open a socket if the user has already logged in. I have a piece of middleware that takes care of all the authentication issues and if the user is logged in places a…
John F. Miller
  • 26,961
  • 10
  • 71
  • 121
1
vote
1 answer

Haskell WARP/WAI server fails to respond to AJAX calls from Android embedded WebView

UPDATE 3 When hitting the endpoint http://httpbin.org/user-agent, the request returns successfully. So something is wrong with my Haskell Warp+WAI application server. Any ideas what could make a server API call work for most browsers, but not for…
1
vote
1 answer

Creating a route for static assets or images in Hasekll Spock

I have this basic Spock application taken from its website: main :: IO () main = do ref <- newIORef 0 spockCfg <- defaultSpockCfg EmptySession PCNoDatabase (DummyAppState ref) runSpock 8080 (spock spockCfg app) app :: SpockM ()…
user7905648
  • 117
  • 6
1
vote
1 answer

How to server a folder of images/css/js in Wai/Warp?

I have this simple Wai/Warp application app :: Wai.Application app req respond = respond $ case Wai.rawPathInfo req of "/" -> Wai.responseFile status200 [("Content-Type", "text/html")] "views/index.html" Nothing _ -> notFound notFound ::…
user7905648
  • 117
  • 6
1
vote
1 answer

Which factors determine the appropriate value for settingsFork in a Warp application?

In Warp applications, the settingsFork option is available on the Settings data type. This allows one to choose a different fork model. When should this be set to something other than the default (void . forkIOWithUnmask)? Which factors should be…
flightlessbird
  • 413
  • 3
  • 9
1
vote
1 answer

How to use warp-tls instead of warp with scotty?

I need to start my scotty application with warp-tls instead of plain warp server but is seems running warp is hardwired in scotty's source code. Am I missing something obvious?
insitu
  • 4,488
  • 3
  • 25
  • 42
1
vote
1 answer

Handling concurrent requests with Warp

I have made a Wai web application and it is being run using Warp. However I have one AJAX request that takes quite some time to finish, while that request is pending, no other requests will be accepted by the server. I thought Warp was capable of…
Matthijs Steen
  • 686
  • 1
  • 7
  • 14
1
vote
1 answer

Using ghci debugger in a wai/warp app

Here's a trivial wai/warp program so I can learn how ghci debugger actually works:- {-# LANGUAGE OverloadedStrings #-} import Network.Wai import Network.HTTP.Types (status200) import Network.Wai.Handler.Warp (run) import Debug.Trace (trace) myApp…
Calvin Cheng
  • 35,640
  • 39
  • 116
  • 167
1
vote
0 answers

Scotty, WAI: Capturing request body

I don't seem to be able to capture request body any more. Everything started here when I hit the problem after an update. I was trying to investigate it and got to a point where I cant get the request body niether with scotty's body function nor…
r.sendecky
  • 9,933
  • 9
  • 34
  • 62
0
votes
1 answer

How to run web server (Warp) in async/concurrent mode?

I'm using https://hackage.haskell.org/package/warp-3.3.24/docs/Network-Wai-Handler-Warp.html I don't know much about haskell concurrency. Say I would like to run two servers on different ports: So I do: do Warp.run 3000 waiApp Warp.run 3002…
WHITECOLOR
  • 24,996
  • 37
  • 121
  • 181
0
votes
0 answers

ERR_EMPTY_RESPONSE when trying to access Scotty Application which runs in WSL2

I am building a web application using Scotty and have installed GHC and Cabal using GHCup inside of WSL2 (Windows Subsystem for Linux 2). The application worked when I ran it natively on Windows. I am running the application on port 3000 and I am…
0
votes
1 answer

How to Pipe Typed Process to wai-conduit's responseSource?

I want to have warp run a process, then respond with that process' output. The output is assumed to be larger than the server's RAM; loading the entire output then responding is not an option. I'd thought that I could accomplish this using something…