Hi there,

if a uri string does not contain an explicit port, apr_uri_parse does not add the default port from the scheme.

Although uri/apr_uri.c contains the line

893         uptr->port = apr_uri_port_of_scheme(uptr->scheme);

it doesn't reach it when the port is missing:

872         if (s == NULL) {
873             /* we expect the common case to have no port */
874             uptr->hostname = apr_pstrmemdup(p,
875                                             hostinfo + v6_offset1,
876 uri - hostinfo - v6_offset2);
877             goto deal_with_path;
878         }

So it jumps back to the deal_with_path label and the code there always returns without getting back to line 893.

Is it desirable for apr_uri_parse to add the default port for a scheme? If so, should it be a 1.7.x+ patch only or would that be a valid backport to 1.6.x as well?

I can create a PR if this seems desirable.

I noticed the behavior when adding an http SSLOCSPProxyURL without port to an httpd config. The resulting OCSP request from the web server went to port 0 instead of 80 ...

Best regards,

Rainer




Reply via email to