Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for gen-full-url uri scheme #9

Open
bahollis opened this issue Feb 26, 2012 · 0 comments
Open

Fix for gen-full-url uri scheme #9

bahollis opened this issue Feb 26, 2012 · 0 comments

Comments

@bahollis
Copy link

I have prepared a small patch that fixes the assumption that all urls use the :http uri scheme

From 8deaa520518d8c24e4fb140929d36c3e90ac9fd3 Mon Sep 17 00:00:00 2001
From: Brian Hollis <[email protected]>
Date: Sun, 26 Feb 2012 01:11:22 -0600
Subject: [PATCH] Modified gen-full-url to detect bound ssl acceptor and set
 uri scheme accordingly.

---
 src/route.lisp |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/route.lisp b/src/route.lisp
index 6c3cea1..a4fe5c6 100644
--- a/src/route.lisp
+++ b/src/route.lisp
@@ -211,12 +211,14 @@
                                        (submodule-full-baseurl *submodule*)
                                        (route-symbol-template route))
                           args)))
-    (setf (puri:uri-scheme uri)
-          :http)
-    (setf (puri:uri-host uri)
-          (if (boundp 'hunchentoot:*request*)
-                      (hunchentoot:host)
-                      "localhost"))
+
+    (if (boundp 'hunchentoot:*request*)
+       (setf (puri:uri-scheme uri) (if (hunchentoot:ssl-p) :https :http)
+             (puri:uri-host uri) (hunchentoot:host))
+
+       (setf (puri:uri-scheme uri) :http
+             (puri:uri-host uri) "localhost"))
+
     (puri:render-uri uri nil)))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
--
1.7.6.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant