Unfortunately, this leaves things in an unnice way when one wants to change the port but the original request came in on a nonstandard port. In this case we end up redirecting to, e.g., https://foo.com: 4242:4243/the_url , which is no good. It's easy enough to pass in a host, but perhaps we should strip off the port from the host if a host is explicitly provided?
Thanks,
Cyrus
On Apr 28, 2007, at 2:47 PM, Cyrus Harmon wrote:
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*))))
"Redirects the browser to TARGET which should be a string.port permanently)
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))))
(when add-session-id (setq url (add-cookie-value-to-url url :replace-ampersands-phost port target))))
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
tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel