Fixed HTTP repositories in non standard HTTP port (80).

The code didn't take into account for different ports and simply ignored
them, now they work correctly. This fixes issue 10 in googlecode.
This commit is contained in:
Juan RP 2011-10-06 19:05:16 +02:00
parent e43603847e
commit 024bec0045
3 changed files with 20 additions and 4 deletions

5
NEWS
View File

@ -1,4 +1,9 @@
xbps-0.10.0 (???): xbps-0.10.0 (???):
* Fixed issue 10 "HTTP repositories in non standard HTTP port currently segfault".
You can now any HTTP server in non standard ports, like:
http://yourhost:8080/your/repo
* xbps-bin(8): the 'check' target now detects broken symlinks and marks * xbps-bin(8): the 'check' target now detects broken symlinks and marks
them as critical errors. them as critical errors.

View File

@ -33,7 +33,12 @@
xbps-repo(8), with the exception for updating xbps-repo(8), with the exception for updating
on which all repositories will be looked at and on which all repositories will be looked at and
the newest version will be choosen. the newest version will be choosen.
Optionally a non default HTTP port can also be
specified like that:
http://foo.local:8080/xbps-repo
The order matters, and the top-most matching a package The order matters, and the top-most matching a package
pattern or name will be used. pattern or name will be used.

View File

@ -56,14 +56,20 @@ xbps_get_remote_repo_string(const char *uri)
* Replace '.' ':' and '/' characters with underscores, so that * Replace '.' ':' and '/' characters with underscores, so that
* provided URL: * provided URL:
* *
* http://www.foo.org/blah/xbps/binpkg-repo * http://nocturno.local:8080/blah/xbps/binpkg-repo
* *
* becomes: * becomes:
* *
* http___www_foo_org_blah_xbps_binpkg_repo * http___nocturno_local_8080_blah_xbps_binpkg_repo
* *
*/ */
p = xbps_xasprintf("%s://%s%s", url->scheme, url->host, url->doc); if (url->port != 0)
p = xbps_xasprintf("%s://%s:%u%s", url->scheme,
url->host, url->port, url->doc);
else
p = xbps_xasprintf("%s://%s%s", url->scheme,
url->host, url->doc);
fetchFreeURL(url); fetchFreeURL(url);
if (p == NULL) if (p == NULL)
return NULL; return NULL;