[cups.bugs] [MOD] STR #3878: httpSeparateURI not handling combination of port and option correctly

Malcolm McLean malcolmrmclean at gmail.com
Thu Jun 30 19:24:18 PDT 2011


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

In the httpSeparateURI method, the code that strips out the port number
does not make provision for there being options afterward, as indicated in
the documentation:
socket://ip-address-or-hostname:port-number?waiteof=false

This means that supplying a printer URI of:
socket://172.18.24.100:9101?waiteof=false
results in the port number being returned as 0 and therefore getting
defaulted to 9100 within socket.c.

The specific portion of code causing this problem is this:
if (*uri != '/' && *uri)
{
  *port = 0;
  return (HTTP_URI_BAD_PORT);
}

That condition only allows for the port number to be the last thing in the
URI or to be followed by a /.

Changing this if statement to
if (*uri != '/' && *uri != '?' && *uri)
also allows the port number to be followed by options.

I've attached a patch file.

Link: http://www.cups.org/str.php?L3878
Version: 1.4.7
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cups-uriportfix.patch
URL: <https://lists.cups.org/pipermail/cups/attachments/20110630/5c2b8323/attachment.ksh>


More information about the cups mailing list