[MPlayer-dev-eng] [PATCH 3/7] Use authorization field to pass server authentication through proxy
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Sat Nov 20 21:54:38 CET 2010
On Fri, Nov 19, 2010 at 02:57:28PM +0100, Clément Bœsch wrote:
> + noauth_len = strlen(Curl->protocol) + strlen(Curl->hostname) +
> + strlen(Curl->file) + sizeof("://:65535");
Eeek. Is there even a check that limits the port number to 65535?
Either way I think this needs to be done in some simpler way.
Maybe using the snprintf return value + 1 when calling it with size == 0.
A bit of a waste of CPU time but shouldn't be that bad.
> + if (Curl->port)
> + snprintf(Curl->noauth_url, noauth_len, "%s://%s:%d%s",
> + Curl->protocol, Curl->hostname, Curl->port, Curl->file);
> + else
> + snprintf(Curl->noauth_url, noauth_len, "%s://%s%s",
> + Curl->protocol, Curl->hostname, Curl->file);
To avoid code duplication I'd put that maybe in a helper funtion that
takes the noauth_len as argument.
More information about the MPlayer-dev-eng
mailing list