[hunchentoot-devel] host/port question

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

On Sat, 28 Apr 2007 14:47:56 -0700, Cyrus Harmon <ch-tbnl@bobobeach.com> wrote:
Should these two notions be more "decoupled" or should I just think host:port when I see host?
I think it makes sense to allow for a separate PORT parameter. You can still provide "foo.com:4242" as the HOST argument, if you want. It's in the new release. Thanks, Edi.

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*)))) + 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
_______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel

Hi Edi, Yes, that was what I meant to say. Thanks, Cyrus On Jul 18, 2007, at 1:16 PM, Edi Weitz wrote:
On Wed, 18 Jul 2007 12:51:51 -0700, Cyrus Harmon <ch- tbnl@bobobeach.com> wrote:
but perhaps we should strip off the port from the host if a host is explicitly provided?
You mean if a port is provided? Yes, sounds reasonable. _______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel
participants (2)
-
Cyrus Harmon
-
Edi Weitz