[MPlayer-dev-eng] [PATCH 3/7] Use authorization field to pass server authentication through proxy
Clément Bœsch
ubitux at gmail.com
Sun Nov 21 14:24:26 CET 2010
On Sat, Nov 20, 2010 at 09:54:38PM +0100, Reimar Döffinger wrote:
> 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.
What about this? It may be a bit overkill thought…
--
Clément B.
Not sent from a jesusPhone.
More information about the MPlayer-dev-eng
mailing list