[hunchentoot-devel] host/port question

Cyrus Harmon ch-tbnl at bobobeach.com
Sat Apr 28 21:47:56 UTC 2007


I'm not sure what "the right thing" here is, but it struck me as odd  
that redirect didn't include a port argument, so I made the following  
changes to redirect:

--- hunchentoot-0.9.0/misc.lisp 2007-03-30 14:01:27.000000000 -0700
+++ ../hunchentoot-0.9.0/misc.lisp      2007-04-27 22:45:00.000000000  
-0700
@@ -229,6 +229,7 @@
                               (add-session-id (not (or host-provided-p
                                                        (starts-with- 
scheme-p target)
                                                        (cookie-in  
*session-cookie-name*))))
+                             port
                               permanently)
    "Redirects the browser to TARGET which should be a string.
If TARGET is a full URL starting with a scheme, HOST and PROTOCOL
@@ -240,11 +241,11 @@
otherwise a 302."
    (let ((url (if (starts-with-scheme-p target)
                 target
-               (format nil "~A://~A~A"
+               (format nil "~A://~A~@[:~A~]~A"
                         (ecase protocol
                           ((:http) "http")
                           ((:https) "https"))
-                       host target))))
+                       host port target))))
      (when add-session-id
        (setq url (add-cookie-value-to-url url :replace-ampersands-p  
nil)))
      (setf (header-out :location)


but then I realized that what we call "host" here really is  
host:port. Should these two notions be more "decoupled" or should I  
just think host:port when I see host?

Thanks,

Cyrus




More information about the Tbnl-devel mailing list