[Pkg-haskell-commits] darcs: haskell-hoogle: Cgi rewrite file:// to /cgi-bin/hoogle/file/.

kiwamu at debian.or.jp kiwamu at debian.or.jp
Thu Oct 4 16:49:38 UTC 2012


Thu Oct  4 16:46:21 UTC 2012  kiwamu at debian.or.jp
  * Cgi rewrite file:// to /cgi-bin/hoogle/file/.
  Ignore-this: 7755f16baa96abf527c72a86ac705d3a

    M ./patches/cgi-return-res-files.patch -6 +10

Thu Oct  4 16:46:21 UTC 2012  kiwamu at debian.or.jp
  * Cgi rewrite file:// to /cgi-bin/hoogle/file/.
  Ignore-this: 7755f16baa96abf527c72a86ac705d3a
diff -rN -u old-haskell-hoogle//patches/cgi-return-res-files.patch new-haskell-hoogle//patches/cgi-return-res-files.patch
--- old-haskell-hoogle//patches/cgi-return-res-files.patch	2012-10-04 16:49:38.063894516 +0000
+++ new-haskell-hoogle//patches/cgi-return-res-files.patch	2012-10-04 16:49:38.083721608 +0000
@@ -1,7 +1,7 @@
 Index: haskell-hoogle-4.2.10/src/Web/Server.hs
 ===================================================================
 --- haskell-hoogle-4.2.10.orig/src/Web/Server.hs	2012-09-13 10:00:53.975656209 +0900
-+++ haskell-hoogle-4.2.10/src/Web/Server.hs	2012-09-13 16:29:32.680340578 +0900
++++ haskell-hoogle-4.2.10/src/Web/Server.hs	2012-10-05 01:07:30.000000000 +0900
 @@ -1,6 +1,6 @@
  {-# LANGUAGE RecordWildCards, ScopedTypeVariables, PatternGuards #-}
  
@@ -12,8 +12,8 @@
  import General.Web
 Index: haskell-hoogle-4.2.10/src/Web/All.hs
 ===================================================================
---- haskell-hoogle-4.2.10.orig/src/Web/All.hs	2012-09-13 16:29:32.648340414 +0900
-+++ haskell-hoogle-4.2.10/src/Web/All.hs	2012-09-22 15:01:38.137179335 +0900
+--- haskell-hoogle-4.2.10.orig/src/Web/All.hs	2012-10-05 01:07:30.000000000 +0900
++++ haskell-hoogle-4.2.10/src/Web/All.hs	2012-10-05 01:23:02.354839824 +0900
 @@ -2,11 +2,13 @@
  module Web.All(action) where
  
@@ -28,7 +28,7 @@
  import Paths_hoogle
  
  
-@@ -15,4 +17,17 @@
+@@ -15,4 +17,21 @@
  action q = do
    f <- readFile' =<< getDataFileName ("resources" </> "template" <.> "html")
    let t = loadTemplates f
@@ -43,7 +43,11 @@
 +      go t d p | "/file/usr/share/doc/" `isPrefixOf` p =
 +        let p' = if "/" `isSuffixOf` p then p ++ "index.html" else p
 +        in rewriteRootLinks =<< serveFile False (fromJust (stripPrefix "/file" p'))
-+      go t _ _ = response responseArgs{templates=t} q
++      go t _ _ = rewriteRootLinks =<< response responseArgs{templates=t} q
 +
 +rewriteRootLinks :: Response -> IO Response
-+rewriteRootLinks = responseRewrite $ lbsReplace (fromString "href=\"/") (fromString "href=\"/cgi-bin/hoogle/file/")
++rewriteRootLinks = responseRewrite $ foldl1 (.) $ map f p
++  where
++    p = [("href=\"/", "href=\"/cgi-bin/hoogle/file/") 
++        ,("href='file:/", "href='/cgi-bin/hoogle/file/")]
++    f (f,t) = lbsReplace (fromString f) (fromString t)





More information about the Pkg-haskell-commits mailing list