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
3
votes
0 answers

How to add a specific representation of the request and response of the body of an HTTP request with Haskell Middleware

How can i add a specific representation of the request and response body in a request logger? I would like to be able to have some typeclass that allows me to achieve this representation. In the Network.Wai.Middleware.RequestLogger.JSON I can see…
emg184
  • 850
  • 8
  • 19
3
votes
1 answer

Warp / Scotty not terminating thread / resources at end of request

I'm running into an issue where my Scotty app does not seem to terminate old HTTP request threads. And eventually, after a large number (10-20) of concurrent requests, I run into an error with too many DB connections libpq: failed (FATAL: sorry,…
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
3
votes
0 answers

Anyway to change the default keep-alive close in warp?

It seems like a keep-alive connection is closed in 60s. Is it possible to configure this in warp?
tselvan
  • 642
  • 3
  • 11
3
votes
0 answers

Is there a timeout on warp server response?

I have a web application using warp and while trying to query some large-ish using curl I noticed the connection get shutdown exactly after 1 minute transfer. I increased curl's own timeout but this did not changed anything so I assume this is set…
insitu
  • 4,488
  • 3
  • 25
  • 42
3
votes
1 answer

How to deliver JSON over HTTP using Warp with Aeson

I want to create a high-performance HTTP-based API running on Haskell using warp as a HTTP backend. The server shall return JSON data upon request. This data shall be serialized by using Aeson However, warp requires a response object whereas Aeson…
Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
3
votes
2 answers

How to force yesod/warp to close open file handles before handling next request?

I've written a small server which accepts registrations as POST requests and persists them by appending them to a file. As soon as I put this server under load (I use Apache JMeter with 50 concurrent threads and a repeat count of 10, and the post…
Axel Hanikel
  • 115
  • 6
2
votes
1 answer

Using AJAX with the warp HTTP server

I'm having a bit of trouble trying to understand how WARP could potentially interact with the client-side. If I were to build my server-side via WARP, and had a Javascript client-side. Could I hypothetically use AJAX as the bridge between the client…
2
votes
1 answer

throwTo warp tls thread hangs idefinetly

I have a Yesod app with a warp server, and some of its functionality depends on async exceptions. Recently there arose a need to migrate it to https, which I did with the package warp-tls. However now I can't kill the warp thread by throwing…
MorJ
  • 566
  • 4
  • 14
2
votes
2 answers

Streaming bytestring as WAI HTTP server response body

I have a value body :: BS.ByteString (ResourceT IO) (), from a function based on BS.readFile. I want to stream that value as the response body from a Wai Application. There's a helper, streamingResponse that takes a value of the type Stream (Of…
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
2
votes
2 answers

Handling POST request in Wai/Warp in Haskell

I have a wai/warp application. How can I handle a post request? I have this: app :: Application app request respond = respond $ case rawPathInfo request of "/" -> responseFile status200 ............ "/some_post_req/" ->…
Otoma
  • 161
  • 2
  • 11
2
votes
1 answer

Handling HTTP GET Query parameters in Warp

Using the warp HTTP server, I want to handle HTTP query parameters. It's easy (see for example here) to make Warp render something for URLs like http://localhost:3000/foo How can I make it render http://localhost:3000/foo?id=bar in a way where…
Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
2
votes
1 answer

Easiest way to handle OPTIONS method?

I'm writing a client for my Yesod JSON server in angular.js. When examining the header traffic, it appears that Chrome is sending an OPTIONS method, which my handler rejects. Investigation suggests that I should send back something like…
user1198582
2
votes
2 answers

Trouble running Warp, on WAI, in Windows

I've written a simple Hello World application for (Warp) on (Wai). It works fine in Ubuntu Linux, as do more complicated apps. But I can't even get this Hello World app to run in Windows. I'm using Haskell Platform (installation file 2012.2.0.0) on…
jerng
  • 499
  • 6
  • 13
1
vote
1 answer

Warp web service with a long lived resource (a file handle)

I'm trying to understand how to write a web service using warp that has a long lived resource that I want access to from all my requests (i.e. I want the resource to exist for the life time of server, not per request). I'm assuming this is a use for…
thatismatt
  • 9,832
  • 10
  • 42
  • 54
1
vote
0 answers

How to get inetd and warp to work together

I am trying to get inetd to work with warp. Currently, I have main = do s <- mySocket 0 s' <- getSocketName s' runSettingsConnection settings ((, s') <$> socketConnection settings s) app which will return some data if there but it consumes…
William Rusnack
  • 908
  • 8
  • 15