~ubuntu-branches/ubuntu/utopic/nordugrid-arc/utopic

« back to all changes in this revision

Viewing changes to src/hed/libs/common/URL.cpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2014-05-01 20:51:02 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20140501205102-icy9t3348uxobyx7
Tags: 4.1.0-1
* 4.1.0 Release
* Call dh_autoreconf to support ppc64le (Closes: #744639)

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
      ldapscope(base),
105
105
      valid(false) {}
106
106
 
107
 
  URL::URL(const std::string& url, bool encoded)
 
107
  URL::URL(const std::string& url, bool encoded, int defaultPort, const std::string& defaultPath)
108
108
    : ip6addr(false),
109
109
      port(-1),
110
110
      ldapscope(base),
277
277
      }
278
278
    }
279
279
 
 
280
    if (path.empty() && !defaultPath.empty()) {
 
281
      path += defaultPath;
 
282
    }
 
283
 
280
284
    // At this point path must be absolutely absolute (starts with /) or empty
281
285
    if ((!path.empty()) && (path[0] != '/')) {
282
286
      URLLogger.msg(VERBOSE, "Illegal URL - path must be absolute or empty: %s", url);
331
335
      if (ip6addr) host = host.substr(1,host.length()-2);
332
336
    }
333
337
 
334
 
    if (port == -1) {
 
338
    if (port == -1 && defaultPort != -1) {
 
339
      port = defaultPort;
 
340
    }
 
341
    else if (port == -1) {
335
342
      // If port is not default set default one
336
343
      if (protocol == "rc") port = RC_DEFAULT_PORT;
337
344
      if (protocol == "http") port = HTTP_DEFAULT_PORT;