[PATCH] Fix deprecation warning in zeroconf with huge port number

Benoit Boissinot bboissin at gmail.com
Tue Oct 14 10:13:57 CDT 2008


On Fri, Oct 10, 2008 at 9:42 PM, Augie Fackler <durin42 at gmail.com> wrote:
> When a really large port number is specified, hg serve will just do a
> bitwise and with 65535 and use that (as best I've ever been able to tell).
> This causes the Zeroconf plugin to behave the same way. It may not be the
> correct place to make such a change though, this was just my best guess.

I'm not sure. Looking at the code, I don't think hgweb should be used.
I think it
should instead make MercurialHTTPServer available in mercurial.hgweb.server
and subclass+monkeypatch it.

Then MercurialHTTPServer could be fixed to do the bitwise &.

Unless I'm missing something I don't think we want to advertize repo
not published
via `hg serve`.

By the way does zeroconf doesn't seem to work over ipv6 (from my
limited testing).

regards,

Benoit

>
> # HG changeset patch
> # User Augie Fackler <durin42 at gmail.com>
> # Date 1223667646 18000
> # Node ID 6b904ea34356740bfd3a0b72251e5cdee5c6c252
> # Parent  4e2f40823c143148052025ee4a6aac471a709dab
> Fix a deprecation warning if the user specifies a port over 65535.
>
> diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py
> --- a/hgext/zeroconf/Zeroconf.py
> +++ b/hgext/zeroconf/Zeroconf.py
> @@ -664,7 +664,7 @@
>        def writeShort(self, value):
>                """Writes an unsigned short to the packet"""
>                format = '!H'
> -               self.data.append(struct.pack(format, value))
> +               self.data.append(struct.pack(format, value & 65535))
>                self.size += 2
>
>        def writeInt(self, value):
>
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
>


More information about the Mercurial-devel mailing list