[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sks-devel] Re: do not use server:port in links, if possible
From: |
Yaron M. Minsky |
Subject: |
Re: [Sks-devel] Re: do not use server:port in links, if possible |
Date: |
Thu, 22 Apr 2004 07:37:06 -0400 |
Thanks for catching this. I'll get it included in the mainline Real
Soon Now (tm).
By the way, have you given arch/tla a spin? It's a nice way to handle
patch management, and in particular makes it easy to maintain local
changes to your own tree while keeping up with mainline development.
y
On Wed, 2004-04-21 at 15:26, Peter Palfrader wrote:
> On Wed, 21 Apr 2004, Peter Palfrader wrote:
>
> > In my setup I have apache listening on port 80, and mod_proxy it to
> > 11371 for /pks. On 11371 sks is listening.
> >
> > The problem is that links created by sks always include servername and
> > port, so a user accessing it on port 80 will sooner rather than later
> > come to a link that sends him to port 11371. There are users who cannot
> > access that port however.
> >
> > This patch makes sks use href="/pks/..." instead of
> > href="http://server:port/pks...".
> >
> >
> > diff -ruN sks-1.0.7-old/htmlTemplates.ml sks-1.0.7/htmlTemplates.ml
> > --- sks-1.0.7-old/htmlTemplates.ml Wed Dec 10 03:12:34 2003
> > +++ sks-1.0.7/htmlTemplates.ml Wed Apr 21 20:55:30 2004
> > @@ -47,13 +47,16 @@
> > (Str.global_replace br_regexp " | " title) title body
> >
> > let link ~hostname ~op ~hash ~fingerprint ~port ~keyid =
> > - sprintf "http://%s:%d/pks/lookup?op=%s%s%s&search=0x%s"
> > - hostname
> > - port
> > + let path = sprintf "pks/lookup?op=%s%s%s&search=0x%s"
> ^ adding a / here helps..
> > op
> > (if hash then "&hash=on" else "")
> > (if fingerprint then "&fingerprint=on" else "")
> > keyid
> > + in
> > + if !Settings.links_include_server then
> > + sprintf "http://%s:%d/%s" hostname port path
> ^ and then this one is not needed.
>
>
> Here's the new patch:
>
>
> diff -ruN sks-1.0.7-old/htmlTemplates.ml sks-1.0.7/htmlTemplates.ml
> --- sks-1.0.7-old/htmlTemplates.ml Wed Dec 10 03:12:34 2003
> +++ sks-1.0.7/htmlTemplates.ml Wed Apr 21 21:09:39 2004
> @@ -47,13 +47,16 @@
> (Str.global_replace br_regexp " | " title) title body
>
> let link ~hostname ~op ~hash ~fingerprint ~port ~keyid =
> - sprintf "http://%s:%d/pks/lookup?op=%s%s%s&search=0x%s"
> - hostname
> - port
> + let path = sprintf "/pks/lookup?op=%s%s%s&search=0x%s"
> op
> (if hash then "&hash=on" else "")
> (if fingerprint then "&fingerprint=on" else "")
> keyid
> + in
> + if !Settings.links_include_server then
> + sprintf "http://%s:%d%s" hostname port path
> + else
> + path
>
> let keyinfo_header = "Type bits/keyID Date User ID"
>
> @@ -76,8 +79,11 @@
> sprintf "\t Fingerprint=%s" fp
>
> let hash_link ~hostname ~port ~hash =
> - sprintf "http://%s:%d/pks/lookup?op=hget&search=%s"
> - hostname port hash
> + let path = sprintf "/pks/lookup?op=hget&search=%s" hash in
> + if !Settings.links_include_server then
> + sprintf "http://%s:%d%s" hostname port path
> + else
> + path
>
> let hash ~hostname ~port ~hash =
> sprintf "\t Hash=<a href=%s>%s</a>"
> diff -ruN sks-1.0.7-old/settings.ml sks-1.0.7/settings.ml
> --- sks-1.0.7-old/settings.ml Tue Dec 9 22:33:31 2003
> +++ sks-1.0.7/settings.ml Wed Apr 21 20:50:05 2004
> @@ -133,6 +133,9 @@
> let hostname = ref (Unix.gethostname ())
> let set_hostname value = hostname := value
>
> +let links_include_server = ref false
> +let set_links_include_server value = links_include_server := value
> +
> let filelog = ref true
>
> let transactions = ref true
> @@ -230,6 +233,7 @@
> "in one shot");
> ("-seed", Arg.Int set_seed, "Seed used by RNG");
> ("-hostname", Arg.String set_hostname, "current hostname");
> + ("-links_include_server", Arg.Set links_include_server, "HTTP links
> include server and port ");
> ("-d", Arg.Int set_drop, "Number of keys to drop at random " ^
> "when synchronizing");
> ("-n", Arg.Int set_n, "Multiple of 15,000 keys to load at once");
>
> ______________________________________________________________________
> _______________________________________________
> Sks-devel mailing list
> address@hidden
> http://mail.nongnu.org/mailman/listinfo/sks-devel
--
|--------/ Yaron M. Minsky \--------|
|--------\ http://www.cs.cornell.edu/home/yminsky/ /--------|
Open PGP --- KeyID B1FFD916
Fingerprint: 5BF6 83E1 0CE3 1043 95D8 F8D5 9F12 B3A9 B1FF D916