on master help sign in
Merged
commitf76cd3a5c528ac572eaffd11ca8b92589e8a8b71 authorChris Allen <cma@bitemyapp.com> dateMon 20 Aug 2018, 15:07 (8 years ago) parent819b344e2ce4d7
56 files changed+437−1002
.gitignore+1 .travis.yml+83−47 appveyor.yml+37 hcar-wai.tex−54 hcar-warp.tex−28 sources.txt−11 stack-lts-11.yaml+27 stack-lts-12.yaml+25 stack-lts-6.yaml+31 stack-lts-9.yaml+27 stack-nightly.yaml+25 wai-conduit/example/Main.hs+19 wai-extra/ChangeLog.md+20−1 wai-extra/Network/Wai/Middleware/RequestLogger.hs+1−1 wai-extra/Network/Wai/Middleware/RequestLogger/JSON.hs+9−8 wai-extra/Network/Wai/Middleware/Rewrite.hs+16 wai-extra/Network/Wai/Middleware/Timeout.hs+33 wai-extra/Network/Wai/Parse.hs+11−3 wai-extra/test/Network/Wai/Middleware/TimeoutSpec.hs+57 wai-extra/test/Network/Wai/ParseSpec.hs+1 wai-extra/wai-extra.cabal+3−1 wai-handler-fastcgi/.gitignore−4 wai-handler-fastcgi/ChangeLog.md−3 wai-handler-fastcgi/LICENSE−20 wai-handler-fastcgi/Network/Wai/Handler/FastCGI.hsc−192 wai-handler-fastcgi/README wai-handler-fastcgi/README.md−3 wai-handler-fastcgi/Setup.lhs−7 wai-handler-fastcgi/configure−9 wai-handler-fastcgi/fastcgi.buildinfo.in−3 wai-handler-fastcgi/lighttpd.conf−19 wai-handler-fastcgi/test.hs−19 wai-handler-fastcgi/wai-handler-fastcgi.cabal−31 wai-handler-launch/.gitignore−2 wai-handler-launch/ChangeLog.md−35 wai-handler-launch/LICENSE−20 wai-handler-launch/Network/Wai/Handler/Launch.hs−222 wai-handler-launch/README wai-handler-launch/README.md−4 wai-handler-launch/Setup.lhs−7 wai-handler-launch/runtests.hs−22 wai-handler-launch/test.hs−7 wai-handler-launch/wai-handler-launch.cabal−36 wai-handler-launch/windows.c−12 wai-handler-webkit/.gitignore−2 wai-handler-webkit/ChangeLog.md−3 wai-handler-webkit/LICENSE−20 wai-handler-webkit/Network/Wai/Handler/Webkit.hs−21 wai-handler-webkit/README.md−53 wai-handler-webkit/Setup.lhs−7 wai-handler-webkit/sample.hs−10 wai-handler-webkit/wai-handler-webkit.cabal−30 wai-handler-webkit/webkit.cpp−19 warp/ChangeLog.md+5 warp/Network/Wai/Handler/Warp/Run.hs+5−5 warp/warp.cabal+1−1
.gitignore+1
@@ -8,3 +8,4 @@ tarballs/
88.cabal-sandbox/
99cabal.sandbox.config
1010.stack-work/
11+*~
.travis.yml+83−47
@@ -11,8 +11,8 @@
1111# Use new container infrastructure to enable caching
1212sudo: false
1313
14−# Choose a lightweight base image; we provide our own build tools.
15−language: c
14+# Do not choose a language; we provide our own build tools.
15+language: generic
1616
1717# Caching so the next build will be fast too.
1818cache:
@@ -20,6 +20,7 @@ cache:
2020 - $HOME/.ghc
2121 - $HOME/.cabal
2222 - $HOME/.stack
23+ - $TRAVIS_BUILD_DIR/.stack-work
2324
2425# The different configurations we want to test. We have BUILD=cabal which uses
2526# cabal-install, and BUILD=stack which uses Stack. More documentation on each
@@ -33,21 +34,41 @@ cache:
3334# addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
3435matrix:
3536 include:
37+ # We grab the appropriate GHC and cabal-install versions from hvr's PPA. See:
38+ # https://github.com/hvr/multi-ghc-travis
39+ #- env: BUILD=cabal GHCVER=7.0.4 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
40+ # compiler: ": #GHC 7.0.4"
41+ # addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
42+ #- env: BUILD=cabal GHCVER=7.2.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
43+ # compiler: ": #GHC 7.2.2"
44+ # addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
45+ #- env: BUILD=cabal GHCVER=7.4.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
46+ # compiler: ": #GHC 7.4.2"
47+ # addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
48+ #- env: BUILD=cabal GHCVER=7.6.3 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
49+ # compiler: ": #GHC 7.6.3"
50+ # addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
51+ #- env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 HAPPYVER=1.19.5 ALEXVER=3.1.7
52+ # compiler: ": #GHC 7.8.4"
53+ # addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
3654 - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7
3755 compiler: ": #GHC 7.10.3"
38− addons: {apt: {packages: [libfcgi-dev,cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
56+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
3957 - env: BUILD=cabal GHCVER=8.0.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
4058 compiler: ": #GHC 8.0.2"
41− addons: {apt: {packages: [libfcgi-dev,cabal-install-1.24,ghc-8.0.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
42− - env: BUILD=cabal GHCVER=8.2.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
59+ addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
60+ - env: BUILD=cabal GHCVER=8.2.2 CABALVER=2.0 HAPPYVER=1.19.5 ALEXVER=3.1.7
4361 compiler: ": #GHC 8.2.2"
44− addons: {apt: {packages: [libfcgi-dev,cabal-install-1.24,ghc-8.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
62+ addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
63+ - env: BUILD=cabal GHCVER=8.4.3 CABALVER=2.2 HAPPYVER=1.19.5 ALEXVER=3.1.7
64+ compiler: ": #GHC 8.4.3"
65+ addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
4566
4667 # Build with the newest GHC and cabal-install. This is an accepted failure,
4768 # see below.
4869 - env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
4970 compiler: ": #GHC HEAD"
50− addons: {apt: {packages: [libfcgi-dev,cabal-install-head,ghc-head,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
71+ addons: {apt: {packages: [cabal-install-head,ghc-head,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
5172
5273 # The Stack builds. We can pass in arbitrary Stack arguments via the ARGS
5374 # variable, such as using --stack-yaml to point to a different file.
@@ -63,33 +84,37 @@ matrix:
6384 # compiler: ": #stack 7.10.2"
6485 # addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
6586
66− - env: BUILD=stack ARGS="--resolver lts-6"
87+ - env: BUILD=stack ARGS="--resolver lts-6" STACK_YAML="stack-lts-6.yaml"
6788 compiler: ": #stack 7.10.3"
68− addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
89+ addons: {apt: {packages: [libgmp-dev]}}
6990
7091 #- env: BUILD=stack ARGS="--resolver lts-7"
7192 # compiler: ": #stack 8.0.1"
7293 # addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
7394
74− - env: BUILD=stack ARGS="--resolver lts-9"
95+ - env: BUILD=stack ARGS="--resolver lts-9" STACK_YAML="stack-lts-9.yaml"
7596 compiler: ": #stack 8.0.2"
76− addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
97+ addons: {apt: {packages: [libgmp-dev]}}
7798
78− - env: BUILD=stack ARGS="--resolver lts-10"
99+ - env: BUILD=stack ARGS="--resolver lts-11" STACK_YAML="stack-lts-11.yaml"
79100 compiler: ": #stack 8.2.2"
80− addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
101+ addons: {apt: {packages: [libgmp-dev]}}
102+
103+ - env: BUILD=stack ARGS="--resolver lts-12" STACK_YAML="stack-lts-12.yaml"
104+ compiler: ": #stack 8.4.3"
105+ addons: {apt: {packages: [libgmp-dev]}}
81106
82107 # Nightly builds are allowed to fail
83− - env: BUILD=stack ARGS="--resolver nightly"
108+ - env: BUILD=stack ARGS="--resolver nightly" STACK_YAML="stack-nightly.yaml"
84109 compiler: ": #stack nightly"
85− addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
110+ addons: {apt: {packages: [libgmp-dev]}}
86111
87− # Build on OS X in addition to Linux
112+ # Build on macOS in addition to Linux
88113 #- env: BUILD=stack ARGS=""
89114 # compiler: ": #stack default osx"
90115 # os: osx
91116
92− # Travis includes an OS X which is incompatible with GHC 7.8.4
117+ # Travis includes an macOS which is incompatible with GHC 7.8.4
93118 #- env: BUILD=stack ARGS="--resolver lts-2"
94119 # compiler: ": #stack 7.8.4 osx"
95120 # os: osx
@@ -98,7 +123,7 @@ matrix:
98123 # compiler: ": #stack 7.10.2 osx"
99124 # os: osx
100125
101− - env: BUILD=stack ARGS="--resolver lts-6"
126+ - env: BUILD=stack ARGS="--resolver lts-6" STACK_YAML="stack-lts-6.yaml"
102127 compiler: ": #stack 7.10.3 osx"
103128 os: osx
104129
@@ -106,21 +131,25 @@ matrix:
106131 # compiler: ": #stack 8.0.1 osx"
107132 # os: osx
108133
109− - env: BUILD=stack ARGS="--resolver lts-9"
134+ - env: BUILD=stack ARGS="--resolver lts-9" STACK_YAML="stack-lts-9.yaml"
110135 compiler: ": #stack 8.0.2 osx"
111136 os: osx
112137
113− - env: BUILD=stack ARGS="--resolver lts-10"
138+ - env: BUILD=stack ARGS="--resolver lts-11" STACK_YAML="stack-lts-11.yaml"
114139 compiler: ": #stack 8.2.2 osx"
115140 os: osx
116141
142+ - env: BUILD=stack ARGS="--resolver lts-12" STACK_YAML="stack-lts-12.yaml"
143+ compiler: ": #stack 8.4.3 osx"
144+ os: osx
145+
117146 - env: BUILD=stack ARGS="--resolver nightly"
118147 compiler: ": #stack nightly osx"
119148 os: osx
120149
121150 allow_failures:
122151 - env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
123− - env: BUILD=stack ARGS="--resolver nightly"
152+ #- env: BUILD=stack ARGS="--resolver nightly"
124153
125154before_install:
126155# Using compiler above sets CC to an invalid value, so unset it
@@ -136,14 +165,9 @@ before_install:
136165- |
137166 if [ `uname` = "Darwin" ]
138167 then
139− travis_retry curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
140−
141− # brew no longer has fcgi
142− # brew install fcgi
143− grep -v wai-handler-fastcgi < stack.yaml > tmp
144− mv tmp stack.yaml
168+ travis_retry curl --insecure -L https://get.haskellstack.org/stable/osx-x86_64.tar.gz | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
145169 else
146− travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
170+ travis_retry curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
147171 fi
148172
149173 # Use the more reliable S3 mirror of Hackage
@@ -151,10 +175,6 @@ before_install:
151175 echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config
152176 echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config
153177
154− if [ "$CABALVER" != "1.16" ]
155− then
156− echo 'jobs: $ncpus' >> $HOME/.cabal/config
157− fi
158178
159179install:
160180- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
@@ -166,20 +186,32 @@ install:
166186 # Avoid out of memory condition
167187 stack --no-terminal --install-ghc $ARGS build Cabal
168188
169− stack --no-terminal --install-ghc $ARGS test --only-dependencies
189+ # Add in extra-deps for older snapshots, as necessary
190+ #
191+ # This is disabled by default, as relying on the solver like this can
192+ # make builds unreliable. Instead, if you have this situation, it's
193+ # recommended that you maintain multiple stack-lts-X.yaml files.
194+
195+ #stack --no-terminal --install-ghc $ARGS test --bench --dry-run || ( \
196+ # stack --no-terminal $ARGS build cabal-install && \
197+ # stack --no-terminal $ARGS solver --update-config)
198+
199+ # Build the dependencies
200+ stack --no-terminal --install-ghc $ARGS test --bench --only-dependencies
170201 ;;
171202 cabal)
172203 cabal --version
173204 travis_retry cabal update
174205
175− # Get the list of packages from the stack.yaml file
206+ # Get the list of packages from the stack.yaml file. Note that
207+ # this will also implicitly run hpack as necessary to generate
208+ # the .cabal files needed by cabal-install.
176209 PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')
177210
178211 # Due to dependency on wai-logger (which depends on some packages here),
179212 # we can't build just dependencies
180213 #
181− # cabal install --only-dependencies --enable-tests --force-reinstalls --ghc-options=-O0 --max-backjumps=-1 $CABALARGS $PACKAGES
182− cabal install hspec-discover
214+ # cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
183215 ;;
184216 esac
185217 set +ex
@@ -189,25 +221,29 @@ script:
189221 set -ex
190222 case "$BUILD" in
191223 stack)
192− stack --no-terminal $ARGS test --haddock --no-haddock-deps
224+ stack --no-terminal $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps
193225 ;;
194226 cabal)
195− cabal install --enable-tests --force-reinstalls --ghc-options=-O0 --max-backjumps=-1 $CABALARGS $PACKAGES
227+ cabal install --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
196228
197229 ORIGDIR=$(pwd)
198230 for dir in $PACKAGES
199231 do
200232 cd $dir
201233 cabal check || [ "$CABALVER" == "1.16" ]
202− # Takes too long, see https://github.com/yesodweb/wai/issues/665
203− #cabal sdist
204− #PKGVER=$(cabal info . | awk '{print $2;exit}')
205− #SRC_TGZ=$PKGVER.tar.gz
206− #cd dist
207− #tar zxfv "$SRC_TGZ"
208− #cd "$PKGVER"
209− #cabal configure --enable-tests
210− #cabal build
234+ cabal sdist
235+ PKGVER=$(cabal info . | awk '{print $2;exit}')
236+ SRC_TGZ=$PKGVER.tar.gz
237+ cd dist
238+ tar zxfv "$SRC_TGZ"
239+ cd "$PKGVER"
240+ cabal configure --enable-tests --ghc-options -O0
241+ cabal build
242+ if [ "$CABALVER" = "1.16" ] || [ "$CABALVER" = "1.18" ]; then
243+ cabal test
244+ else
245+ cabal test --show-details=streaming --log=/dev/stdout
246+ fi
211247 cd $ORIGDIR
212248 done
213249 ;;
appveyor.ymlnew file+37
@@ -0,0 +1,37 @@
1+build: off
2+
3+before_test:
4+# http://help.appveyor.com/discussions/problems/6312-curl-command-not-found
5+- set PATH=C:\Program Files\Git\mingw64\bin;%PATH%
6+
7+- curl -sS -ostack.zip -L --insecure https://get.haskellstack.org/stable/windows-x86_64.zip
8+- 7z x stack.zip stack.exe
9+
10+clone_folder: "c:\\stack"
11+environment:
12+ global:
13+ STACK_ROOT: "c:\\sr"
14+
15+ # Override the temp directory to avoid sed escaping issues
16+ # See https://github.com/haskell/cabal/issues/5386
17+ TMP: "c:\\tmp"
18+
19+ matrix:
20+ #- ARGS: ""
21+ #- ARGS: "--resolver lts-2"
22+ #- ARGS: "--resolver lts-3"
23+ - ARGS: "--stack-yaml stack-lts-6.yaml"
24+ #- ARGS: "--resolver lts-7"
25+ - ARGS: "--stack-yaml stack-lts-9.yaml"
26+ - ARGS: "--stack-yaml stack-lts-11.yaml"
27+ - ARGS: "--stack-yaml stack-lts-12.yaml"
28+ #- ARGS: "--resolver nightly"
29+
30+test_script:
31+
32+# Install toolchain, but do it silently due to lots of output
33+- stack %ARGS% setup > nul
34+
35+# The ugly echo "" hack is to avoid complaints about 0 being an invalid file
36+# descriptor
37+- echo "" | stack %ARGS% --no-terminal test
hcar-wai.texdeleted−54
@@ -1,54 +0,0 @@
1−% WAI-KW.tex
2−\begin{hcarentry}{WAI}
3−\label{wai}
4−\report{Kazu Yamamoto}%05/18
5−\participants{Michael Snoyman, Greg Weber}
6−\status{stable}
7−\makeheader
8−
9−WAI (Web Application Interface) is an application interface between web
10−applications and handlers in Haskell. The \texttt{Application} data type is
11−defined as follows:
12−
13−\begin{verbatim}
14−type Application
15− = Request
16− -> (Response -> IO ResponseReceived)
17− -> IO ResponseReceived
18−\end{verbatim}
19−
20−That is, a WAI application takes two arguments: a \texttt{Request} and a
21−function to send a \texttt{Response}. So, the typical behavior of WAI
22−application is processing a request, generating a response and passing the
23−response to the function.
24−
25−Historically speaking, this interface made possible to develop handlers other
26−than HTTP. The WAI applications can run through FastCGI
27−(wai-handler-fastcgi), run as stand-alone (wai-handler-webkit), etc. But the
28−most popular handler is based on HTTP, of course. The major HTTP handler for
29−WAI is Warp which now provides both HTTP/1.1 and HTTP/2. TLS (warp-tls) is
30−also available. New transports such as WebSocket (wai-websocket) and Event
31−Source (wai-extra) can be implemented, too.
32−
33−It is possible to develop WAI applications directly. For instance, Hoogle and
34−Mighttpd2 take this way. However, you may want to use web application
35−frameworks such as Apiary, MFlow, rest, Servant, Scotty, Spock, Yesod, etc.
36−
37−WAI also provides \texttt{Middleware}:
38−
39−\begin{verbatim}
40−type Middleware = Application -> Application
41−\end{verbatim}
42−
43−WAI middleware can inspect and transform a request, for example by
44−automatically gzipping a response or logging a request (wai-extra).
45−
46−Since the last HCAR, WAI started using Builder of ByteString instead of
47−Builder of blaze-builder. Because they are identical, no backward
48−compatibility issue happens.
49−
50−\FurtherReading
51−\begin{compactitem}
52−\item\url{https://groups.google.com/d/forum/haskell-wai}
53−\end{compactitem}
54−\end{hcarentry}
hcar-warp.texdeleted−28
@@ -1,28 +0,0 @@
1−% Warp-KW.tex
2−\begin{hcarentry}[updated]{Warp}
3−\label{warp}
4−\report{Kazu Yamamoto}%05/18
5−\participants{Michael Snoyman}
6−\status{stable}
7−\makeheader
8−
9−Warp is a high performance, easy to deploy HTTP handler for WAI~\cref{wai}.
10−Its supports both HTTP/1.1 and HTTP/2.
11−
12−Since the last HCAR, no major changes were made.
13−
14−\FurtherReading
15−\begin{compactitem}
16−\item``Warp: A Haskell Web Server''
17− \begin{compactitem}
18− \item the May/June 2011 issue of IEEE Internet Computing
19− \item Issue page: \url{http://www.computer.org/portal/web/csdl/abs/mags/ic/2011/03/mic201103toc.htm}
20− \item PDF: \url{http://steve.vinoski.net/pdf/IC-Warp\_a\_Haskell\_Web\_Server.pdf}
21− \end{compactitem}
22−\item ``Warp''
23− \begin{compactitem}
24− \item The Performance of Open Source Applications
25− \item HTML: \url{http://www.aosabook.org/en/posa/warp.html}
26− \end{compactitem}
27−\end{compactitem}
28−\end{hcarentry}
sources.txtdeleted−11
@@ -1,11 +0,0 @@
1−./wai
2−./wai-extra
3−./warp
4−./warp-tls
5−./wai-app-static
6−./wai-handler-fastcgi
7−./wai-handler-launch
8−./wai-websockets
9−./wai-conduit
10−./mime-types
11−./auto-update
stack-lts-11.yamlnew file+27
@@ -0,0 +1,27 @@
1+resolver: lts-11.21
2+packages:
3+- ./auto-update
4+- ./mime-types
5+- ./wai
6+- ./wai-extra
7+- ./warp
8+- ./warp-tls
9+- ./wai-app-static
10+- ./wai-websockets
11+- ./wai-conduit
12+flags:
13+ wai-extra:
14+ build-example: true
15+extra-deps:
16+- streaming-commons-0.2.1.0@sha256:163af02944f374f316e35257c1afbffefd2c2852a85a151d1ea0ad22152cf28d,4990
17+nix:
18+ enable: false
19+ packages:
20+ - fcgi
21+ - zlib
22+image:
23+ containers:
24+ - base: "fpco/pid1"
25+ name: "yesodweb/warp"
26+ executables:
27+ - warp
stack-lts-12.yamlnew file+25
@@ -0,0 +1,25 @@
1+resolver: lts-12.6
2+packages:
3+- ./auto-update
4+- ./mime-types
5+- ./wai
6+- ./wai-extra
7+- ./warp
8+- ./warp-tls
9+- ./wai-app-static
10+- ./wai-websockets
11+- ./wai-conduit
12+flags:
13+ wai-extra:
14+ build-example: true
15+nix:
16+ enable: false
17+ packages:
18+ - fcgi
19+ - zlib
20+image:
21+ containers:
22+ - base: "fpco/pid1"
23+ name: "yesodweb/warp"
24+ executables:
25+ - warp
stack-lts-6.yamlnew file+31
@@ -0,0 +1,31 @@
1+resolver: lts-6.35
2+packages:
3+- ./auto-update
4+- ./mime-types
5+- ./wai
6+- ./wai-extra
7+- ./warp
8+- ./warp-tls
9+- ./wai-app-static
10+- ./wai-websockets
11+- ./wai-conduit
12+extra-deps:
13+- bsb-http-chunked-0.0.0.2@sha256:0571ef33ec5530104503d32eaf24f2d7c221f350e5fc475a6dd8e84311bc0ca1,1792
14+- streaming-commons-0.2.1.0@sha256:163af02944f374f316e35257c1afbffefd2c2852a85a151d1ea0ad22152cf28d,4990
15+- tls-session-manager-0.0.0.2@sha256:e3d3f8a026196df46746a19d3d7d31211b2fca3aefed9074e951b2dcc1b8833c,872
16+- wai-logger-2.3.2@sha256:7f5dbc72c0753bd3e0e73f8f542d9d159d1d70f8ff3a3ec16d0b74b500534fc6,1572
17+- gauge-0.2.3@sha256:ce41cb66ebf730a5050181db0338b1a4b3f76ac71331bf5070089bcd4352ff46,3777
18+- psqueues-0.2.7.0@sha256:189970837d0aae01f48cd2a8aac6ce314191939e118cc0488aee1fb12da1956a,4757
19+- basement-0.0.7@rev:0
20+- http-client-0.5.13.1@rev:0
21+nix:
22+ enable: false
23+ packages:
24+ - fcgi
25+ - zlib
26+image:
27+ containers:
28+ - base: "fpco/pid1"
29+ name: "yesodweb/warp"
30+ executables:
31+ - warp
stack-lts-9.yamlnew file+27
@@ -0,0 +1,27 @@
1+resolver: lts-9.21
2+packages:
3+- ./auto-update
4+- ./mime-types
5+- ./wai
6+- ./wai-extra
7+- ./warp
8+- ./warp-tls
9+- ./wai-app-static
10+- ./wai-websockets
11+- ./wai-conduit
12+extra-deps:
13+- bsb-http-chunked-0.0.0.2@sha256:0571ef33ec5530104503d32eaf24f2d7c221f350e5fc475a6dd8e84311bc0ca1,1792
14+- streaming-commons-0.2.1.0@sha256:163af02944f374f316e35257c1afbffefd2c2852a85a151d1ea0ad22152cf28d,4990
15+- wai-logger-2.3.2@sha256:7f5dbc72c0753bd3e0e73f8f542d9d159d1d70f8ff3a3ec16d0b74b500534fc6,1572
16+- http-client-0.5.13.1@rev:0
17+nix:
18+ enable: false
19+ packages:
20+ - fcgi
21+ - zlib
22+image:
23+ containers:
24+ - base: "fpco/pid1"
25+ name: "yesodweb/warp"
26+ executables:
27+ - warp
stack-nightly.yamlnew file+25
@@ -0,0 +1,25 @@
1+resolver: nightly-2018-08-17
2+packages:
3+- ./auto-update
4+- ./mime-types
5+- ./wai
6+- ./wai-extra
7+- ./warp
8+- ./warp-tls
9+- ./wai-app-static
10+- ./wai-websockets
11+- ./wai-conduit
12+flags:
13+ wai-extra:
14+ build-example: true
15+nix:
16+ enable: false
17+ packages:
18+ - fcgi
19+ - zlib
20+image:
21+ containers:
22+ - base: "fpco/pid1"
23+ name: "yesodweb/warp"
24+ executables:
25+ - warp
wai-conduit/example/Main.hsnew file+19
@@ -0,0 +1,19 @@
1+#!/usr/bin/env stack
2+-- stack --resolver lts-11.10 script
3+import Network.Wai
4+import Network.Wai.Handler.Warp
5+import Network.Wai.Conduit
6+import Network.HTTP.Types
7+import Conduit
8+import Data.ByteString.Builder (byteString)
9+import Control.Monad.Trans.Resource
10+
11+main :: IO ()
12+main = run 3000 app
13+
14+app :: Application
15+app _req respond =
16+ runResourceT $ withInternalState $ \is ->
17+ respond $ responseSource status200 [] $
18+ transPipe (`runInternalState` is) (sourceFile "Main.hs") .|
19+ mapC (Chunk . byteString)
wai-extra/ChangeLog.md+20−1
@@ -1,7 +1,26 @@
1−## 3.0.22.2
1+# Changelog for wai-extra
2+
3+## 3.0.25.0
24
35* Export `defaultRequestLoggerSettings` [#696](https://github.com/yesodweb/wai/pull/696)
46
7+## 3.0.24.2
8+
9+* Consider quoted multipart form boundary markers [#700](https://github.com/yesodweb/wai/pull/700).
10+* Don't raise exceptions in `formatAsJSON` [#709](https://github.com/yesodweb/wai/pull/709)
11+
12+## 3.0.24.1
13+
14+* Fix a "file not found" exception in wai-extra [#705](https://github.com/yesodweb/wai/pull/706)
15+
16+## 3.0.24.0
17+
18+* Add timeout middleware [#702](https://github.com/yesodweb/wai/pull/702).
19+
20+## 3.0.23.0
21+
22+* Add rewriteRoot middleware [#697](https://github.com/yesodweb/wai/pull/697).
23+
524## 3.0.22.1
625
726* Drop dependency on blaze-builder, requiring streaming-commons >= 0.2
wai-extra/Network/Wai/Middleware/RequestLogger.hs+1−1
@@ -87,7 +87,7 @@ data RequestLoggerSettings = RequestLoggerSettings
8787-- | @defaultRequestLoggerSettings@ is the original 'Default' instance
8888-- factored out into a top-level declared variable.
8989--
90−-- @since 3.0.22.2
90+-- @since 3.0.25.0
9191defaultRequestLoggerSettings :: RequestLoggerSettings
9292defaultRequestLoggerSettings =
9393 RequestLoggerSettings
wai-extra/Network/Wai/Middleware/RequestLogger/JSON.hs+9−8
@@ -11,7 +11,8 @@ import qualified Data.ByteString.Char8 as S8
1111import Data.IP
1212import qualified Data.Text as T
1313import Data.Text (Text)
14−import Data.Text.Encoding (decodeUtf8)
14+import Data.Text.Encoding (decodeUtf8With)
15+import Data.Text.Encoding.Error (lenientDecode)
1516import Data.Time (NominalDiffTime)
1617import Data.Word (Word32)
1718import Network.HTTP.Types as H
@@ -32,10 +33,10 @@ formatAsJSON date req status responseSize duration reqBody response =
3233 , "size" .= responseSize
3334 , "body" .=
3435 if statusCode status >= 400
35− then Just . decodeUtf8 . toStrict . BB.toLazyByteString $ response
36+ then Just . decodeUtf8With lenientDecode . toStrict . BB.toLazyByteString $ response
3637 else Nothing
3738 ]
38− , "time" .= decodeUtf8 date
39+ , "time" .= decodeUtf8With lenientDecode date
3940 ]) <> "\n"
4041
4142word32ToHostAddress :: Word32 -> Text
@@ -47,12 +48,12 @@ readAsDouble = read
4748requestToJSON :: NominalDiffTime -> Request -> [S8.ByteString] -> Value
4849requestToJSON duration req reqBody =
4950 object
50− [ "method" .= decodeUtf8 (requestMethod req)
51− , "path" .= decodeUtf8 (rawPathInfo req)
51+ [ "method" .= decodeUtf8With lenientDecode (requestMethod req)
52+ , "path" .= decodeUtf8With lenientDecode (rawPathInfo req)
5253 , "queryString" .= map queryItemToJSON (queryString req)
5354 , "durationMs" .= (readAsDouble . printf "%.2f" . rationalToDouble $ toRational duration * 1000)
5455 , "size" .= requestBodyLengthToJSON (requestBodyLength req)
55− , "body" .= decodeUtf8 (S8.concat reqBody)
56+ , "body" .= decodeUtf8With lenientDecode (S8.concat reqBody)
5657 , "remoteHost" .= sockToJSON (remoteHost req)
5758 , "httpVersion" .= httpVersionToJSON (httpVersion req)
5859 , "headers" .= requestHeadersToJSON (requestHeaders req)
@@ -78,7 +79,7 @@ sockToJSON (SockAddrCan i) =
7879 object [ "can" .= i ]
7980
8081queryItemToJSON :: QueryItem -> Value
81−queryItemToJSON (name, mValue) = toJSON (decodeUtf8 name, fmap decodeUtf8 mValue)
82+queryItemToJSON (name, mValue) = toJSON (decodeUtf8With lenientDecode name, fmap (decodeUtf8With lenientDecode) mValue)
8283
8384requestHeadersToJSON :: RequestHeaders -> Value
8485requestHeadersToJSON = toJSON . map hToJ where
@@ -87,7 +88,7 @@ requestHeadersToJSON = toJSON . map hToJ where
8788 hToJ hd = headerToJSON hd
8889
8990headerToJSON :: Header -> Value
90−headerToJSON (headerName, header) = toJSON (decodeUtf8 . original $ headerName, decodeUtf8 header)
91+headerToJSON (headerName, header) = toJSON (decodeUtf8With lenientDecode . original $ headerName, decodeUtf8With lenientDecode header)
9192
9293portToJSON :: PortNumber -> Value
9394portToJSON = toJSON . toInteger
wai-extra/Network/Wai/Middleware/Rewrite.hs+16
@@ -27,6 +27,7 @@ module Network.Wai.Middleware.Rewrite
2727 -- ** Recommended functions
2828 , rewriteWithQueries
2929 , rewritePureWithQueries
30+ , rewriteRoot
3031
3132 -- ** Deprecated
3233 , rewrite
@@ -263,6 +264,21 @@ rewritePureWithQueries :: (PathsAndQueries -> H.RequestHeaders -> PathsAndQuerie
263264 -> Middleware
264265rewritePureWithQueries convert app req = app $ rewriteRequestPure convert req
265266
267+-- | Rewrite root requests (/) to a specified path
268+--
269+-- Note that /index.html/ in example below should already be a valid route.
270+--
271+-- @
272+-- rewriteRoot "index.html" :: Middleware
273+-- @
274+--
275+-- @since 3.0.23.0
276+rewriteRoot :: Text -> Middleware
277+rewriteRoot root = rewritePureWithQueries onlyRoot
278+ where
279+ onlyRoot ([], q) _ = ([root], q)
280+ onlyRoot paths _ = paths
281+
266282--------------------------------------------------
267283-- * Modifying 'Request's directly
268284--------------------------------------------------
wai-extra/Network/Wai/Middleware/Timeout.hsnew file+33
@@ -0,0 +1,33 @@
1+-- | Timeout requests
2+module Network.Wai.Middleware.Timeout
3+ ( timeout
4+ , timeoutStatus
5+ , timeoutAs
6+ ) where
7+
8+import Network.HTTP.Types (Status, status503)
9+import Network.Wai
10+import qualified System.Timeout as Timeout
11+
12+-- | Time out the request after the given number of seconds
13+--
14+-- Timeouts respond with @'status503'@. See @'timeoutStatus'@ or @'timeoutAs'@
15+-- to customize the behavior of the timed-out case.
16+--
17+-- @since 3.0.24.0@
18+timeout :: Int -> Middleware
19+timeout = timeoutStatus status503
20+
21+-- | Time out with the given @'Status'@
22+--
23+-- @since 3.0.24.0@
24+timeoutStatus :: Status -> Int -> Middleware
25+timeoutStatus status = timeoutAs $ responseLBS status [] ""
26+
27+-- | Time out with the given @'Response'@
28+--
29+-- @since 3.0.24.0@
30+timeoutAs :: Response -> Int -> Middleware
31+timeoutAs timeoutReponse seconds app req respond =
32+ maybe (respond timeoutReponse) pure
33+ =<< Timeout.timeout (seconds * 1000000) (app req respond)
wai-extra/Network/Wai/Parse.hs+11−3
@@ -59,10 +59,12 @@ import Data.List (sortBy)
5959import Data.Function (on, fix)
6060import System.Directory (removeFile, getTemporaryDirectory)
6161import System.IO (hClose, openBinaryTempFile)
62+import System.IO.Error (isDoesNotExistError)
6263import Network.Wai
6364import qualified Network.HTTP.Types as H
6465import Control.Applicative ((<$>))
65−import Control.Monad (when, unless)
66+import Control.Exception (catchJust)
67+import Control.Monad (when, unless, guard)
6668import Control.Monad.Trans.Resource (allocate, release, register, InternalState, runInternalState)
6769import Data.IORef
6870import Network.HTTP.Types (hContentType)
@@ -128,7 +130,7 @@ tempFileBackEndOpts :: IO FilePath -- ^ get temporary directory
128130 -> IO FilePath
129131tempFileBackEndOpts getTmpDir pattrn internalState _ _ popper = do
130132 (key, (fp, h)) <- flip runInternalState internalState $ allocate it (hClose . snd)
131− _ <- runInternalState (register $ removeFile fp) internalState
133+ _ <- runInternalState (register $ removeFileQuiet fp) internalState
132134 fix $ \loop -> do
133135 bs <- popper
134136 unless (S.null bs) $ do
@@ -140,6 +142,9 @@ tempFileBackEndOpts getTmpDir pattrn internalState _ _ popper = do
140142 it = do
141143 tempDir <- getTmpDir
142144 openBinaryTempFile tempDir pattrn
145+ removeFileQuiet fp = catchJust (guard . isDoesNotExistError)
146+ (removeFile fp)
147+ (const $ return ())
143148
144149-- | A data structure that describes the behavior of
145150-- the parseRequestBodyEx function.
@@ -331,6 +336,9 @@ parseContentType a = do
331336 semicolon = 59
332337 equals = 61
333338 space = 32
339+ dq s = if S.length s > 2 && S.head s == 34 && S.last s == 34 -- quote
340+ then S.tail $ S.init s
341+ else s
334342 goAttrs front bs
335343 | S.null bs = front []
336344 | otherwise =
@@ -339,7 +347,7 @@ parseContentType a = do
339347 goAttr bs =
340348 let (k, v') = S.break (== equals) bs
341349 v = S.drop 1 v'
342− in (strip k, strip v)
350+ in (strip k, dq $ strip v)
343351 strip = S.dropWhile (== space) . fst . S.breakEnd (/= space)
344352
345353-- | Parse the body of an HTTP request.
wai-extra/test/Network/Wai/Middleware/TimeoutSpec.hsnew file+57
@@ -0,0 +1,57 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+
3+module Network.Wai.Middleware.TimeoutSpec
4+ ( spec
5+ ) where
6+
7+import Test.Hspec
8+
9+import Control.Concurrent (threadDelay)
10+import Network.HTTP.Types (status200, status503, status504)
11+import Network.Wai
12+import Network.Wai.Middleware.Timeout
13+import Network.Wai.Test
14+
15+spec :: Spec
16+spec = do
17+ describe "timeout" $ do
18+ it "times out slow requests with 503" $ do
19+ let app _req respond = do
20+ threadDelay $ 2 * 1000000
21+ respond $ responseLBS status200 [] ""
22+
23+ resp <- runApp $ timeout 1 app
24+
25+ simpleStatus resp `shouldBe` status503
26+
27+ it "does not time out fast requests" $ do
28+ let app _req respond = respond $ responseLBS status200 [] ""
29+
30+ resp <- runApp $ timeout 3 app
31+
32+ simpleStatus resp `shouldBe` status200
33+
34+ describe "timeoutStatus" $ do
35+ it "allows customizing the timeout response status" $ do
36+ let app _req respond = do
37+ threadDelay $ 2 * 1000000
38+ respond $ responseLBS status200 [] ""
39+
40+ resp <- runApp $ timeoutStatus status504 1 app
41+
42+ simpleStatus resp `shouldBe` status504
43+
44+ describe "timeoutAs" $ do
45+ it "allows customizing the timeout response" $ do
46+ let app _req respond = do
47+ threadDelay $ 2 * 1000000
48+ respond $ responseLBS status200 [] ""
49+ timeoutResponse = responseLBS status503 [("X-Timeout", "1")] ""
50+
51+ resp <- runApp $ timeoutAs timeoutResponse 1 app
52+
53+ simpleStatus resp `shouldBe` status503
54+ simpleHeaders resp `shouldBe` [("X-Timeout", "1")]
55+
56+runApp :: Application -> IO SResponse
57+runApp = runSession $ request defaultRequest
wai-extra/test/Network/Wai/ParseSpec.hs+1
@@ -30,6 +30,7 @@ spec = do
3030 [ ("text/plain", "text/plain", [])
3131 , ("text/plain; charset=UTF-8 ", "text/plain", [("charset", "UTF-8")])
3232 , ("text/plain; charset=UTF-8 ; boundary = foo", "text/plain", [("charset", "UTF-8"), ("boundary", "foo")])
33+ , ("text/plain; charset=UTF-8 ; boundary = \"quoted\"", "text/plain", [("charset", "UTF-8"), ("boundary", "quoted")])
3334 ]
3435 it "parseHttpAccept" caseParseHttpAccept
3536 describe "parseRequestBody" $ do
wai-extra/wai-extra.cabal+3−1
@@ -1,5 +1,5 @@
11Name: wai-extra
2−Version: 3.0.22.2
2+Version: 3.0.25.0
33Synopsis: Provides some basic WAI handlers and middleware.
44description:
55 Provides basic WAI handler and middleware functionality:
@@ -148,6 +148,7 @@ Library
148148 Network.Wai.Middleware.ForceDomain
149149 Network.Wai.Middleware.ForceSSL
150150 Network.Wai.Middleware.Routed
151+ Network.Wai.Middleware.Timeout
151152 Network.Wai.Parse
152153 Network.Wai.Request
153154 Network.Wai.UrlMap
@@ -186,6 +187,7 @@ test-suite spec
186187 Network.Wai.Middleware.ForceSSLSpec
187188 Network.Wai.Middleware.RoutedSpec
188189 Network.Wai.Middleware.StripHeadersSpec
190+ Network.Wai.Middleware.TimeoutSpec
189191 WaiExtraSpec
190192 build-depends: base >= 4 && < 5
191193 , wai-extra
wai-handler-fastcgi/.gitignoredeleted−4
@@ -1,4 +0,0 @@
1−/dist/
2−*.swp
3−*.hi
4−*.o
wai-handler-fastcgi/ChangeLog.mddeleted−3
@@ -1,3 +0,0 @@
1−## 3.0.0.2
2−
3−* Support wai 3.2
wai-handler-fastcgi/LICENSEdeleted−20
@@ -1,20 +0,0 @@
1−Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
2−
3−Permission is hereby granted, free of charge, to any person obtaining
4−a copy of this software and associated documentation files (the
5−"Software"), to deal in the Software without restriction, including
6−without limitation the rights to use, copy, modify, merge, publish,
7−distribute, sublicense, and/or sell copies of the Software, and to
8−permit persons to whom the Software is furnished to do so, subject to
9−the following conditions:
10−
11−The above copyright notice and this permission notice shall be
12−included in all copies or substantial portions of the Software.
13−
14−THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15−EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16−MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17−NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18−LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19−OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20−WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
wai-handler-fastcgi/Network/Wai/Handler/FastCGI.hscdeleted−192
@@ -1,192 +0,0 @@
1−{-# LANGUAGE ForeignFunctionInterface #-}
2−{-# LANGUAGE EmptyDataDecls #-}
3−{-# LANGUAGE CPP #-}
4−-----------------------------------------------------------------------------
5−-- |
6−-- Module : Network.Wai.Handler.FastCGI
7−-- Copyright : (c) Bjorn Bringert 2004-2005, (c) Lemmih 2006, (c) Michael Snoyman 2010
8−-- License : BSD-style (see the file libraries/network/LICENSE)
9−--
10−-- Maintainer : michael@snoyman.com
11−-- Stability : experimental
12−-- Portability : non-portable (uses FFI)
13−--
14−-- Interface for FastCGI <http://fastcgi.com/>, using the fcgiapp API.
15−-- Totally ripped off by Michael Snoyman to work with Hack, then WAI.
16−--
17−-----------------------------------------------------------------------------
18−module Network.Wai.Handler.FastCGI
19− ( run
20− , runSendfile
21− , runFork
22− ) where
23−
24−import Control.Monad ( liftM, forever )
25−import Data.Word (Word8)
26−import Foreign ( Ptr, castPtr, nullPtr, peekArray0
27− , throwIfNeg_, mallocBytes, free )
28−#ifdef GHC_7_4
29−import Foreign.C (CInt(..), CString, CStringLen)
30−#else
31−import Foreign.C (CInt, CString, CStringLen)
32−#endif
33−import Control.Exception (finally)
34−import Foreign.Storable ( Storable (..) )
35−
36−import qualified Network.Wai as W
37−import qualified Network.Wai.Handler.CGI as CGI
38−
39−import qualified Data.ByteString as S
40−import qualified Data.ByteString.Char8 as S8
41−import qualified Data.ByteString as BS
42−import qualified Data.ByteString.Internal as BSB
43−import qualified Data.ByteString.Unsafe as BSB
44−
45−import Control.Arrow ((***))
46−
47−#include <fcgiapp.h>
48−
49−------------------------------------------------------------------------
50−
51−data FCGX_Stream
52−type StreamPtr = Ptr FCGX_Stream
53−type Environ = Ptr CString
54−
55−------------------------------------------------------------------------
56−
57−foreign import ccall unsafe "fcgiapp.h FCGX_GetStr" fcgx_getStr
58− :: CString -> CInt -> StreamPtr -> IO CInt
59−
60−foreign import ccall unsafe "fcgiapp.h FCGX_PutStr" fcgx_putStr
61− :: CString -> CInt -> StreamPtr -> IO CInt
62−
63−
64−------------------------------------------------------------------------
65−
66−foreign import ccall unsafe "fcgiapp.h FCGX_Init" fcgx_init
67− :: IO CInt
68−
69−runFork :: Maybe S.ByteString -> (IO () -> IO a) -> Int -> W.Application -> IO ()
70−runFork sf fork threads app = do
71− testReturn "FCGX_Init" $ fcgx_init
72− let oneThread = forever $ oneRequest app sf
73− mapM_ fork $ replicate (threads - 1) oneThread
74− oneThread
75−
76−-- | Handle FastCGI requests in an infinite loop.
77−run :: W.Application -> IO ()
78−run = runFork Nothing id 1
79−
80−-- | Handle FastCGI requests in an infinite loop. For a server which supports
81−-- the X-Sendfile header.
82−runSendfile :: S.ByteString -> W.Application -> IO ()
83−runSendfile sf = runFork (Just sf) id 1
84−
85−oneRequest :: W.Application
86− -> Maybe S.ByteString -- X-Sendfile
87− -> IO ()
88−oneRequest app xsendfile = withRequest $ \r -> do
89− putStrLn "Received 1 request"
90− env <- peekEnvp r
91− ins <- peekIn r
92− outs <- peekOut r
93− handleRequest app ins outs env xsendfile
94−
95−peekIn, peekOut :: Ptr FCGX_Request -> IO (Ptr FCGX_Stream)
96−peekIn = (#peek FCGX_Request, in)
97−peekOut = (#peek FCGX_Request, out)
98−
99−peekEnvp :: Ptr FCGX_Request -> IO Environ
100−peekEnvp = (#peek FCGX_Request, envp)
101−
102−foreign import ccall unsafe "fcgiapp.h FCGX_InitRequest" fcgx_initrequest
103− :: Ptr FCGX_Request -> CInt -> CInt -> IO CInt
104−
105−foreign import ccall safe "fcgiapp.h FCGX_Accept_r" fcgx_accept_r
106− :: Ptr FCGX_Request -> IO CInt
107−
108−acceptRequest :: IO (Ptr FCGX_Request)
109−acceptRequest = do
110− reqp <- mallocBytes (#size FCGX_Request)
111− initAndAccept reqp
112− return reqp
113− where initAndAccept reqp = do
114− testReturn "FCGX_InitRequest" $ fcgx_initrequest reqp 0 0
115− testReturn "FCGX_Accept_r" $ fcgx_accept_r reqp
116−
117−withRequest :: (Ptr FCGX_Request -> IO ()) -> IO ()
118−withRequest f = do
119− req <- acceptRequest
120− f req `finally` finishRequest req
121−
122−foreign import ccall unsafe "fcgiapp.h FCGX_Finish_r" fcgx_finish_r
123− :: Ptr FCGX_Request -> IO ()
124−
125−finishRequest :: Ptr FCGX_Request -> IO ()
126−finishRequest reqp = do
127− fcgx_finish_r reqp
128− free reqp
129−
130−handleRequest :: W.Application
131− -> StreamPtr
132− -> StreamPtr
133− -> Environ
134− -> Maybe S.ByteString -- sendfile
135− -> IO ()
136−handleRequest f ins outs env xsendfile = do
137− vars <- environToTable env
138− let vars' = map (S8.unpack *** S8.unpack) vars
139− let input = const $ sRead ins
140− let hPut = sPutStr' outs
141− CGI.runGeneric vars' (CGI.requestBodyFunc input) hPut xsendfile f
142−
143−data FCGX_Request
144−
145−--
146−-- * Stream IO
147−--
148−
149−sPutStr' :: StreamPtr -> BS.ByteString -> IO ()
150−sPutStr' h str =
151− BSB.unsafeUseAsCStringLen str $ fcgxPutCStringLen h
152−
153−fcgxPutCStringLen :: StreamPtr -> CStringLen -> IO ()
154−fcgxPutCStringLen h (cs,len) =
155− testReturn "FCGX_PutStr" $ fcgx_putStr cs (fromIntegral len) h
156−
157−sRead :: StreamPtr -> IO (Maybe BS.ByteString)
158−sRead h = buildByteString (fcgxGetBuf h) 4096
159−
160−fcgxGetBuf :: StreamPtr -> Ptr a -> Int -> IO Int
161−fcgxGetBuf h p c =
162− liftM fromIntegral $ fcgx_getStr (castPtr p) (fromIntegral c) h
163−
164−--
165−-- * ByteString utilities
166−--
167−
168−-- | Data.ByteString.Lazy.hGetContentsN generalized to arbitrary
169−-- reading functions.
170−buildByteString :: (Ptr Word8 -> Int -> IO Int) -> Int -> IO (Maybe BS.ByteString)
171−buildByteString f k = do
172− ps <- BSB.createAndTrim k $ \p -> f p k
173− case BS.length ps of
174− 0 -> return Nothing
175− _ -> return $ Just ps
176−
177−--
178−-- * Utilities
179−--
180−
181−testReturn :: String -> IO CInt -> IO ()
182−testReturn e = throwIfNeg_ (\n -> e ++ " failed with error code: "++ show n)
183−
184−environToTable :: Environ -> IO [(S.ByteString, S.ByteString)]
185−environToTable arr = do
186− css <- peekArray0 nullPtr arr
187− ss <- mapM S.packCString css
188− return $ map splitEq ss
189− where
190− splitEq s =
191− let (a, b) = S.breakByte 61 s
192− in (a, S.drop 1 b)
wai-handler-fastcgi/READMEdeleted

No changes to the content.

wai-handler-fastcgi/README.mddeleted−3
@@ -1,3 +0,0 @@
1−## wai-handler-fastcgi
2−
3−Calls out to the libfcgi C library.
wai-handler-fastcgi/Setup.lhsdeleted−7
@@ -1,7 +0,0 @@
1−#!/usr/bin/env runhaskell
2−
3−> module Main where
4−> import Distribution.Simple
5−
6−> main :: IO ()
7−> main = defaultMain
wai-handler-fastcgi/configuredeleted−9
@@ -1,9 +0,0 @@
1−#!/bin/sh
2−#
3−
4−# subst standard header path variables
5−if test -n "$CPPFLAGS" ; then
6− echo "Found CPPFLAGS in environment: '$CPPFLAGS'"
7− sed 's,@CPPFLAGS@,'"$CPPFLAGS"',g;s,@LDFLAGS@,'"$LDFLAGS"',g' \
8− < fastcgi.buildinfo.in > fastcgi.buildinfo
9−fi
wai-handler-fastcgi/fastcgi.buildinfo.indeleted−3
@@ -1,3 +0,0 @@
1−ghc-options: -optc@CPPFLAGS@
2−cc-options: @CPPFLAGS@
3−ld-options: @LDFLAGS@
wai-handler-fastcgi/lighttpd.confdeleted−19
@@ -1,19 +0,0 @@
1−# Run with lighttpd -D -f lighttpd.conf
2−server.port = 3000
3−server.document-root = "."
4−server.modules = ("mod_fastcgi", "mod_rewrite")
5−
6−url.rewrite-once = (
7− "(.*)" => "/app/$1"
8−)
9−
10−fastcgi.server = (
11− "/app" => ((
12− "socket" => "/tmp/test.fastcgi.socket",
13− "check-local" => "disable",
14− "bin-path" => "./test",
15− "min-procs" => 1,
16− "max-procs" => 12,
17− "idle-timeout" => 30
18− ))
19−)
wai-handler-fastcgi/test.hsdeleted−19
@@ -1,19 +0,0 @@
1−{-# LANGUAGE OverloadedStrings #-}
2−import Network.Wai
3−import Network.Wai.Handler.FastCGI
4−import Control.Monad.IO.Class
5−import qualified Data.ByteString.Lazy as L
6−import qualified Data.ByteString.Lazy.Char8 as L8
7−import qualified Data.Enumerator as E
8−
9−main = run app
10−
11−app req
12− | pathInfo req == "/" = return $ responseLBS status200 [("Content-Type", "text/html")] "<form method='post' action='/post'><input type='text' name='name'><input type='submit'></form>"
13−app req = do
14− bss <- E.consume
15− return $ responseLBS status200 [("Content-Type", "text/plain")] $ L.concat
16− [ L8.pack $ show $ requestHeaders req
17− , "\n"
18− , L.fromChunks bss
19− ]
wai-handler-fastcgi/wai-handler-fastcgi.cabaldeleted−31
@@ -1,31 +0,0 @@
1−name: wai-handler-fastcgi
2−version: 3.0.0.2
3−license: MIT
4−license-file: LICENSE
5−author: Michael Snoyman <michael@snoyman.com>
6−maintainer: Michael Snoyman <michael@snoyman.com>
7−synopsis: Wai handler to fastcgi
8−description: API docs and the README are available at <http://www.stackage.org/package/wai-handler-fastcgi>.
9−category: Web
10−stability: stable
11−cabal-version: >= 1.6
12−build-type: Configure
13−extra-source-files: configure fastcgi.buildinfo.in README.md ChangeLog.md
14−homepage: http://www.yesodweb.com/book/web-application-interface
15−
16−library
17− build-depends: base >= 4 && < 5
18− , wai >= 3.0 && < 3.3
19− , wai-extra >= 3.0 && < 3.1
20− , bytestring >= 0.9.1.4
21− exposed-modules: Network.Wai.Handler.FastCGI
22− ghc-options: -Wall
23− includes: fcgiapp.h
24− extra-libraries: fcgi
25−
26− if impl(ghc >= 7.4)
27− cpp-options: -DGHC_7_4
28−
29−source-repository head
30− type: git
31− location: git://github.com/yesodweb/wai.git
wai-handler-launch/.gitignoredeleted−2
@@ -1,2 +0,0 @@
1−dist/
2−*.swp
wai-handler-launch/ChangeLog.mddeleted−35
@@ -1,35 +0,0 @@
1−## 3.0.2.4
2−
3−* Drop dependency on blaze-builder, requiring streaming-commons >= 0.2
4−
5−## 3.0.2.3
6−
7−* `process` package bump
8−
9−## 3.0.2.2
10−
11−* Improvements to ping's javascript script. [#494](https://github.com/yesodweb/wai/pull/494)
12−
13−## 3.0.2.1
14−
15−* Relax upper bound on process
16−
17−## 3.0.2
18−
19−* Don't launch if server fails; kill server on exit [#537](https://github.com/yesodweb/wai/issues/537) [#541](https://github.com/yesodweb/wai/pull/541)
20−
21−## 3.0.1
22−
23−* make host configurable too (fixes #538) [#539](https://github.com/yesodweb/wai/pull/539)
24−
25−## 3.0.0.5
26−
27−* Support wai/warp 3.2
28−
29−## 3.0.0.3
30−
31−Allow blaze-builder 0.4
32−
33−## 3.0.0.2
34−
35−* Support for Win64
wai-handler-launch/LICENSEdeleted−20
@@ -1,20 +0,0 @@
1−Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
2−
3−Permission is hereby granted, free of charge, to any person obtaining
4−a copy of this software and associated documentation files (the
5−"Software"), to deal in the Software without restriction, including
6−without limitation the rights to use, copy, modify, merge, publish,
7−distribute, sublicense, and/or sell copies of the Software, and to
8−permit persons to whom the Software is furnished to do so, subject to
9−the following conditions:
10−
11−The above copyright notice and this permission notice shall be
12−included in all copies or substantial portions of the Software.
13−
14−THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15−EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16−MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17−NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18−LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19−OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20−WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
wai-handler-launch/Network/Wai/Handler/Launch.hsdeleted−222
@@ -1,222 +0,0 @@
1−{-# LANGUAGE OverloadedStrings #-}
2−{-# LANGUAGE ForeignFunctionInterface #-}
3−{-# LANGUAGE CPP #-}
4−module Network.Wai.Handler.Launch
5− ( run
6− , runUrl
7− , runUrlPort
8− , runHostPortUrl
9− ) where
10−
11−import Network.Wai
12−import Network.Wai.Internal
13−import Network.HTTP.Types
14−import qualified Network.Wai.Handler.Warp as Warp
15−import Data.IORef
16−import Data.Monoid (mappend)
17−import Data.String (fromString)
18−import Control.Concurrent (forkIO, threadDelay, newEmptyMVar, putMVar, takeMVar)
19−import Control.Concurrent.Async (race)
20−import Control.Monad.IO.Class (liftIO)
21−import Control.Monad (unless)
22−import Control.Exception (throwIO)
23−import Data.Function (fix)
24−import qualified Data.ByteString as S
25−import Data.ByteString.Builder (Builder, byteString)
26−import qualified Data.ByteString.Builder.Extra as Builder (flush)
27−#if WINDOWS
28−import Foreign
29−import Foreign.C.String
30−#else
31−import System.Process (rawSystem)
32−#endif
33−import Data.Streaming.ByteString.Builder as B (newBuilderRecv, defaultStrategy)
34−import qualified Data.Streaming.Zlib as Z
35−
36−ping :: IORef Bool -> Middleware
37−ping active app req sendResponse
38− | pathInfo req == ["_ping"] = do
39− liftIO $ writeIORef active True
40− sendResponse $ responseLBS status200 [] ""
41− | otherwise = app req $ \res -> do
42− let isHtml hs =
43− case lookup "content-type" hs of
44− Just ct -> "text/html" `S.isPrefixOf` ct
45− Nothing -> False
46− if isHtml $ responseHeaders res
47− then do
48− let (s, hs, withBody) = responseToStream res
49− (isEnc, headers') = fixHeaders id hs
50− headers'' = filter (\(x, _) -> x /= "content-length") headers'
51− withBody $ \body ->
52− sendResponse $ responseStream s headers'' $ \sendChunk flush ->
53− addInsideHead sendChunk flush $ \sendChunk' flush' ->
54− if isEnc
55− then decode sendChunk' flush' body
56− else body sendChunk' flush'
57− else sendResponse res
58−
59−decode :: (Builder -> IO ()) -> IO ()
60− -> StreamingBody
61− -> IO ()
62−decode sendInner flushInner streamingBody = do
63− (blazeRecv, blazeFinish) <- newBuilderRecv defaultStrategy
64− inflate <- Z.initInflate $ Z.WindowBits 31
65− let send builder = blazeRecv builder >>= goBuilderPopper
66− goBuilderPopper popper = fix $ \loop -> do
67− bs <- popper
68− unless (S.null bs) $ do
69− Z.feedInflate inflate bs >>= goZlibPopper
70− loop
71− goZlibPopper popper = fix $ \loop -> do
72− res <- popper
73− case res of
74− Z.PRDone -> return ()
75− Z.PRNext bs -> do
76− sendInner $ byteString bs
77− loop
78− Z.PRError e -> throwIO e
79− streamingBody send (send Builder.flush)
80− mbs <- blazeFinish
81− case mbs of
82− Nothing -> return ()
83− Just bs -> Z.feedInflate inflate bs >>= goZlibPopper
84− Z.finishInflate inflate >>= sendInner . byteString
85−
86−toInsert :: S.ByteString
87−toInsert = "<script>setInterval(function(){var x;if(window.XMLHttpRequest){x=new XMLHttpRequest();}else{x=new ActiveXObject(\"Microsoft.XMLHTTP\");}x.open(\"GET\",\"/_ping?\" + (new Date()).getTime(),true);x.send();},60000)</script>"
88−
89−addInsideHead :: (Builder -> IO ())
90− -> IO ()
91− -> StreamingBody
92− -> IO ()
93−addInsideHead sendInner flushInner streamingBody = do
94− (blazeRecv, blazeFinish) <- newBuilderRecv defaultStrategy
95− ref <- newIORef $ Just (S.empty, whole)
96− streamingBody (inner blazeRecv ref) (flush blazeRecv ref)
97− state <- readIORef ref
98− mbs <- blazeFinish
99− held <- case mbs of
100− Nothing -> return state
101− Just bs -> push state bs
102− case state of
103− Nothing -> return ()
104− Just (held, _) -> sendInner $ byteString held `mappend` byteString toInsert
105− where
106− whole = "<head>"
107−
108− flush blazeRecv ref = inner blazeRecv ref Builder.flush
109−
110− inner blazeRecv ref builder = do
111− state0 <- readIORef ref
112− popper <- blazeRecv builder
113− let loop state = do
114− bs <- popper
115− if S.null bs
116− then writeIORef ref state
117− else push state bs >>= loop
118− loop state0
119−
120− push Nothing x = sendInner (byteString x) >> return Nothing
121− push (Just (held, atFront)) x
122− | atFront `S.isPrefixOf` x = do
123− let y = S.drop (S.length atFront) x
124− sendInner $ byteString held
125− `mappend` byteString atFront
126− `mappend` byteString toInsert
127− `mappend` byteString y
128− return Nothing
129− | whole `S.isInfixOf` x = do
130− let (before, rest) = S.breakSubstring whole x
131− let after = S.drop (S.length whole) rest
132− sendInner $ byteString held
133− `mappend` byteString before
134− `mappend` byteString whole
135− `mappend` byteString toInsert
136− `mappend` byteString after
137− return Nothing
138− | x `S.isPrefixOf` atFront = do
139− let held' = held `S.append` x
140− atFront' = S.drop (S.length x) atFront
141− return $ Just (held', atFront')
142− | otherwise = do
143− let (held', atFront', x') = getOverlap whole x
144− sendInner $ byteString held `mappend` byteString x'
145− return $ Just (held', atFront')
146−
147−getOverlap :: S.ByteString -> S.ByteString -> (S.ByteString, S.ByteString, S.ByteString)
148−getOverlap whole x =
149− go whole
150− where
151− go piece
152− | S.null piece = ("", whole, x)
153− | piece `S.isSuffixOf` x =
154− let x' = S.take (S.length x - S.length piece) x
155− atFront = S.drop (S.length piece) whole
156− in (piece, atFront, x')
157− | otherwise = go $ S.init piece
158−
159−fixHeaders :: ([Header] -> [Header])
160− -> [Header]
161− -> (Bool, [Header])
162−fixHeaders front [] = (False, front [])
163−fixHeaders front (("content-encoding", "gzip"):rest) = (True, front rest)
164−fixHeaders front (x:xs) = fixHeaders (front . (:) x) xs
165−
166−#if WINDOWS
167−foreign import ccall "launch"
168− launch' :: Int -> CString -> IO ()
169−#endif
170−
171−launch :: Int -> String -> IO ()
172−
173−#if WINDOWS
174−launch port s = withCString s $ launch' port
175−#else
176−launch port s = forkIO (rawSystem
177−#if MAC
178− "open"
179−#else
180− "xdg-open"
181−#endif
182− ["http://127.0.0.1:" ++ show port ++ "/" ++ s] >> return ()) >> return ()
183−#endif
184−
185−run :: Application -> IO ()
186−run = runUrl ""
187−
188−runUrl :: String -> Application -> IO ()
189−runUrl = runUrlPort 4587
190−
191−runUrlPort :: Int -> String -> Application -> IO ()
192−runUrlPort = runHostPortUrl "*4"
193−
194−-- |
195−--
196−-- @since 3.0.1
197−runHostPortUrl :: String -> Int -> String -> Application -> IO ()
198−runHostPortUrl host port url app = do
199− ready <- newEmptyMVar
200− active <- newIORef True
201− let settings =
202− Warp.setPort port $
203− Warp.setOnException (\_ _ -> return ()) $
204− Warp.setHost (fromString host) $
205− Warp.setBeforeMainLoop (putMVar ready ()) $
206− Warp.defaultSettings
207− -- Run these threads concurrently; when either one terminates or
208− -- raises an exception, the same happens to the other.
209− fmap (either id id) $ race
210− -- serve app, keep updating the activity flag
211− (Warp.runSettings settings (ping active app))
212− -- wait for server startup, launch browser, poll until server idle
213− (takeMVar ready >> launch port url >> loop active)
214−
215−loop :: IORef Bool -> IO ()
216−loop active = do
217− let seconds = 120
218− threadDelay $ 1000000 * seconds
219− b <- readIORef active
220− if b
221− then writeIORef active False >> loop active
222− else return ()
wai-handler-launch/READMEdeleted

No changes to the content.

wai-handler-launch/README.mddeleted−4
@@ -1,4 +0,0 @@
1−## wai-handler-launch
2−
3−This handles cross-platform launching and inserts Javascript code to ping the
4−server. When the server no longer receives pings, it shuts down.
wai-handler-launch/Setup.lhsdeleted−7
@@ -1,7 +0,0 @@
1−#!/usr/bin/env runhaskell
2−
3−> module Main where
4−> import Distribution.Simple
5−
6−> main :: IO ()
7−> main = defaultMain
wai-handler-launch/runtests.hsdeleted−22
@@ -1,22 +0,0 @@
1−{-# LANGUAGE OverloadedStrings #-}
2−import Network.Wai.Handler.Launch (insideHead)
3−import Test.Hspec
4−import Test.Hspec.HUnit
5−import Data.Enumerator hiding (map)
6−import Test.HUnit
7−import qualified Data.ByteString as S
8−
9−main :: IO ()
10−main = hspec $ describe "insideHead"
11− [ it "handles single chunks" $ helper "bar<head>foobaz" ["bar<head>baz"]
12− , it "handles single chunks, no <head>" $ helper "barfoo" ["bar"]
13− , it "handles whole chunks" $ helper "bar<head>foobaz" ["bar", "<head>", "baz"]
14− , it "handles split chunks" $ helper "bar<head>foobaz" ["bar", "<he", "ad>", "baz"]
15− , it "handles many chunks" $ helper "bar<head>foobaz1234567890" ["bar", "<he", "ad>", "baz", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]
16− , it "handles many pieces" $ helper "bar<head>foobaz" $ map S.singleton $ S.unpack "bar<head>baz"
17− ]
18−
19−helper :: S.ByteString -> [S.ByteString] -> Assertion
20−helper res pieces = do
21− x <- run_ $ enumList 1 pieces $$ joinI $ insideHead "foo" $$ consume
22− S.concat x @?= res
wai-handler-launch/test.hsdeleted−7
@@ -1,7 +0,0 @@
1−{-# LANGUAGE OverloadedStrings #-}
2−import Network.Wai
3−import Network.HTTP.Types
4−import Network.Wai.Handler.Launch
5−import Network.Wai.Middleware.Gzip
6−
7−main = runUrl "FIXME" $ gzip def $ \_ f -> f $ responseLBS status200 [("Content-Type", "text/html; charset=utf8")] "<html><head></head><body>HELLO THERE"
wai-handler-launch/wai-handler-launch.cabaldeleted−36
@@ -1,36 +0,0 @@
1−Name: wai-handler-launch
2−Version: 3.0.2.4
3−Synopsis: Launch a web app in the default browser.
4−description: API docs and the README are available at <http://www.stackage.org/package/wai-handler-launch>.
5−License: MIT
6−License-file: LICENSE
7−Author: Michael Snoyman
8−Maintainer: michael@snoyman.com
9−Category: Web
10−Build-type: Simple
11−Cabal-version: >=1.6
12−extra-source-files: README.md ChangeLog.md
13−
14−Library
15− Exposed-modules: Network.Wai.Handler.Launch
16− build-depends: base >= 4 && < 5
17− , wai >= 3.0 && < 3.3
18− , warp >= 3.0 && < 3.3
19− , http-types >= 0.7
20− , transformers >= 0.2.2
21− , bytestring >= 0.10.4
22− , streaming-commons >= 0.2
23− , async
24−
25− if os(windows)
26− c-sources: windows.c
27− cpp-options: -DWINDOWS
28− extra-libraries: Shell32 msvcrt
29− else
30− build-depends: process >= 1.0 && < 1.7
31− if os(darwin)
32− cpp-options: -DMAC
33−
34−source-repository head
35− type: git
36− location: git://github.com/yesodweb/wai.git
wai-handler-launch/windows.cdeleted−12
@@ -1,12 +0,0 @@
1−#include <windows.h>
2−#include <shellapi.h>
3−#include <stdio.h>
4−
5−void launch(int port, char *s)
6−{
7− int len = 8 + strlen("http://127.0.0.1:") + strlen(s);
8− char *buff = malloc(len);
9− _snprintf(buff, len, "http://127.0.0.1:%d/%s", port, s);
10− ShellExecute(NULL, "open", buff, NULL, NULL, SW_SHOWNORMAL);
11− free(buff);
12−}
wai-handler-webkit/.gitignoredeleted−2
@@ -1,2 +0,0 @@
1−dist
2−*.swp
wai-handler-webkit/ChangeLog.mddeleted−3
@@ -1,3 +0,0 @@
1−## 3.0.0.3
2−
3−* Support for wai/warp 3.2
wai-handler-webkit/LICENSEdeleted−20
@@ -1,20 +0,0 @@
1−Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
2−
3−Permission is hereby granted, free of charge, to any person obtaining
4−a copy of this software and associated documentation files (the
5−"Software"), to deal in the Software without restriction, including
6−without limitation the rights to use, copy, modify, merge, publish,
7−distribute, sublicense, and/or sell copies of the Software, and to
8−permit persons to whom the Software is furnished to do so, subject to
9−the following conditions:
10−
11−The above copyright notice and this permission notice shall be
12−included in all copies or substantial portions of the Software.
13−
14−THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15−EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16−MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17−NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18−LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19−OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20−WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
wai-handler-webkit/Network/Wai/Handler/Webkit.hsdeleted−21
@@ -1,21 +0,0 @@
1−{-# LANGUAGE ForeignFunctionInterface #-}
2−module Network.Wai.Handler.Webkit (run) where
3−
4−import Network.Wai (Application)
5−import qualified Network.Wai.Handler.Warp as S
6−import Control.Concurrent (forkOS)
7−import Control.Concurrent.MVar
8−import Foreign.C.String (CString, withCString)
9−import Control.Exception (finally)
10−
11−run :: String -- ^ Title to show in titlebar
12− -> Application -> IO ()
13−run title app = do
14− mvar <- newEmptyMVar
15− _ <- forkOS $ finally (S.run 3000 app) (putMVar mvar ())
16− _ <- forkOS $ finally (withCString title startBrowser) (putMVar mvar ())
17− _ <- takeMVar mvar
18− return ()
19−
20−foreign import ccall "start_browser"
21− startBrowser :: CString -> IO ()
wai-handler-webkit/README.mddeleted−53
@@ -1,53 +0,0 @@
1−wai-handler-webkit
2−==================
3−
4−Turn WAI applications into standalone GUIs using Qt WebKit.
5−
6−
7−Linux
8−-----
9−
10−You'll need the appropriate system libraries, on Ubuntu:
11−
12− apt-get install libqtwebkit-dev
13−
14−On Lucid, this required adding a PPA:
15−
16− sudo add-apt-repository ppa:kubuntu-ppa/backports
17−
18−
19−Windows
20−-------
21−
22−Install the Qt SDK from <http://qt.nokia.com/downloads/>
23−
24−Your application's Cabal file will require certain options for Windows,
25−shown below. In particular, we need to link with `g++`, so make sure
26−it's in your `PATH`. The option `-optl-mwindows` ensures that the
27−application does not open a terminal.
28−
29− if os(windows)
30− ghc-options: -Wall -threaded -pgml g++ -optl-static -optl-mwindows
31− else
32− ghc-options: -Wall
33−
34−Run `cabal-install` with the Qt `include` and `lib` directories.
35−
36− export QT_PATH=c:/QtSDK/Desktop/Qt/4.7.3/mingw
37−
38− cabal-dev install \
39− --extra-include-dirs=$QT_PATH/include \
40− --extra-include-dirs=$QT_PATH/include/QtCore \
41− --extra-include-dirs=$QT_PATH/include/QtNetwork \
42− --extra-include-dirs=$QT_PATH/include/QtGui \
43− --extra-include-dirs=$QT_PATH/include/QtWebKit \
44− --extra-lib-dirs=$QT_PATH/lib
45−
46−You'll need to include these DLLs with your application:
47−
48− phonon4.dll
49− libgcc_s_dw2-1.dll
50− QtCore4.dll
51− QtGui4.dll
52− QtNetwork4.dll
53− QtWebKit4.dll
wai-handler-webkit/Setup.lhsdeleted−7
@@ -1,7 +0,0 @@
1−#!/usr/bin/env runhaskell
2−
3−> module Main where
4−> import Distribution.Simple
5−
6−> main :: IO ()
7−> main = defaultMain
wai-handler-webkit/sample.hsdeleted−10
@@ -1,10 +0,0 @@
1−{-# LANGUAGE OverloadedStrings #-}
2−import Network.Wai
3−import Network.Wai.Handler.Webkit
4−import Network.HTTP.Types
5−
6−main :: IO ()
7−main = run "Sample App" app
8−
9−app :: Application
10−app _ response = response $ responseLBS status200 [("Content-Type", "text/html")] "<h1>Hello World!</h1>"
wai-handler-webkit/wai-handler-webkit.cabaldeleted−30
@@ -1,30 +0,0 @@
1−name: wai-handler-webkit
2−version: 3.0.0.3
3−license: MIT
4−license-file: LICENSE
5−author: Michael Snoyman <michael@snoyman.com>
6−maintainer: Michael Snoyman <michael@snoyman.com>
7−synopsis: Turn WAI applications into standalone GUIs using QtWebkit.
8−description: API docs and the README are available at <http://www.stackage.org/package/wai-handler-webkit>.
9−category: Web
10−stability: unstable
11−cabal-version: >= 1.6
12−build-type: Simple
13−homepage: https://github.com/yesodweb/wai/tree/master/wai-handler-webkit
14−extra-source-files: README.md ChangeLog.md
15−
16−library
17− build-depends: base >= 4 && < 5
18− , wai >= 3.0 && < 3.3
19− , warp >= 3.0 && < 3.3
20− ghc-options: -Wall
21− exposed-modules: Network.Wai.Handler.Webkit
22− c-sources: webkit.cpp
23− if os(windows)
24− extra-libraries: QtCore4, QtGui4, QtNetwork4, QtWebKit4
25− else
26− pkgconfig-depends: QtWebKit
27−
28−source-repository head
29− type: git
30− location: git://github.com/yesodweb/wai.git
wai-handler-webkit/webkit.cppdeleted−19
@@ -1,19 +0,0 @@
1−#include <QApplication>
2−#include <QPushButton>
3−#include <QtWebKit>
4−
5−extern "C" {
6− int start_browser(char *title)
7− {
8− char *argv[1];
9− argv[0] = title;
10− int argc = 1;
11−
12− QApplication app(argc, argv);
13− QWebView *view = new QWebView();
14− view->load(QUrl("http://localhost:3000/"));
15− view->show();
16−
17− return app.exec();
18− }
19−}
warp/ChangeLog.md+5
@@ -1,3 +1,8 @@
1+## 3.2.23
2+
3+* Log real requsts when an app throws an error.
4+ [#698](https://github.com/yesodweb/wai/pull/698)
5+
16## 3.2.22
27
38* Fixing large request body in HTTP/2.
warp/Network/Wai/Handler/Warp/Run.hs+5−5
@@ -339,8 +339,9 @@ serveConnection conn ii1 origAddr transport settings app = do
339339 -- https://github.com/yesodweb/wai/issues/618
340340 Just NoKeepAliveRequest -> return ()
341341 Nothing -> do
342− sendErrorResponse addr istatus e
342+ sendErrorResponse (dummyreq addr) istatus e
343343 throwIO e
344+
344345 where
345346 getProxyProtocolAddr src =
346347 case settingsProxyProtocol settings of
@@ -388,12 +389,11 @@ serveConnection conn ii1 origAddr transport settings app = do
388389 | Just ConnectionClosedByPeer <- fromException se = False
389390 | otherwise = True
390391
391− sendErrorResponse addr istatus e = do
392+ sendErrorResponse req istatus e = do
392393 status <- readIORef istatus
393394 when (shouldSendErrorResponse e && status) $ do
394395 let ii = toInternalInfo ii1 0 -- dummy
395− dreq = dummyreq addr
396− void $ sendResponse settings conn ii dreq defaultIndexRequestHeader (return S.empty) (errorResponse e)
396+ void $ sendResponse settings conn ii req defaultIndexRequestHeader (return S.empty) (errorResponse e)
397397
398398 dummyreq addr = defaultRequest { remoteHost = addr }
399399
@@ -405,7 +405,7 @@ serveConnection conn ii1 origAddr transport settings app = do
405405 keepAlive <- processRequest istatus src req mremainingRef idxhdr nextBodyFlush ii
406406 `E.catch` \e -> do
407407 -- Call the user-supplied exception handlers, passing the request.
408− sendErrorResponse addr istatus e
408+ sendErrorResponse req istatus e
409409 settingsOnException settings (Just req) e
410410 -- Don't throw the error again to prevent calling settingsOnException twice.
411411 return False
warp/warp.cabal+1−1
@@ -1,5 +1,5 @@
11Name: warp
2−Version: 3.2.22
2+Version: 3.2.23
33Synopsis: A fast, light-weight web server for WAI applications.
44License: MIT
55License-file: LICENSE