diff --git a/Network/Wai/Handler/Warp.hs b/Network/Wai/Handler/Warp.hs
--- a/Network/Wai/Handler/Warp.hs
+++ b/Network/Wai/Handler/Warp.hs
@@ -33,6 +33,7 @@
   , settingsManager
   , settingsFdCacheDuration
   , settingsResourceTPerRequest
+  , settingsBeforeMainLoop
     -- ** Data types
   , HostPreference (..)
     -- * Connection
diff --git a/Network/Wai/Handler/Warp/Run.hs b/Network/Wai/Handler/Warp/Run.hs
--- a/Network/Wai/Handler/Warp/Run.hs
+++ b/Network/Wai/Handler/Warp/Run.hs
@@ -134,6 +134,7 @@
         0 -> return Nothing
         _ -> Just <$> F.initialize (duration * 1000000)
 #endif
+    settingsBeforeMainLoop set
     mask $ \restore -> forever $ do
         allowInterrupt
         (mkConn, addr) <- getConnLoop
diff --git a/Network/Wai/Handler/Warp/Settings.hs b/Network/Wai/Handler/Warp/Settings.hs
--- a/Network/Wai/Handler/Warp/Settings.hs
+++ b/Network/Wai/Handler/Warp/Settings.hs
@@ -31,6 +31,14 @@
       -- @ResourceT@. This provides more intuitive behavior for dynamic code,
       -- but can hinder performance in high-throughput cases. File servers can
       -- safely set to @False@ for increased performance. Default is @True@.
+    , settingsBeforeMainLoop :: IO ()
+      -- ^ Code to run after the listening socket is ready but before entering
+      -- the main event loop. Useful for signaling to tests that they can start
+      -- running, or to drop permissions after binding to a restricted port.
+      --
+      -- Default: do nothing.
+      --
+      -- Since 1.3.6
     }
 
 -- | The default settings for the Warp server. See the individual settings for
@@ -52,6 +60,7 @@
     , settingsManager = Nothing
     , settingsFdCacheDuration = 10
     , settingsResourceTPerRequest = True
+    , settingsBeforeMainLoop = return ()
     }
   where
     go :: InvalidRequest -> IO ()
diff --git a/warp.cabal b/warp.cabal
--- a/warp.cabal
+++ b/warp.cabal
@@ -1,5 +1,5 @@
 Name:                warp
-Version:             1.3.5.1
+Version:             1.3.6
 Synopsis:            A fast, light-weight web server for WAI applications.
 License:             MIT
 License-file:        LICENSE
