[gPXE-devel] [PATCH 11/31] [uri] fix URI parsing for IPv6 + ports (ie http://[fc00::1]:1234)
matthew at theiselins.net
matthew at theiselins.net
Fri Jul 8 10:28:20 EDT 2011
From: Matthew Iselin <matthew at theiselins.net>
Signed-off-by: Matthew Iselin <matthew at theiselins.net>
---
src/core/uri.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/core/uri.c b/src/core/uri.c
index 1cbf1f1..d339faa 100644
--- a/src/core/uri.c
+++ b/src/core/uri.c
@@ -166,10 +166,9 @@ struct uri * parse_uri ( const char *uri_string ) {
}
/* Split host into host[:port] */
- if ( ( tmp = strchr ( uri->host, ':' ) ) ) {
+ if ( ( tmp = strrchr ( uri->host, ':' ) ) ) {
/* Make sure an IPv6 address isn't broken up. */
- if ( ( strchr ( uri->host, '[' ) == 0 ) ||
- ( tmp > strchr ( uri->host, ']' ) ) ) {
+ if ( ( tmp > strchr ( uri->host, ']' ) ) ) {
*(tmp++) = '\0';
uri->port = tmp;
}
--
1.7.2.5
More information about the gPXE-devel
mailing list