From 1376aad9b3fd1fa3c42a220dafeadaa63387f7a2 Mon Sep 17 00:00:00 2001
From: Roman Tsisyk <roman@tsisyk.com>
Date: Thu, 25 Sep 2014 13:07:08 +0400
Subject: [PATCH] Refactor src/uri.rl to support RFC3986 and add Lua bindings

 * Split parser and resolver in src/uri.rl
 * Extend URI parser grammar to fully support RFC3986
 * Add Lua bindings to URI parser
 * Implement proper DNS logic in coio_connect() /
   evio_service_bind()
 * Replace uri_to_string() with sio_strfaddr()

Prerequisite for #447
---
 src/CMakeLists.txt        |    5 +-
 src/box/box.cc            |    9 +-
 src/box/replica.cc        |   52 +-
 src/box/replica.h         |    9 +-
 src/box/xrow.cc           |   32 +-
 src/box/xrow.h            |    5 +-
 src/coeio.cc              |    5 +-
 src/coio.cc               |  127 +-
 src/coio.h                |   20 +-
 src/evio.cc               |  139 +-
 src/evio.h                |   17 +-
 src/lua/init.cc           |    2 +
 src/lua/uri.lua           |   60 +
 src/sio.cc                |   26 +-
 src/uri.c                 | 6528 +++++++++++++++++++++++++++++++++++++
 src/uri.cc                | 5538 -------------------------------
 src/uri.h                 |   62 +-
 src/uri.rl                |  410 +--
 test/app/console.test.lua |    2 +-
 test/app/uri.result       |   25 +
 test/app/uri.test.lua     |   46 +
 test/unit/CMakeLists.txt  |    2 +-
 test/unit/uri.c           |  222 ++
 test/unit/uri.cc          |   98 -
 test/unit/uri.result      |  754 ++++-
 25 files changed, 8038 insertions(+), 6157 deletions(-)
 create mode 100644 src/lua/uri.lua
 create mode 100644 src/uri.c
 delete mode 100644 src/uri.cc
 create mode 100644 test/app/uri.result
 create mode 100755 test/app/uri.test.lua
 create mode 100644 test/unit/uri.c
 delete mode 100644 test/unit/uri.cc

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2358e0bb6b..9802084899 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -20,6 +20,7 @@ lua_source(lua_sources lua/init.lua)
 lua_source(lua_sources lua/uuid.lua)
 lua_source(lua_sources lua/digest.lua)
 lua_source(lua_sources lua/msgpackffi.lua)
+lua_source(lua_sources lua/uri.lua)
 lua_source(lua_sources lua/console.lua)
 lua_source(lua_sources lua/bsdsocket.lua)
 lua_source(lua_sources lua/errno.lua)
@@ -39,7 +40,7 @@ set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${lua_sources})
 
 add_custom_target(ragel
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-    COMMAND ragel -G2 src/uri.rl -o src/uri.cc)
+    COMMAND ragel -G2 src/uri.rl -o src/uri.c)
 
 set (common_sources
      memory.cc
@@ -73,7 +74,7 @@ set (common_sources
      fiob.c
      tt_uuid.c
      ffisyms.cc
-     uri.cc
+     uri.c
      coeio_file.cc
      lua/digest.cc
      lua/init.cc
diff --git a/src/box/box.cc b/src/box/box.cc
index ba224d310d..cc89677d19 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -114,9 +114,11 @@ box_check_replication_source(const char *source)
 	if (source == NULL)
 		return;
 	struct uri uri;
-	if (uri_parse(&uri, source)) {
-		tnt_raise(ClientError, ER_CFG,
-			  "incorrect replication source");
+
+	/* URI format is [host:]service */
+	if (uri_parse(&uri, source) || !uri.service) {
+		tnt_raise(ClientError, ER_CFG, "replication source, "
+			  "expected host:service or /unix.socket");
 	}
 }
 
@@ -134,6 +136,7 @@ static void
 box_check_config()
 {
 	box_check_wal_mode(cfg_gets("wal_mode"));
+	box_check_replication_source(cfg_gets("replication_source"));
 
 	/* check rows_per_wal configuration */
 	if (cfg_geti("rows_per_wal") <= 1) {
diff --git a/src/box/replica.cc b/src/box/replica.cc
index b31431fcd2..deff8eafbd 100644
--- a/src/box/replica.cc
+++ b/src/box/replica.cc
@@ -89,21 +89,43 @@ remote_connect(struct recovery_state *r, struct ev_io *coio,
 {
 	char greeting[IPROTO_GREETING_SIZE];
 
-	evio_socket(coio, AF_INET, SOCK_STREAM, IPPROTO_TCP);
-
+	struct remote *remote = &r->remote;
 	struct uri *uri = &r->remote.uri;
-
-	coio_connect(coio, &uri->addr, uri->addr_len);
+	/*
+	 * coio_connect() stores resolved address to \a &remote->addr
+	 * on success. &remote->addr_len is a value-result argument which
+	 * must be initialized to the size of associated buffer (addrstorage)
+	 * before calling coio_connect(). Since coio_connect() performs
+	 * DNS resolution under the hood it is theoretically possible that
+	 * remote->addr_len will be different even for same uri.
+	 */
+	remote->addr_len = sizeof(remote->addrstorage);
+	/* Prepare null-terminated strings for coio_connect() */
+	char host[URI_MAXHOST] = { '\0' };
+	if (uri->host) {
+		snprintf(host, sizeof(host), "%.*s", (int) uri->host_len,
+			 uri->host);
+	}
+	char service[URI_MAXSERVICE];
+	snprintf(service, sizeof(service), "%.*s", (int) uri->service_len,
+		 uri->service);
+	coio_connect(coio, host, service, &remote->addr, &remote->addr_len);
+	assert(coio->fd >= 0);
 	coio_readn(coio, greeting, sizeof(greeting));
 
-	say_crit("connected to master");
-	if (!r->remote.uri.login[0])
+	say_crit("connected to %s", sio_strfaddr(&remote->addr,
+						 remote->addr_len));
+
+	/* Perform authentication if user provided at least login */
+	if (!r->remote.uri.login)
 		return;
 
 	/* Authenticate */
 	say_debug("authenticating...");
 	struct xrow_header row;
-	xrow_encode_auth(&row, greeting, uri->login, uri->password);
+	xrow_encode_auth(&row, greeting, uri->login,
+			 uri->login_len, uri->password,
+			 uri->password_len);
 	remote_write_row(coio, &row);
 	remote_read_row(coio, iobuf, &row);
 	if (row.type != IPROTO_OK)
@@ -285,7 +307,7 @@ recovery_follow_remote(struct recovery_state *r)
 	assert(r->remote.reader == NULL);
 	assert(recovery_has_remote(r));
 
-	const char *uri = uri_to_string(&r->remote.uri);
+	const char *uri = uri_format(&r->remote.uri);
 	say_crit("starting replication from %s", uri);
 	snprintf(name, sizeof(name), "replica/%s", uri);
 
@@ -316,14 +338,12 @@ recovery_set_remote(struct recovery_state *r, const char *uri)
 		r->remote.source[0] = '\0';
 		return;
 	}
-	/*
-	 * @todo: as long as DNS is involved, this may fail even
-	 * on a valid uri. Don't panic in this case.
-	 */
-	if (uri_parse(&r->remote.uri, uri))
-		panic("Can't parse uri: %s", uri);
-	snprintf(r->remote.source,
-		 sizeof(r->remote.source), "%s", uri);
+	snprintf(r->remote.source, sizeof(r->remote.source), "%s", uri);
+	struct remote *remote = &r->remote;
+	int rc = uri_parse(&remote->uri, r->remote.source);
+	/* URI checked by box_check_replication_source() */
+	assert(rc == 0 && remote->uri.service != NULL);
+	(void) rc;
 }
 
 bool
diff --git a/src/box/replica.h b/src/box/replica.h
index 0f79c512ec..0883226353 100644
--- a/src/box/replica.h
+++ b/src/box/replica.h
@@ -32,15 +32,20 @@
 #include "tarantool_ev.h"
 #include <uri.h>
 
-enum { REMOTE_SOURCE_MAXLEN = 64 };
+enum { REMOTE_SOURCE_MAXLEN = 1024 }; /* enough to fit URI with passwords */
 
 /** Master connection */
 struct remote {
-	struct uri uri;
 	struct fiber *reader;
 	ev_tstamp recovery_lag, recovery_last_update_tstamp;
 	bool warning_said;
 	char source[REMOTE_SOURCE_MAXLEN];
+	struct uri uri;
+	union {
+		struct sockaddr addr;
+		struct sockaddr_storage addrstorage;
+	};
+	socklen_t addr_len;
 };
 
 /** Connect to a master and request a snapshot.
diff --git a/src/box/xrow.cc b/src/box/xrow.cc
index 520af7243e..1f5761d313 100644
--- a/src/box/xrow.cc
+++ b/src/box/xrow.cc
@@ -185,32 +185,32 @@ xrow_to_iovec(const struct xrow_header *row,
 
 void
 xrow_encode_auth(struct xrow_header *packet, const char *greeting,
-		   const char *login, const char *password)
+		 const char *login, size_t login_len,
+		 const char *password, size_t password_len)
 {
+	assert(login != NULL);
 	memset(packet, 0, sizeof(*packet));
 
-	uint32_t login_len = strlen(login);
-	uint32_t password_len = strlen(password);
-
 	enum { PACKET_LEN_MAX = 128 };
 	size_t buf_size = PACKET_LEN_MAX + login_len + SCRAMBLE_SIZE;
 	char *buf = (char *) region_alloc(&fiber()->gc, buf_size);
 
-	char salt[SCRAMBLE_SIZE];
-	char scramble[SCRAMBLE_SIZE];
-	if (base64_decode(greeting + 64, SCRAMBLE_BASE64_SIZE, salt,
-			  SCRAMBLE_SIZE) != SCRAMBLE_SIZE)
-		panic("invalid salt: %64s", greeting + 64);
-	scramble_prepare(scramble, salt, password, password_len);
-
 	char *d = buf;
-	d = mp_encode_map(d, 2);
+	d = mp_encode_map(d, password != NULL ? 2 : 1);
 	d = mp_encode_uint(d, IPROTO_USER_NAME);
 	d = mp_encode_str(d, login, login_len);
-	d = mp_encode_uint(d, IPROTO_TUPLE);
-	d = mp_encode_array(d, 2);
-	d = mp_encode_str(d, "chap-sha1", strlen("chap-sha1"));
-	d = mp_encode_str(d, scramble, SCRAMBLE_SIZE);
+	if (password != NULL) { /* password can be omitted */
+		char salt[SCRAMBLE_SIZE];
+		char scramble[SCRAMBLE_SIZE];
+		if (base64_decode(greeting + 64, SCRAMBLE_BASE64_SIZE, salt,
+				  SCRAMBLE_SIZE) != SCRAMBLE_SIZE)
+			panic("invalid salt: %64s", greeting + 64);
+		scramble_prepare(scramble, salt, password, password_len);
+		d = mp_encode_uint(d, IPROTO_TUPLE);
+		d = mp_encode_array(d, 2);
+		d = mp_encode_str(d, "chap-sha1", strlen("chap-sha1"));
+		d = mp_encode_str(d, scramble, SCRAMBLE_SIZE);
+	}
 
 	assert(d <= buf + buf_size);
 	packet->body[0].iov_base = buf;
diff --git a/src/box/xrow.h b/src/box/xrow.h
index f1b7aa62d0..9cf1327779 100644
--- a/src/box/xrow.h
+++ b/src/box/xrow.h
@@ -83,11 +83,14 @@ xrow_decode_error(struct xrow_header *row);
  * \param[out] row
  * \param greeting - IPROTO greeting
  * \param login - user login
+ * \param login_len - length of \a login
  * \param password - user password
+ * \param password_len - length of \a password
 */
 void
 xrow_encode_auth(struct xrow_header *row, const char *greeting,
-		 const char *login, const char *password);
+		 const char *login, size_t login_len,
+		 const char *password, size_t password_len);
 
 /**
  * \brief Encode SUBSCRIBE command
diff --git a/src/coeio.cc b/src/coeio.cc
index 223b5223c5..689ac380da 100644
--- a/src/coeio.cc
+++ b/src/coeio.cc
@@ -260,8 +260,9 @@ coeio_resolve(int socktype, const char *host, const char *port,
 	hints.ai_protocol = 0;
 	/* do resolving */
 	errno = 0;
-	if (coeio_custom(getaddrinfo_cb, timeout, host, port,
-			 &hints, &result))
+	/* make no difference between empty string and NULL for host */
+	if (coeio_custom(getaddrinfo_cb, timeout, (host && *host) ? host : NULL,
+			 port, &hints, &result))
 		return NULL;
 	return result;
 }
diff --git a/src/coio.cc b/src/coio.cc
index e5cbe14e58..e3d92a0d7f 100644
--- a/src/coio.cc
+++ b/src/coio.cc
@@ -28,12 +28,15 @@
  */
 #include "coio.h"
 
+#include <sys/socket.h>
+#include <sys/un.h>
 #include <netinet/tcp.h>
 #include <stdio.h>
 
 #include "iobuf.h"
 #include "sio.h"
 #include "scoped_guard.h"
+#include "coeio.h" /* coeio_resolve() */
 
 struct CoioGuard {
 	struct ev_io *ev_io;
@@ -78,28 +81,23 @@ coio_fiber_yield_timeout(struct ev_io *coio, ev_tstamp delay)
 	return is_timedout;
 }
 
-/**
- * Connect to a host.
- */
-void
-coio_connect(struct ev_io *coio, struct sockaddr *addr, socklen_t addr_len)
-{
-	coio_connect_timeout(coio, addr, addr_len, TIMEOUT_INFINITY);
-}
-
 /**
  * Connect to a host with a specified timeout.
- * @retval true timeout
- * @retval false connected
+ * @retval -1 timeout
+ * @retval 0 connected
  */
-bool
-coio_connect_timeout(struct ev_io *coio, struct sockaddr *addr,
-		     socklen_t len, ev_tstamp timeout)
+static int
+coio_connect_addr(struct ev_io *coio, struct sockaddr *addr,
+		  socklen_t len, ev_tstamp timeout)
 {
-	if (sio_connect(coio->fd, addr, len) == 0)
-		return false;
-	assert(errno == EINPROGRESS);
 	ev_loop *loop = loop();
+	evio_socket(coio, addr->sa_family, SOCK_STREAM, 0);
+	auto coio_guard = make_scoped_guard([=]{ evio_close(loop, coio); });
+	if (sio_connect(coio->fd, addr, len) == 0) {
+		coio_guard.is_active = false;
+		return 0;
+	}
+	assert(errno == EINPROGRESS);
 	/*
 	 * Wait until socket is ready for writing or
 	 * timed out.
@@ -111,7 +109,7 @@ coio_connect_timeout(struct ev_io *coio, struct sockaddr *addr,
 	fiber_testcancel();
 	if (is_timedout) {
 		errno = ETIMEDOUT;
-		return true;
+		return -1;
 	}
 	int error = EINPROGRESS;
 	socklen_t sz = sizeof(error);
@@ -121,50 +119,87 @@ coio_connect_timeout(struct ev_io *coio, struct sockaddr *addr,
 		errno = error;
 		tnt_raise(SocketError, coio->fd, "connect");
 	}
-	return false;
+	coio_guard.is_active = false;
+	return 0;
 }
 
 /**
- * Connect to a first address in addrinfo list and initialize coio
- * with connected socket.
+ * Resolve hostname:service from \a uri and connect to the first available
+ * address with a specified timeout.
  *
- * If coio is already initialized, socket family,
- * type and protocol must match the remote address.
+ * If \a addr is not NULL the function provides resolved address on success.
+ * In this case, \a addr_len is a value-result argument. It should be
+ * initialized to the size of the buffer associated with \a addr. Upon return,
+ * \a addr_len is updated to contain the actual size of the source address.
+ * The returned address is truncated if the buffer provided is too small;
+ * in this case, addrlen will return a value greater than was supplied to the
+ * call.
  *
- * @retval true  timeout
- * @retval false sucess
+ * This function also supports UNIX domain sockets if uri->path is not NULL and
+ * uri->service is NULL.
+ *
+ * @retval -1 timeout
+ * @retval 0 connected
  */
-bool
-coio_connect_addrinfo(struct ev_io *coio, struct addrinfo *ai,
-		      ev_tstamp timeout)
+int
+coio_connect_timeout(struct ev_io *coio, const char *host, const char *service,
+		     struct sockaddr *addr, socklen_t *addr_len,
+		     ev_tstamp timeout)
 {
+	/* try to resolve a hostname */
+	struct ev_loop *loop = loop();
 	ev_tstamp start, delay;
-	ev_loop *loop = loop();
+	evio_timeout_init(loop, &start, &delay, timeout);
+
+	assert(service != NULL);
+	if (strcmp(host, URI_HOST_UNIX) == 0) {
+		/* UNIX socket */
+		struct sockaddr_un un;
+		snprintf(un.sun_path, sizeof(un.sun_path), "%s", service);
+		un.sun_family = AF_UNIX;
+		if (coio_connect_addr(coio, (struct sockaddr *) &un, sizeof(un),
+				      delay) != 0)
+			return -1;
+		if (addr != NULL) {
+			assert(addr_len != NULL);
+			*addr_len = MIN(sizeof(un), *addr_len);
+			memcpy(addr, &un, *addr_len);
+		}
+		return 0;
+	}
+
+	struct addrinfo *ai = coeio_resolve(SOCK_STREAM, host, service, delay);
+	if (ai == NULL)
+		return -1; /* timeout */
+
+	auto addrinfo_guard = make_scoped_guard([=]{ freeaddrinfo(ai); });
+	evio_timeout_update(loop(), start, &delay);
+
 	coio_timeout_init(&start, &delay, timeout);
 	assert(! evio_is_active(coio));
-	bool res = true;
 	while (ai) {
 		try {
-			evio_socket(coio, ai->ai_family,
-				    ai->ai_socktype,
-				    ai->ai_protocol);
-			res = coio_connect_timeout(coio, ai->ai_addr,
-					ai->ai_addrlen, delay);
-			if (res)
-				evio_close(loop, coio);
-			return res;
+			if (coio_connect_addr(coio, ai->ai_addr,
+					      ai->ai_addrlen, delay))
+				return -1;
+			if (addr != NULL) {
+				assert(addr_len != NULL);
+				*addr_len = MIN(ai->ai_addrlen, *addr_len);
+				memcpy(addr, ai->ai_addr, *addr_len);
+			}
+			return 0; /* connected */
 		} catch (SocketError *e) {
-			if (res)
-				evio_close(loop, coio);
-			if (ai->ai_next == NULL)
-				throw;
-			ev_now_update(loop);
-			coio_timeout_update(start, &delay);
+			/* ignore */
+			say_error("failed to connect to %s: %s",
+				  sio_strfaddr(ai->ai_addr, ai->ai_addrlen),
+				  e->errmsg());
 		}
 		ai = ai->ai_next;
+		ev_now_update(loop);
+		coio_timeout_update(start, &delay);
 	}
-	/* unreachable. */
-	tnt_raise(SocketError, coio->fd, "connect_addrinfo()");
+
+	tnt_raise(SocketError, coio->fd, "connection failed");
 }
 
 /**
diff --git a/src/coio.h b/src/coio.h
index 35d030e769..876778a44c 100644
--- a/src/coio.h
+++ b/src/coio.h
@@ -44,16 +44,18 @@ struct coio_service
 	void *handler_param;
 };
 
-void
-coio_connect(struct ev_io *coio, struct sockaddr *addr, socklen_t addr_len);
-
-bool
-coio_connect_timeout(struct ev_io *coio, struct sockaddr *addr,
-		     socklen_t len, ev_tstamp timeout);
+int
+coio_connect_timeout(struct ev_io *coio, const char *host, const char *service,
+		     struct sockaddr *addr, socklen_t *addr_len,
+		     ev_tstamp timeout);
 
-bool
-coio_connect_addrinfo(struct ev_io *coio, struct addrinfo *ai,
-		      ev_tstamp timeout);
+static inline int
+coio_connect(struct ev_io *coio, const char *host, const char *service,
+	     struct sockaddr *addr, socklen_t *addr_len)
+{
+	return coio_connect_timeout(coio, host, service, addr, addr_len,
+				    TIMEOUT_INFINITY);
+}
 
 void
 coio_bind(struct ev_io *coio, struct sockaddr *addr,
diff --git a/src/evio.cc b/src/evio.cc
index 2d4f8249aa..75b721161c 100644
--- a/src/evio.cc
+++ b/src/evio.cc
@@ -30,37 +30,14 @@
 #include "uri.h"
 #include "scoped_guard.h"
 #include <stdio.h>
+#include <sys/socket.h>
+#include <sys/un.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <arpa/inet.h>
 
 #define BIND_RETRY_DELAY 0.1
 
-/**
- * Try to convert IPv4 or IPv6 addresses from text to binary form.
- * sa buf must be sizeo of sizeof(sockaddr_in6).
- */
-int
-evio_pton(const char *addr, const char *port, struct sockaddr_storage *sa, socklen_t *salen) {
-	struct sockaddr_in *v4 = (struct sockaddr_in*)sa;
-	int rc = inet_pton(AF_INET, addr, &v4->sin_addr);
-	if (rc) {
-		v4->sin_family = AF_INET;
-		v4->sin_port = htons(atoi(port));
-		*salen = sizeof(struct sockaddr_in);
-		return AF_INET;
-	}
-	struct sockaddr_in6 *v6 = (struct sockaddr_in6*)sa;
-	rc = inet_pton(AF_INET6, addr, &v6->sin6_addr);
-	if (rc) {
-		v6->sin6_family = AF_INET6;
-		v6->sin6_port = htons(atoi(port));
-		*salen = sizeof(struct sockaddr_in6);
-		return AF_INET6;
-	}
-	return -1;
-}
-
 /** Note: this function does not throw. */
 void
 evio_close(ev_loop *loop, struct ev_io *evio)
@@ -133,37 +110,6 @@ evio_setsockopt_tcpserver(int fd)
 		       &linger, sizeof(linger));
 }
 
-/**
- * Bind to a first address in addrinfo list and initialize coio
- * with bound socket.
- */
-void
-evio_bind_addrinfo(struct ev_io *evio, struct addrinfo *ai)
-{
-	assert(! evio_is_active(evio));
-	int fd = -1;
-	while (ai) {
-		try {
-			fd = sio_socket(ai->ai_family, ai->ai_socktype,
-					ai->ai_protocol);
-			evio_setsockopt_tcpserver(fd);
-			if (sio_bind(fd, ai->ai_addr, ai->ai_addrlen) == 0) {
-				evio->fd = fd;
-				return; /* success. */
-			}
-			assert(errno == EADDRINUSE);
-		} catch (SocketError *e) {
-			if (ai->ai_next == NULL) {
-				close(fd);
-				throw;
-			}
-		}
-		close(fd);
-		ai = ai->ai_next;
-	}
-	tnt_raise(SocketError, evio->fd, "evio_bind_addrinfo()");
-}
-
 static inline const char *
 evio_service_name(struct evio_service *service)
 {
@@ -191,7 +137,7 @@ evio_service_accept_cb(ev_loop * /* loop */, ev_io *watcher,
 		if (fd < 0) /* EAGAIN, EWOULDLOCK, EINTR */
 			return;
 		/* set common tcp options */
-		evio_setsockopt_tcp(fd, service->port.addr.sa_family);
+		evio_setsockopt_tcp(fd, service->addr.sa_family);
 		/*
 		 * Invoke the callback and pass it the accepted
 		 * socket.
@@ -212,23 +158,25 @@ evio_service_accept_cb(ev_loop * /* loop */, ev_io *watcher,
  * needs to retry binding.
  */
 static int
-evio_service_bind_and_listen(struct evio_service *service)
+evio_service_bind_addr(struct evio_service *service)
 {
+	say_debug("%s: binding to %s...", evio_service_name(service),
+		  sio_strfaddr(&service->addr, service->addr_len));
 	/* Create a socket. */
-	int fd = sio_socket(service->port.addr.sa_family,
+	int fd = sio_socket(service->addr.sa_family,
 		SOCK_STREAM, IPPROTO_TCP);
 
 	try {
 		evio_setsockopt_tcpserver(fd);
 
-		if (sio_bind(fd, &service->port.addr,
-				service->port.addr_len) || sio_listen(fd)) {
+		if (sio_bind(fd, &service->addr, service->addr_len) ||
+		    sio_listen(fd)) {
 			assert(errno == EADDRINUSE);
 			close(fd);
 			return -1;
 		}
-		say_info("bound to %s port %s", evio_service_name(service),
-			uri_to_string(&service->port));
+		say_info("%s: bound to %s", evio_service_name(service),
+			 sio_strfaddr(&service->addr, service->addr_len));
 
 		/* Invoke on_bind callback if it is set. */
 		if (service->on_bind)
@@ -244,6 +192,50 @@ evio_service_bind_and_listen(struct evio_service *service)
 	return 0;
 }
 
+static int
+evio_service_bind_and_listen(struct evio_service *service)
+{
+	if (strcmp(service->host, URI_HOST_UNIX) == 0) {
+		/* UNIX domain socket */
+		struct sockaddr_un *un = (struct sockaddr_un *) &service->addr;
+		service->addr_len = sizeof(*un);
+		snprintf(un->sun_path, sizeof(un->sun_path), "%s",
+			 service->serv);
+		un->sun_family = AF_UNIX;
+		return evio_service_bind_addr(service);
+	}
+
+	/* IP socket */
+	struct addrinfo hints, *res;
+	memset(&hints, 0, sizeof(hints));
+	hints.ai_family = AF_UNSPEC;
+	hints.ai_socktype = SOCK_STREAM;
+	hints.ai_flags = AI_PASSIVE;
+
+	/* make no difference between empty string and NULL for host */
+	if (getaddrinfo(*service->host ? service->host : NULL, service->serv,
+			&hints, &res) != 0 || res == NULL)
+		tnt_raise(SocketError, -1, "can't resolve uri for bind");
+	auto addrinfo_guard = make_scoped_guard([=]{ freeaddrinfo(res); });
+
+	for (struct addrinfo *ai = res; ai != NULL; ai = ai->ai_next) {
+		memcpy(&service->addr, ai->ai_addr, ai->ai_addrlen);
+		service->addr_len = ai->ai_addrlen;
+		try {
+			return evio_service_bind_addr(service);
+		} catch (SocketError *e) {
+			say_error("%s: failed to bind on %s: %s",
+				  evio_service_name(service),
+				  sio_strfaddr(ai->ai_addr, ai->ai_addrlen),
+				  e->errmsg());
+			/* ignore */
+		}
+	}
+
+	tnt_raise(SocketError, -1, "%s: failed to bind",
+		  evio_service_name(service));
+}
+
 /** A callback invoked by libev when sleep timer expires.
  *
  * Retry binding. On success, stop the timer. If the port
@@ -272,10 +264,16 @@ evio_service_init(ev_loop *loop,
 
 	service->loop = loop;
 
+	struct uri u;
+	if (uri_parse(&u, uri) || u.service == NULL)
+		tnt_raise(IllegalParams, "invalid uri for bind: %s", uri);
 
-	if (uri_parse(&service->port, uri))
-		tnt_raise(SocketError, -1,
-			  "invalid address for bind: %s", uri);
+	snprintf(service->serv, sizeof(service->serv), "%.*s",
+		 (int) u.service_len, u.service);
+	if (u.host != NULL && strncmp(u.host, "*", u.host_len) != 0) {
+		snprintf(service->host, sizeof(service->host), "%.*s",
+			(int) u.host_len, u.host);
+	} /* else { service->host[0] = '\0'; } */
 
 	service->on_accept = on_accept;
 	service->on_accept_param = on_accept_param;
@@ -300,10 +298,11 @@ evio_service_start(struct evio_service *service)
 
 	if (evio_service_bind_and_listen(service)) {
 		/* Try again after a delay. */
-		say_warn("%s port %s is already in use, will "
+		say_warn("%s: %s is already in use, will "
 			 "retry binding after %lf seconds.",
 			 evio_service_name(service),
-			 uri_to_string(&service->port), BIND_RETRY_DELAY);
+			 sio_strfaddr(&service->addr, service->addr_len),
+			 BIND_RETRY_DELAY);
 
 		ev_timer_set(&service->timer,
 			     BIND_RETRY_DELAY, BIND_RETRY_DELAY);
@@ -320,8 +319,8 @@ evio_service_stop(struct evio_service *service)
 	} else {
 		ev_io_stop(service->loop, &service->ev);
 		close(service->ev.fd);
-		if (service->port.addr.sa_family == AF_UNIX) {
-			unlink(service->port.un.sun_path);
+		if (service->addr.sa_family == AF_UNIX) {
+			unlink(((struct sockaddr_un *) &service->addr)->sun_path);
 		}
 	}
 }
diff --git a/src/evio.h b/src/evio.h
index e2f0d44733..e05c017556 100644
--- a/src/evio.h
+++ b/src/evio.h
@@ -63,11 +63,16 @@ struct evio_service
 {
 	/** Service name. E.g. 'primary', 'secondary', etc. */
 	char name[SERVICE_NAME_MAXLEN];
-	/** Bind IP address, useful for logging */
-	char host[SERVICE_NAME_MAXLEN];
+	/** Bind host:service, useful for logging */
+	char host[URI_MAXHOST];
+	char serv[URI_MAXSERVICE];
 
 	/** Interface/port to bind to */
-	struct uri port;
+	union {
+		struct sockaddr addr;
+		struct sockaddr_storage addrstorage;
+	};
+	socklen_t addr_len;
 
 	/** A callback invoked upon a successful bind, optional.
 	 * If on_bind callback throws an exception, it's
@@ -152,10 +157,4 @@ evio_setsockopt_tcp(int fd, int family);
 void
 evio_setsockopt_tcpserver(int fd);
 
-void
-evio_bind_addrinfo(struct ev_io *coio, struct addrinfo *ai);
-
-int
-evio_pton(const char *addr, const char *port, struct sockaddr_storage *sa, socklen_t *salen);
-
 #endif /* TARANTOOL_EVIO_H_INCLUDED */
diff --git a/src/lua/init.cc b/src/lua/init.cc
index 633edffd93..02ca2146cb 100644
--- a/src/lua/init.cc
+++ b/src/lua/init.cc
@@ -73,6 +73,7 @@ extern char uuid_lua[],
 	digest_lua[],
 	init_lua[],
 	log_lua[],
+	uri_lua[],
 	bsdsocket_lua[],
 	console_lua[],
 	box_net_box_lua[],
@@ -92,6 +93,7 @@ static const char *lua_modules[] = {
 	"digest", digest_lua,
 	"uuid", uuid_lua,
 	"log", log_lua,
+	"uri", uri_lua,
 	"socket", bsdsocket_lua,
 	"net.box", box_net_box_lua,
 	"console", console_lua,
diff --git a/src/lua/uri.lua b/src/lua/uri.lua
new file mode 100644
index 0000000000..9f7bc7b0d9
--- /dev/null
+++ b/src/lua/uri.lua
@@ -0,0 +1,60 @@
+-- uri.lua (internal file)
+
+local ffi = require('ffi')
+
+ffi.cdef[[
+struct uri {
+    const char *scheme;
+    size_t scheme_len;
+    const char *login;
+    size_t login_len;
+    const char *password;
+    size_t password_len;
+    const char *host;
+    size_t host_len;
+    const char *service;
+    size_t service_len;
+    const char *path;
+    size_t path_len;
+    const char *query;
+    size_t query_len;
+    const char *fragment;
+    size_t fragment_len;
+    int host_hint;
+};
+
+int
+uri_parse(struct uri *uri, const char *str);
+]]
+
+local builtin = ffi.C;
+
+local uribuf = ffi.new('struct uri')
+
+local function parse(str)
+    if str == nil then
+        error("Usage: uri.parse(string)")
+    end
+    if builtin.uri_parse(uribuf, str) ~= 0 then
+        return nil
+    end
+    local result = {}
+    for _, k in ipairs({ 'scheme', 'login', 'password', 'host', 'service',
+        'path', 'query', 'fragment'}) do
+        if uribuf[k] ~= nil then
+            result[k] = ffi.string(uribuf[k], uribuf[k..'_len'])
+        end
+    end
+    if uribuf.host_hint == 1 then
+        result.ipv4 = result.host
+    elseif uribuf.host_hint == 2 then
+        result.ipv6 = result.host
+    elseif uribuf.host_hint == 3 then
+        result.unix = result.service
+    end
+    return result
+end
+
+return {
+    parse = parse;
+};
diff --git a/src/sio.cc b/src/sio.cc
index 896f698150..3bafff5629 100644
--- a/src/sio.cc
+++ b/src/sio.cc
@@ -470,26 +470,28 @@ sio_getpeername(int fd, struct sockaddr *addr, socklen_t *addrlen)
 const char *
 sio_strfaddr(struct sockaddr *addr, socklen_t addrlen)
 {
-	static __thread char name[SERVICE_NAME_MAXLEN];
+	static __thread char name[NI_MAXHOST + _POSIX_PATH_MAX + 2];
 	switch(addr->sa_family) {
 		case AF_UNIX:
 			if (addrlen >= sizeof(sockaddr_un)) {
-				snprintf(name, sizeof(name), "unix://%s",
+				snprintf(name, sizeof(name), "unix/:%s",
 					((struct sockaddr_un *)addr)->sun_path);
 			} else {
 				snprintf(name, sizeof(name),
-					"unix://%s", "");
+					 "unix/:(socket)");
 			}
 			break;
-		case AF_INET: {
-			struct sockaddr_in *in = (struct sockaddr_in *)addr;
-			snprintf(name, sizeof(name), "%s:%d",
-				 inet_ntoa(in->sin_addr), ntohs(in->sin_port));
-			break;
-		}
-		case AF_INET6: {
-			*name = 0;
-			inet_ntop(AF_INET6, addr, name, sizeof(name));
+		default: {
+			char host[NI_MAXHOST], serv[NI_MAXSERV];
+			if (getnameinfo(addr, addrlen, host, sizeof(host),
+					serv, sizeof(serv),
+					NI_NUMERICHOST | NI_NUMERICSERV) == 0) {
+				snprintf(name, sizeof(name),
+					 addr->sa_family == AF_INET
+					 ? "%s:%s" : "[%s]:%s", host, serv);
+			} else {
+				snprintf(name, sizeof(name), "(host):(port)");
+			}
 			break;
 		}
 	}
diff --git a/src/uri.c b/src/uri.c
new file mode 100644
index 0000000000..8b66299c6d
--- /dev/null
+++ b/src/uri.c
@@ -0,0 +1,6528 @@
+
+#line 1 "../../src/uri.rl"
+/*
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the
+ *    following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "uri.h"
+#include <string.h>
+#include <stdio.h> /* snprintf */
+int
+uri_parse(struct uri *uri, const char *p)
+{
+	const char *pe = p + strlen(p);
+	const char *eof = pe;
+	int cs;
+	memset(uri, 0, sizeof(*uri));
+
+	if (p == pe)
+		return -1;
+
+	const char *s = NULL, *login = NULL, *scheme = NULL;
+	size_t login_len = 0, scheme_len = 0;
+
+	
+#line 50 "../../src/uri.c"
+static const int uri_start = 144;
+static const int uri_first_final = 144;
+static const int uri_error = 0;
+
+static const int uri_en_main = 144;
+
+
+#line 58 "../../src/uri.c"
+	{
+	cs = uri_start;
+	}
+
+#line 63 "../../src/uri.c"
+	{
+	if ( p == pe )
+		goto _test_eof;
+	switch ( cs )
+	{
+case 144:
+	switch( (*p) ) {
+		case 33: goto tr150;
+		case 35: goto tr151;
+		case 37: goto tr152;
+		case 47: goto tr153;
+		case 59: goto tr150;
+		case 61: goto tr150;
+		case 63: goto tr155;
+		case 64: goto st204;
+		case 91: goto st38;
+		case 95: goto tr150;
+		case 117: goto tr158;
+		case 126: goto tr150;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto tr150;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto tr157;
+		} else if ( (*p) >= 65 )
+			goto tr157;
+	} else
+		goto tr154;
+	goto st0;
+st0:
+cs = 0;
+	goto _out;
+tr150:
+#line 137 "../../src/uri.rl"
+	{ s = p; }
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st145;
+st145:
+	if ( ++p == pe )
+		goto _test_eof145;
+case 145:
+#line 109 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st145;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st145;
+	} else
+		goto st145;
+	goto st0;
+tr151:
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st146;
+tr159:
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st146;
+tr170:
+#line 68 "../../src/uri.rl"
+	{ s = p; }
+#line 69 "../../src/uri.rl"
+	{ uri->query = s; uri->query_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st146;
+tr172:
+#line 69 "../../src/uri.rl"
+	{ uri->query = s; uri->query_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st146;
+tr175:
+#line 131 "../../src/uri.rl"
+	{ s = p; }
+#line 132 "../../src/uri.rl"
+	{ uri->service = s; uri->service_len = p - s; }
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st146;
+tr185:
+#line 132 "../../src/uri.rl"
+	{ uri->service = s; uri->service_len = p - s; }
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st146;
+tr200:
+#line 100 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;
+			   uri->host_hint = 1; }
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st146;
+tr209:
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st146;
+tr314:
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 128 "../../src/uri.rl"
+	{ s = p;}
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st146;
+tr318:
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st146;
+tr323:
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st146;
+st146:
+	if ( ++p == pe )
+		goto _test_eof146;
+case 146:
+#line 281 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto tr165;
+		case 37: goto tr166;
+		case 61: goto tr165;
+		case 95: goto tr165;
+		case 126: goto tr165;
+	}
+	if ( (*p) < 63 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto tr165;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto tr165;
+	} else
+		goto tr165;
+	goto st0;
+tr165:
+#line 72 "../../src/uri.rl"
+	{ s = p; }
+	goto st147;
+st147:
+	if ( ++p == pe )
+		goto _test_eof147;
+case 147:
+#line 306 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st147;
+		case 37: goto st1;
+		case 61: goto st147;
+		case 95: goto st147;
+		case 126: goto st147;
+	}
+	if ( (*p) < 63 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st147;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st147;
+	} else
+		goto st147;
+	goto st0;
+tr166:
+#line 72 "../../src/uri.rl"
+	{ s = p; }
+	goto st1;
+st1:
+	if ( ++p == pe )
+		goto _test_eof1;
+case 1:
+#line 331 "../../src/uri.c"
+	switch( (*p) ) {
+		case 37: goto st147;
+		case 117: goto st2;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st147;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st147;
+	} else
+		goto st147;
+	goto st0;
+st2:
+	if ( ++p == pe )
+		goto _test_eof2;
+case 2:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st3;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st3;
+	} else
+		goto st3;
+	goto st0;
+st3:
+	if ( ++p == pe )
+		goto _test_eof3;
+case 3:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st4;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st4;
+	} else
+		goto st4;
+	goto st0;
+st4:
+	if ( ++p == pe )
+		goto _test_eof4;
+case 4:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st5;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st5;
+	} else
+		goto st5;
+	goto st0;
+st5:
+	if ( ++p == pe )
+		goto _test_eof5;
+case 5:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st147;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st147;
+	} else
+		goto st147;
+	goto st0;
+tr152:
+#line 137 "../../src/uri.rl"
+	{ s = p; }
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st6;
+st6:
+	if ( ++p == pe )
+		goto _test_eof6;
+case 6:
+#line 407 "../../src/uri.c"
+	switch( (*p) ) {
+		case 37: goto st145;
+		case 117: goto st7;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st145;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st145;
+	} else
+		goto st145;
+	goto st0;
+st7:
+	if ( ++p == pe )
+		goto _test_eof7;
+case 7:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st8;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st8;
+	} else
+		goto st8;
+	goto st0;
+st8:
+	if ( ++p == pe )
+		goto _test_eof8;
+case 8:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st9;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st9;
+	} else
+		goto st9;
+	goto st0;
+st9:
+	if ( ++p == pe )
+		goto _test_eof9;
+case 9:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st10;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st10;
+	} else
+		goto st10;
+	goto st0;
+st10:
+	if ( ++p == pe )
+		goto _test_eof10;
+case 10:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st145;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st145;
+	} else
+		goto st145;
+	goto st0;
+tr161:
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+	goto st148;
+tr177:
+#line 131 "../../src/uri.rl"
+	{ s = p; }
+#line 132 "../../src/uri.rl"
+	{ uri->service = s; uri->service_len = p - s; }
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+	goto st148;
+tr186:
+#line 132 "../../src/uri.rl"
+	{ uri->service = s; uri->service_len = p - s; }
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+	goto st148;
+tr201:
+#line 100 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;
+			   uri->host_hint = 1; }
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+	goto st148;
+tr210:
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+	goto st148;
+st148:
+	if ( ++p == pe )
+		goto _test_eof148;
+case 148:
+#line 510 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st148;
+		case 35: goto tr151;
+		case 37: goto st11;
+		case 61: goto st148;
+		case 63: goto tr155;
+		case 95: goto st148;
+		case 126: goto st148;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st148;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st148;
+	} else
+		goto st148;
+	goto st0;
+st11:
+	if ( ++p == pe )
+		goto _test_eof11;
+case 11:
+	switch( (*p) ) {
+		case 37: goto st148;
+		case 117: goto st12;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st148;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st148;
+	} else
+		goto st148;
+	goto st0;
+st12:
+	if ( ++p == pe )
+		goto _test_eof12;
+case 12:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st13;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st13;
+	} else
+		goto st13;
+	goto st0;
+st13:
+	if ( ++p == pe )
+		goto _test_eof13;
+case 13:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st14;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st14;
+	} else
+		goto st14;
+	goto st0;
+st14:
+	if ( ++p == pe )
+		goto _test_eof14;
+case 14:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st15;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st15;
+	} else
+		goto st15;
+	goto st0;
+st15:
+	if ( ++p == pe )
+		goto _test_eof15;
+case 15:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st148;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st148;
+	} else
+		goto st148;
+	goto st0;
+tr155:
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st149;
+tr163:
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st149;
+tr179:
+#line 131 "../../src/uri.rl"
+	{ s = p; }
+#line 132 "../../src/uri.rl"
+	{ uri->service = s; uri->service_len = p - s; }
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st149;
+tr188:
+#line 132 "../../src/uri.rl"
+	{ uri->service = s; uri->service_len = p - s; }
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st149;
+tr204:
+#line 100 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;
+			   uri->host_hint = 1; }
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st149;
+tr212:
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st149;
+tr317:
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 128 "../../src/uri.rl"
+	{ s = p;}
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st149;
+tr320:
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st149;
+tr325:
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+#line 185 "../../src/uri.rl"
+	{ s = p; }
+	goto st149;
+st149:
+	if ( ++p == pe )
+		goto _test_eof149;
+case 149:
+#line 734 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto tr169;
+		case 35: goto tr170;
+		case 37: goto tr171;
+		case 61: goto tr169;
+		case 95: goto tr169;
+		case 126: goto tr169;
+	}
+	if ( (*p) < 63 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto tr169;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto tr169;
+	} else
+		goto tr169;
+	goto st0;
+tr169:
+#line 68 "../../src/uri.rl"
+	{ s = p; }
+	goto st150;
+st150:
+	if ( ++p == pe )
+		goto _test_eof150;
+case 150:
+#line 760 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st150;
+		case 35: goto tr172;
+		case 37: goto st16;
+		case 61: goto st150;
+		case 95: goto st150;
+		case 126: goto st150;
+	}
+	if ( (*p) < 63 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st150;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st150;
+	} else
+		goto st150;
+	goto st0;
+tr171:
+#line 68 "../../src/uri.rl"
+	{ s = p; }
+	goto st16;
+st16:
+	if ( ++p == pe )
+		goto _test_eof16;
+case 16:
+#line 786 "../../src/uri.c"
+	switch( (*p) ) {
+		case 37: goto st150;
+		case 117: goto st17;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st150;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st150;
+	} else
+		goto st150;
+	goto st0;
+st17:
+	if ( ++p == pe )
+		goto _test_eof17;
+case 17:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st18;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st18;
+	} else
+		goto st18;
+	goto st0;
+st18:
+	if ( ++p == pe )
+		goto _test_eof18;
+case 18:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st19;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st19;
+	} else
+		goto st19;
+	goto st0;
+st19:
+	if ( ++p == pe )
+		goto _test_eof19;
+case 19:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st20;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st20;
+	} else
+		goto st20;
+	goto st0;
+st20:
+	if ( ++p == pe )
+		goto _test_eof20;
+case 20:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st150;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st150;
+	} else
+		goto st150;
+	goto st0;
+tr162:
+#line 138 "../../src/uri.rl"
+	{ login = s; login_len = p - s; }
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+	goto st151;
+tr240:
+#line 138 "../../src/uri.rl"
+	{ login = s; login_len = p - s; }
+#line 100 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;
+			   uri->host_hint = 1; }
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+	goto st151;
+st151:
+	if ( ++p == pe )
+		goto _test_eof151;
+case 151:
+#line 871 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto tr174;
+		case 35: goto tr175;
+		case 37: goto tr176;
+		case 47: goto tr177;
+		case 59: goto tr174;
+		case 61: goto tr174;
+		case 63: goto tr179;
+		case 95: goto tr174;
+		case 126: goto tr174;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto tr174;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto tr180;
+		} else if ( (*p) >= 65 )
+			goto tr180;
+	} else
+		goto tr178;
+	goto st0;
+tr174:
+#line 141 "../../src/uri.rl"
+	{ s = p; }
+	goto st21;
+st21:
+	if ( ++p == pe )
+		goto _test_eof21;
+case 21:
+#line 903 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st21;
+		case 37: goto st22;
+		case 59: goto st21;
+		case 61: goto st21;
+		case 64: goto tr23;
+		case 95: goto st21;
+		case 126: goto st21;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st21;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st21;
+		} else if ( (*p) >= 65 )
+			goto st21;
+	} else
+		goto st21;
+	goto st0;
+tr176:
+#line 141 "../../src/uri.rl"
+	{ s = p; }
+	goto st22;
+st22:
+	if ( ++p == pe )
+		goto _test_eof22;
+case 22:
+#line 933 "../../src/uri.c"
+	switch( (*p) ) {
+		case 37: goto st21;
+		case 117: goto st23;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st21;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st21;
+	} else
+		goto st21;
+	goto st0;
+st23:
+	if ( ++p == pe )
+		goto _test_eof23;
+case 23:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st24;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st24;
+	} else
+		goto st24;
+	goto st0;
+st24:
+	if ( ++p == pe )
+		goto _test_eof24;
+case 24:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st25;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st25;
+	} else
+		goto st25;
+	goto st0;
+st25:
+	if ( ++p == pe )
+		goto _test_eof25;
+case 25:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st26;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st26;
+	} else
+		goto st26;
+	goto st0;
+st26:
+	if ( ++p == pe )
+		goto _test_eof26;
+case 26:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st21;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st21;
+	} else
+		goto st21;
+	goto st0;
+tr23:
+#line 142 "../../src/uri.rl"
+	{ uri->password = s; uri->password_len = p - s; }
+#line 146 "../../src/uri.rl"
+	{ uri->login = login; uri->login_len = login_len; }
+	goto st27;
+tr164:
+#line 138 "../../src/uri.rl"
+	{ login = s; login_len = p - s; }
+#line 146 "../../src/uri.rl"
+	{ uri->login = login; uri->login_len = login_len; }
+	goto st27;
+st27:
+	if ( ++p == pe )
+		goto _test_eof27;
+case 27:
+#line 1015 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto tr28;
+		case 37: goto tr29;
+		case 47: goto tr30;
+		case 59: goto tr28;
+		case 61: goto tr28;
+		case 91: goto st38;
+		case 95: goto tr28;
+		case 117: goto tr33;
+		case 126: goto tr28;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto tr28;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto tr28;
+		} else if ( (*p) >= 65 )
+			goto tr28;
+	} else
+		goto tr31;
+	goto st0;
+tr28:
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st152;
+st152:
+	if ( ++p == pe )
+		goto _test_eof152;
+case 152:
+#line 1047 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st152;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st152;
+	} else
+		goto st152;
+	goto st0;
+tr29:
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st28;
+st28:
+	if ( ++p == pe )
+		goto _test_eof28;
+case 28:
+#line 1076 "../../src/uri.c"
+	switch( (*p) ) {
+		case 37: goto st152;
+		case 117: goto st29;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st152;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st152;
+	} else
+		goto st152;
+	goto st0;
+st29:
+	if ( ++p == pe )
+		goto _test_eof29;
+case 29:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st30;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st30;
+	} else
+		goto st30;
+	goto st0;
+st30:
+	if ( ++p == pe )
+		goto _test_eof30;
+case 30:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st31;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st31;
+	} else
+		goto st31;
+	goto st0;
+st31:
+	if ( ++p == pe )
+		goto _test_eof31;
+case 31:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st32;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st32;
+	} else
+		goto st32;
+	goto st0;
+st32:
+	if ( ++p == pe )
+		goto _test_eof32;
+case 32:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st152;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st152;
+	} else
+		goto st152;
+	goto st0;
+tr182:
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+	goto st153;
+tr203:
+#line 100 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;
+			   uri->host_hint = 1; }
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+	goto st153;
+st153:
+	if ( ++p == pe )
+		goto _test_eof153;
+case 153:
+#line 1157 "../../src/uri.c"
+	switch( (*p) ) {
+		case 35: goto tr175;
+		case 47: goto tr177;
+		case 63: goto tr179;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto tr183;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto tr184;
+	} else
+		goto tr184;
+	goto st0;
+tr183:
+#line 131 "../../src/uri.rl"
+	{ s = p; }
+	goto st154;
+st154:
+	if ( ++p == pe )
+		goto _test_eof154;
+case 154:
+#line 1180 "../../src/uri.c"
+	switch( (*p) ) {
+		case 35: goto tr185;
+		case 47: goto tr186;
+		case 63: goto tr188;
+	}
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto st154;
+	goto st0;
+tr184:
+#line 131 "../../src/uri.rl"
+	{ s = p; }
+	goto st155;
+st155:
+	if ( ++p == pe )
+		goto _test_eof155;
+case 155:
+#line 1197 "../../src/uri.c"
+	switch( (*p) ) {
+		case 35: goto tr185;
+		case 47: goto tr186;
+		case 63: goto tr188;
+	}
+	if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st155;
+	} else if ( (*p) >= 65 )
+		goto st155;
+	goto st0;
+tr30:
+#line 182 "../../src/uri.rl"
+	{ s = p; }
+	goto st156;
+st156:
+	if ( ++p == pe )
+		goto _test_eof156;
+case 156:
+#line 1217 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st157;
+		case 37: goto st33;
+		case 61: goto st157;
+		case 95: goto st157;
+		case 126: goto st157;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st157;
+	} else if ( (*p) > 59 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st157;
+		} else if ( (*p) >= 64 )
+			goto st157;
+	} else
+		goto st157;
+	goto st0;
+st157:
+	if ( ++p == pe )
+		goto _test_eof157;
+case 157:
+	switch( (*p) ) {
+		case 33: goto st157;
+		case 37: goto st33;
+		case 61: goto st157;
+		case 95: goto st157;
+		case 126: goto st157;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st157;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st157;
+	} else
+		goto st157;
+	goto st0;
+st33:
+	if ( ++p == pe )
+		goto _test_eof33;
+case 33:
+	switch( (*p) ) {
+		case 37: goto st157;
+		case 117: goto st34;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st157;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st157;
+	} else
+		goto st157;
+	goto st0;
+st34:
+	if ( ++p == pe )
+		goto _test_eof34;
+case 34:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st35;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st35;
+	} else
+		goto st35;
+	goto st0;
+st35:
+	if ( ++p == pe )
+		goto _test_eof35;
+case 35:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st36;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st36;
+	} else
+		goto st36;
+	goto st0;
+st36:
+	if ( ++p == pe )
+		goto _test_eof36;
+case 36:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st37;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st37;
+	} else
+		goto st37;
+	goto st0;
+st37:
+	if ( ++p == pe )
+		goto _test_eof37;
+case 37:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st157;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st157;
+	} else
+		goto st157;
+	goto st0;
+tr31:
+#line 99 "../../src/uri.rl"
+	{ s = p; }
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st158;
+st158:
+	if ( ++p == pe )
+		goto _test_eof158;
+case 158:
+#line 1336 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 46: goto st159;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 59: goto st152;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st152;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st152;
+		} else if ( (*p) >= 65 )
+			goto st152;
+	} else
+		goto st171;
+	goto st0;
+st159:
+	if ( ++p == pe )
+		goto _test_eof159;
+case 159:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 59: goto st152;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st152;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st152;
+		} else if ( (*p) >= 65 )
+			goto st152;
+	} else
+		goto st160;
+	goto st0;
+st160:
+	if ( ++p == pe )
+		goto _test_eof160;
+case 160:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 46: goto st161;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 59: goto st152;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st152;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st152;
+		} else if ( (*p) >= 65 )
+			goto st152;
+	} else
+		goto st169;
+	goto st0;
+st161:
+	if ( ++p == pe )
+		goto _test_eof161;
+case 161:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 59: goto st152;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st152;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st152;
+		} else if ( (*p) >= 65 )
+			goto st152;
+	} else
+		goto st162;
+	goto st0;
+st162:
+	if ( ++p == pe )
+		goto _test_eof162;
+case 162:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 46: goto st163;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 59: goto st152;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st152;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st152;
+		} else if ( (*p) >= 65 )
+			goto st152;
+	} else
+		goto st167;
+	goto st0;
+st163:
+	if ( ++p == pe )
+		goto _test_eof163;
+case 163:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 59: goto st152;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st152;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st152;
+		} else if ( (*p) >= 65 )
+			goto st152;
+	} else
+		goto st164;
+	goto st0;
+st164:
+	if ( ++p == pe )
+		goto _test_eof164;
+case 164:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr200;
+		case 37: goto st28;
+		case 47: goto tr201;
+		case 58: goto tr203;
+		case 59: goto st152;
+		case 61: goto st152;
+		case 63: goto tr204;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st152;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st152;
+		} else if ( (*p) >= 65 )
+			goto st152;
+	} else
+		goto st165;
+	goto st0;
+st165:
+	if ( ++p == pe )
+		goto _test_eof165;
+case 165:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr200;
+		case 37: goto st28;
+		case 47: goto tr201;
+		case 58: goto tr203;
+		case 59: goto st152;
+		case 61: goto st152;
+		case 63: goto tr204;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st152;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st152;
+		} else if ( (*p) >= 65 )
+			goto st152;
+	} else
+		goto st166;
+	goto st0;
+st166:
+	if ( ++p == pe )
+		goto _test_eof166;
+case 166:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr200;
+		case 37: goto st28;
+		case 47: goto tr201;
+		case 58: goto tr203;
+		case 61: goto st152;
+		case 63: goto tr204;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st152;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st152;
+	} else
+		goto st152;
+	goto st0;
+st167:
+	if ( ++p == pe )
+		goto _test_eof167;
+case 167:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 46: goto st163;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 59: goto st152;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st152;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st152;
+		} else if ( (*p) >= 65 )
+			goto st152;
+	} else
+		goto st168;
+	goto st0;
+st168:
+	if ( ++p == pe )
+		goto _test_eof168;
+case 168:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 46: goto st163;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st152;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st152;
+	} else
+		goto st152;
+	goto st0;
+st169:
+	if ( ++p == pe )
+		goto _test_eof169;
+case 169:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 46: goto st161;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 59: goto st152;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st152;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st152;
+		} else if ( (*p) >= 65 )
+			goto st152;
+	} else
+		goto st170;
+	goto st0;
+st170:
+	if ( ++p == pe )
+		goto _test_eof170;
+case 170:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 46: goto st161;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st152;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st152;
+	} else
+		goto st152;
+	goto st0;
+st171:
+	if ( ++p == pe )
+		goto _test_eof171;
+case 171:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 46: goto st159;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 59: goto st152;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st152;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st152;
+		} else if ( (*p) >= 65 )
+			goto st152;
+	} else
+		goto st172;
+	goto st0;
+st172:
+	if ( ++p == pe )
+		goto _test_eof172;
+case 172:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 46: goto st159;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st152;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st152;
+	} else
+		goto st152;
+	goto st0;
+st38:
+	if ( ++p == pe )
+		goto _test_eof38;
+case 38:
+	if ( (*p) == 58 )
+		goto tr45;
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto tr44;
+	} else if ( (*p) >= 48 )
+		goto tr44;
+	goto st0;
+tr44:
+#line 106 "../../src/uri.rl"
+	{ s = p; }
+	goto st39;
+st39:
+	if ( ++p == pe )
+		goto _test_eof39;
+case 39:
+#line 1766 "../../src/uri.c"
+	if ( (*p) == 58 )
+		goto st43;
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st40;
+	} else if ( (*p) >= 48 )
+		goto st40;
+	goto st0;
+st40:
+	if ( ++p == pe )
+		goto _test_eof40;
+case 40:
+	if ( (*p) == 58 )
+		goto st43;
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st41;
+	} else if ( (*p) >= 48 )
+		goto st41;
+	goto st0;
+st41:
+	if ( ++p == pe )
+		goto _test_eof41;
+case 41:
+	if ( (*p) == 58 )
+		goto st43;
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st42;
+	} else if ( (*p) >= 48 )
+		goto st42;
+	goto st0;
+st42:
+	if ( ++p == pe )
+		goto _test_eof42;
+case 42:
+	if ( (*p) == 58 )
+		goto st43;
+	goto st0;
+st43:
+	if ( ++p == pe )
+		goto _test_eof43;
+case 43:
+	switch( (*p) ) {
+		case 58: goto st48;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st44;
+	} else if ( (*p) >= 48 )
+		goto st44;
+	goto st0;
+st44:
+	if ( ++p == pe )
+		goto _test_eof44;
+case 44:
+	switch( (*p) ) {
+		case 58: goto st48;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st45;
+	} else if ( (*p) >= 48 )
+		goto st45;
+	goto st0;
+st45:
+	if ( ++p == pe )
+		goto _test_eof45;
+case 45:
+	switch( (*p) ) {
+		case 58: goto st48;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st46;
+	} else if ( (*p) >= 48 )
+		goto st46;
+	goto st0;
+st46:
+	if ( ++p == pe )
+		goto _test_eof46;
+case 46:
+	switch( (*p) ) {
+		case 58: goto st48;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st47;
+	} else if ( (*p) >= 48 )
+		goto st47;
+	goto st0;
+st47:
+	if ( ++p == pe )
+		goto _test_eof47;
+case 47:
+	switch( (*p) ) {
+		case 58: goto st48;
+		case 93: goto tr52;
+	}
+	goto st0;
+st48:
+	if ( ++p == pe )
+		goto _test_eof48;
+case 48:
+	switch( (*p) ) {
+		case 58: goto st53;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st49;
+	} else if ( (*p) >= 48 )
+		goto st49;
+	goto st0;
+st49:
+	if ( ++p == pe )
+		goto _test_eof49;
+case 49:
+	switch( (*p) ) {
+		case 58: goto st53;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st50;
+	} else if ( (*p) >= 48 )
+		goto st50;
+	goto st0;
+st50:
+	if ( ++p == pe )
+		goto _test_eof50;
+case 50:
+	switch( (*p) ) {
+		case 58: goto st53;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st51;
+	} else if ( (*p) >= 48 )
+		goto st51;
+	goto st0;
+st51:
+	if ( ++p == pe )
+		goto _test_eof51;
+case 51:
+	switch( (*p) ) {
+		case 58: goto st53;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st52;
+	} else if ( (*p) >= 48 )
+		goto st52;
+	goto st0;
+st52:
+	if ( ++p == pe )
+		goto _test_eof52;
+case 52:
+	switch( (*p) ) {
+		case 58: goto st53;
+		case 93: goto tr52;
+	}
+	goto st0;
+st53:
+	if ( ++p == pe )
+		goto _test_eof53;
+case 53:
+	switch( (*p) ) {
+		case 58: goto st58;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st54;
+	} else if ( (*p) >= 48 )
+		goto st54;
+	goto st0;
+st54:
+	if ( ++p == pe )
+		goto _test_eof54;
+case 54:
+	switch( (*p) ) {
+		case 58: goto st58;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st55;
+	} else if ( (*p) >= 48 )
+		goto st55;
+	goto st0;
+st55:
+	if ( ++p == pe )
+		goto _test_eof55;
+case 55:
+	switch( (*p) ) {
+		case 58: goto st58;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st56;
+	} else if ( (*p) >= 48 )
+		goto st56;
+	goto st0;
+st56:
+	if ( ++p == pe )
+		goto _test_eof56;
+case 56:
+	switch( (*p) ) {
+		case 58: goto st58;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st57;
+	} else if ( (*p) >= 48 )
+		goto st57;
+	goto st0;
+st57:
+	if ( ++p == pe )
+		goto _test_eof57;
+case 57:
+	switch( (*p) ) {
+		case 58: goto st58;
+		case 93: goto tr52;
+	}
+	goto st0;
+st58:
+	if ( ++p == pe )
+		goto _test_eof58;
+case 58:
+	switch( (*p) ) {
+		case 58: goto st63;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st59;
+	} else if ( (*p) >= 48 )
+		goto st59;
+	goto st0;
+st59:
+	if ( ++p == pe )
+		goto _test_eof59;
+case 59:
+	switch( (*p) ) {
+		case 58: goto st63;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st60;
+	} else if ( (*p) >= 48 )
+		goto st60;
+	goto st0;
+st60:
+	if ( ++p == pe )
+		goto _test_eof60;
+case 60:
+	switch( (*p) ) {
+		case 58: goto st63;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st61;
+	} else if ( (*p) >= 48 )
+		goto st61;
+	goto st0;
+st61:
+	if ( ++p == pe )
+		goto _test_eof61;
+case 61:
+	switch( (*p) ) {
+		case 58: goto st63;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st62;
+	} else if ( (*p) >= 48 )
+		goto st62;
+	goto st0;
+st62:
+	if ( ++p == pe )
+		goto _test_eof62;
+case 62:
+	switch( (*p) ) {
+		case 58: goto st63;
+		case 93: goto tr52;
+	}
+	goto st0;
+st63:
+	if ( ++p == pe )
+		goto _test_eof63;
+case 63:
+	switch( (*p) ) {
+		case 58: goto st68;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st64;
+	} else if ( (*p) >= 48 )
+		goto st64;
+	goto st0;
+st64:
+	if ( ++p == pe )
+		goto _test_eof64;
+case 64:
+	switch( (*p) ) {
+		case 58: goto st68;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st65;
+	} else if ( (*p) >= 48 )
+		goto st65;
+	goto st0;
+st65:
+	if ( ++p == pe )
+		goto _test_eof65;
+case 65:
+	switch( (*p) ) {
+		case 58: goto st68;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st66;
+	} else if ( (*p) >= 48 )
+		goto st66;
+	goto st0;
+st66:
+	if ( ++p == pe )
+		goto _test_eof66;
+case 66:
+	switch( (*p) ) {
+		case 58: goto st68;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st67;
+	} else if ( (*p) >= 48 )
+		goto st67;
+	goto st0;
+st67:
+	if ( ++p == pe )
+		goto _test_eof67;
+case 67:
+	switch( (*p) ) {
+		case 58: goto st68;
+		case 93: goto tr52;
+	}
+	goto st0;
+st68:
+	if ( ++p == pe )
+		goto _test_eof68;
+case 68:
+	switch( (*p) ) {
+		case 58: goto st73;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st69;
+	} else if ( (*p) >= 48 )
+		goto st69;
+	goto st0;
+st69:
+	if ( ++p == pe )
+		goto _test_eof69;
+case 69:
+	switch( (*p) ) {
+		case 58: goto st73;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st70;
+	} else if ( (*p) >= 48 )
+		goto st70;
+	goto st0;
+st70:
+	if ( ++p == pe )
+		goto _test_eof70;
+case 70:
+	switch( (*p) ) {
+		case 58: goto st73;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st71;
+	} else if ( (*p) >= 48 )
+		goto st71;
+	goto st0;
+st71:
+	if ( ++p == pe )
+		goto _test_eof71;
+case 71:
+	switch( (*p) ) {
+		case 58: goto st73;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st72;
+	} else if ( (*p) >= 48 )
+		goto st72;
+	goto st0;
+st72:
+	if ( ++p == pe )
+		goto _test_eof72;
+case 72:
+	switch( (*p) ) {
+		case 58: goto st73;
+		case 93: goto tr52;
+	}
+	goto st0;
+st73:
+	if ( ++p == pe )
+		goto _test_eof73;
+case 73:
+	switch( (*p) ) {
+		case 58: goto st78;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st74;
+	} else if ( (*p) >= 48 )
+		goto st74;
+	goto st0;
+st74:
+	if ( ++p == pe )
+		goto _test_eof74;
+case 74:
+	switch( (*p) ) {
+		case 58: goto st78;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st75;
+	} else if ( (*p) >= 48 )
+		goto st75;
+	goto st0;
+st75:
+	if ( ++p == pe )
+		goto _test_eof75;
+case 75:
+	switch( (*p) ) {
+		case 58: goto st78;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st76;
+	} else if ( (*p) >= 48 )
+		goto st76;
+	goto st0;
+st76:
+	if ( ++p == pe )
+		goto _test_eof76;
+case 76:
+	switch( (*p) ) {
+		case 58: goto st78;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st77;
+	} else if ( (*p) >= 48 )
+		goto st77;
+	goto st0;
+st77:
+	if ( ++p == pe )
+		goto _test_eof77;
+case 77:
+	switch( (*p) ) {
+		case 58: goto st78;
+		case 93: goto tr52;
+	}
+	goto st0;
+st78:
+	if ( ++p == pe )
+		goto _test_eof78;
+case 78:
+	if ( (*p) == 93 )
+		goto tr52;
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st79;
+	} else if ( (*p) >= 48 )
+		goto st79;
+	goto st0;
+st79:
+	if ( ++p == pe )
+		goto _test_eof79;
+case 79:
+	if ( (*p) == 93 )
+		goto tr52;
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st80;
+	} else if ( (*p) >= 48 )
+		goto st80;
+	goto st0;
+st80:
+	if ( ++p == pe )
+		goto _test_eof80;
+case 80:
+	if ( (*p) == 93 )
+		goto tr52;
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st81;
+	} else if ( (*p) >= 48 )
+		goto st81;
+	goto st0;
+st81:
+	if ( ++p == pe )
+		goto _test_eof81;
+case 81:
+	if ( (*p) == 93 )
+		goto tr52;
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st82;
+	} else if ( (*p) >= 48 )
+		goto st82;
+	goto st0;
+st82:
+	if ( ++p == pe )
+		goto _test_eof82;
+case 82:
+	if ( (*p) == 93 )
+		goto tr52;
+	goto st0;
+tr52:
+#line 107 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;
+				   uri->host_hint = 2; }
+	goto st173;
+st173:
+	if ( ++p == pe )
+		goto _test_eof173;
+case 173:
+#line 2325 "../../src/uri.c"
+	switch( (*p) ) {
+		case 35: goto tr209;
+		case 47: goto tr210;
+		case 58: goto st153;
+		case 63: goto tr212;
+	}
+	goto st0;
+tr45:
+#line 106 "../../src/uri.rl"
+	{ s = p; }
+	goto st83;
+st83:
+	if ( ++p == pe )
+		goto _test_eof83;
+case 83:
+#line 2341 "../../src/uri.c"
+	switch( (*p) ) {
+		case 58: goto st84;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st44;
+	} else if ( (*p) >= 48 )
+		goto st44;
+	goto st0;
+st84:
+	if ( ++p == pe )
+		goto _test_eof84;
+case 84:
+	switch( (*p) ) {
+		case 58: goto st53;
+		case 93: goto tr52;
+		case 102: goto st85;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 101 )
+			goto st49;
+	} else if ( (*p) >= 48 )
+		goto st49;
+	goto st0;
+st85:
+	if ( ++p == pe )
+		goto _test_eof85;
+case 85:
+	switch( (*p) ) {
+		case 58: goto st53;
+		case 93: goto tr52;
+		case 102: goto st86;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 101 )
+			goto st50;
+	} else if ( (*p) >= 48 )
+		goto st50;
+	goto st0;
+st86:
+	if ( ++p == pe )
+		goto _test_eof86;
+case 86:
+	switch( (*p) ) {
+		case 58: goto st53;
+		case 93: goto tr52;
+		case 102: goto st87;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 101 )
+			goto st51;
+	} else if ( (*p) >= 48 )
+		goto st51;
+	goto st0;
+st87:
+	if ( ++p == pe )
+		goto _test_eof87;
+case 87:
+	switch( (*p) ) {
+		case 58: goto st53;
+		case 93: goto tr52;
+		case 102: goto st88;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 101 )
+			goto st52;
+	} else if ( (*p) >= 48 )
+		goto st52;
+	goto st0;
+st88:
+	if ( ++p == pe )
+		goto _test_eof88;
+case 88:
+	switch( (*p) ) {
+		case 58: goto st89;
+		case 93: goto tr52;
+	}
+	goto st0;
+st89:
+	if ( ++p == pe )
+		goto _test_eof89;
+case 89:
+	switch( (*p) ) {
+		case 58: goto st58;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st54;
+	} else if ( (*p) >= 48 )
+		goto st90;
+	goto st0;
+st90:
+	if ( ++p == pe )
+		goto _test_eof90;
+case 90:
+	switch( (*p) ) {
+		case 46: goto st91;
+		case 58: goto st58;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st55;
+	} else if ( (*p) >= 48 )
+		goto st102;
+	goto st0;
+st91:
+	if ( ++p == pe )
+		goto _test_eof91;
+case 91:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto st92;
+	goto st0;
+st92:
+	if ( ++p == pe )
+		goto _test_eof92;
+case 92:
+	if ( (*p) == 46 )
+		goto st93;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto st100;
+	goto st0;
+st93:
+	if ( ++p == pe )
+		goto _test_eof93;
+case 93:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto st94;
+	goto st0;
+st94:
+	if ( ++p == pe )
+		goto _test_eof94;
+case 94:
+	if ( (*p) == 46 )
+		goto st95;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto st98;
+	goto st0;
+st95:
+	if ( ++p == pe )
+		goto _test_eof95;
+case 95:
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto st96;
+	goto st0;
+st96:
+	if ( ++p == pe )
+		goto _test_eof96;
+case 96:
+	if ( (*p) == 93 )
+		goto tr52;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto st97;
+	goto st0;
+st97:
+	if ( ++p == pe )
+		goto _test_eof97;
+case 97:
+	if ( (*p) == 93 )
+		goto tr52;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto st82;
+	goto st0;
+st98:
+	if ( ++p == pe )
+		goto _test_eof98;
+case 98:
+	if ( (*p) == 46 )
+		goto st95;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto st99;
+	goto st0;
+st99:
+	if ( ++p == pe )
+		goto _test_eof99;
+case 99:
+	if ( (*p) == 46 )
+		goto st95;
+	goto st0;
+st100:
+	if ( ++p == pe )
+		goto _test_eof100;
+case 100:
+	if ( (*p) == 46 )
+		goto st93;
+	if ( 48 <= (*p) && (*p) <= 57 )
+		goto st101;
+	goto st0;
+st101:
+	if ( ++p == pe )
+		goto _test_eof101;
+case 101:
+	if ( (*p) == 46 )
+		goto st93;
+	goto st0;
+st102:
+	if ( ++p == pe )
+		goto _test_eof102;
+case 102:
+	switch( (*p) ) {
+		case 46: goto st91;
+		case 58: goto st58;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st56;
+	} else if ( (*p) >= 48 )
+		goto st103;
+	goto st0;
+st103:
+	if ( ++p == pe )
+		goto _test_eof103;
+case 103:
+	switch( (*p) ) {
+		case 46: goto st91;
+		case 58: goto st58;
+		case 93: goto tr52;
+	}
+	if ( (*p) > 57 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st57;
+	} else if ( (*p) >= 48 )
+		goto st57;
+	goto st0;
+tr33:
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st174;
+st174:
+	if ( ++p == pe )
+		goto _test_eof174;
+case 174:
+#line 2577 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 110: goto st175;
+		case 126: goto st152;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st152;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st152;
+	} else
+		goto st152;
+	goto st0;
+st175:
+	if ( ++p == pe )
+		goto _test_eof175;
+case 175:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 105: goto st176;
+		case 126: goto st152;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st152;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st152;
+	} else
+		goto st152;
+	goto st0;
+st176:
+	if ( ++p == pe )
+		goto _test_eof176;
+case 176:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 47: goto tr161;
+		case 58: goto tr182;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 120: goto st177;
+		case 126: goto st152;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st152;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st152;
+	} else
+		goto st152;
+	goto st0;
+st177:
+	if ( ++p == pe )
+		goto _test_eof177;
+case 177:
+	switch( (*p) ) {
+		case 33: goto st152;
+		case 35: goto tr159;
+		case 37: goto st28;
+		case 47: goto tr216;
+		case 58: goto tr182;
+		case 61: goto st152;
+		case 63: goto tr163;
+		case 95: goto st152;
+		case 126: goto st152;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st152;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st152;
+	} else
+		goto st152;
+	goto st0;
+tr216:
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+	goto st178;
+st178:
+	if ( ++p == pe )
+		goto _test_eof178;
+case 178:
+#line 2683 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st148;
+		case 35: goto tr151;
+		case 37: goto st11;
+		case 58: goto st179;
+		case 61: goto st148;
+		case 63: goto tr155;
+		case 95: goto st148;
+		case 126: goto st148;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st148;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st148;
+	} else
+		goto st148;
+	goto st0;
+st179:
+	if ( ++p == pe )
+		goto _test_eof179;
+case 179:
+	switch( (*p) ) {
+		case 33: goto tr218;
+		case 35: goto tr151;
+		case 37: goto tr219;
+		case 47: goto tr220;
+		case 58: goto tr221;
+		case 61: goto tr218;
+		case 63: goto tr155;
+		case 95: goto tr218;
+		case 126: goto tr218;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto tr218;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto tr218;
+	} else
+		goto tr218;
+	goto st0;
+tr218:
+#line 128 "../../src/uri.rl"
+	{ s = p;}
+	goto st180;
+st180:
+	if ( ++p == pe )
+		goto _test_eof180;
+case 180:
+#line 2735 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st180;
+		case 35: goto tr151;
+		case 37: goto st104;
+		case 47: goto st181;
+		case 58: goto tr223;
+		case 61: goto st180;
+		case 63: goto tr155;
+		case 95: goto st180;
+		case 126: goto st180;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st180;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st180;
+	} else
+		goto st180;
+	goto st0;
+tr219:
+#line 128 "../../src/uri.rl"
+	{ s = p;}
+	goto st104;
+st104:
+	if ( ++p == pe )
+		goto _test_eof104;
+case 104:
+#line 2764 "../../src/uri.c"
+	switch( (*p) ) {
+		case 37: goto st180;
+		case 117: goto st105;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st180;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st180;
+	} else
+		goto st180;
+	goto st0;
+st105:
+	if ( ++p == pe )
+		goto _test_eof105;
+case 105:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st106;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st106;
+	} else
+		goto st106;
+	goto st0;
+st106:
+	if ( ++p == pe )
+		goto _test_eof106;
+case 106:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st107;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st107;
+	} else
+		goto st107;
+	goto st0;
+st107:
+	if ( ++p == pe )
+		goto _test_eof107;
+case 107:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st108;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st108;
+	} else
+		goto st108;
+	goto st0;
+st108:
+	if ( ++p == pe )
+		goto _test_eof108;
+case 108:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st180;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st180;
+	} else
+		goto st180;
+	goto st0;
+tr226:
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+	goto st181;
+tr220:
+#line 128 "../../src/uri.rl"
+	{ s = p;}
+	goto st181;
+st181:
+	if ( ++p == pe )
+		goto _test_eof181;
+case 181:
+#line 2842 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st181;
+		case 35: goto tr151;
+		case 37: goto st109;
+		case 58: goto tr225;
+		case 61: goto st181;
+		case 63: goto tr155;
+		case 95: goto st181;
+		case 126: goto st181;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st181;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st181;
+	} else
+		goto st181;
+	goto st0;
+st109:
+	if ( ++p == pe )
+		goto _test_eof109;
+case 109:
+	switch( (*p) ) {
+		case 37: goto st181;
+		case 117: goto st110;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st181;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st181;
+	} else
+		goto st181;
+	goto st0;
+st110:
+	if ( ++p == pe )
+		goto _test_eof110;
+case 110:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st111;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st111;
+	} else
+		goto st111;
+	goto st0;
+st111:
+	if ( ++p == pe )
+		goto _test_eof111;
+case 111:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st112;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st112;
+	} else
+		goto st112;
+	goto st0;
+st112:
+	if ( ++p == pe )
+		goto _test_eof112;
+case 112:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st113;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st113;
+	} else
+		goto st113;
+	goto st0;
+st113:
+	if ( ++p == pe )
+		goto _test_eof113;
+case 113:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st181;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st181;
+	} else
+		goto st181;
+	goto st0;
+tr225:
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+	goto st182;
+st182:
+	if ( ++p == pe )
+		goto _test_eof182;
+case 182:
+#line 2954 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st181;
+		case 35: goto tr209;
+		case 37: goto st109;
+		case 47: goto tr226;
+		case 58: goto tr225;
+		case 61: goto st181;
+		case 63: goto tr212;
+		case 95: goto st181;
+		case 126: goto st181;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st181;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st181;
+	} else
+		goto st181;
+	goto st0;
+tr223:
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+	goto st183;
+tr221:
+#line 128 "../../src/uri.rl"
+	{ s = p;}
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+	goto st183;
+st183:
+	if ( ++p == pe )
+		goto _test_eof183;
+case 183:
+#line 3019 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st148;
+		case 35: goto tr209;
+		case 37: goto st11;
+		case 47: goto tr210;
+		case 61: goto st148;
+		case 63: goto tr212;
+		case 95: goto st148;
+		case 126: goto st148;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st148;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st148;
+	} else
+		goto st148;
+	goto st0;
+tr178:
+#line 141 "../../src/uri.rl"
+	{ s = p; }
+#line 131 "../../src/uri.rl"
+	{ s = p; }
+	goto st184;
+st184:
+	if ( ++p == pe )
+		goto _test_eof184;
+case 184:
+#line 3049 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st21;
+		case 35: goto tr185;
+		case 37: goto st22;
+		case 47: goto tr186;
+		case 59: goto st21;
+		case 61: goto st21;
+		case 63: goto tr188;
+		case 64: goto tr23;
+		case 95: goto st21;
+		case 126: goto st21;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st21;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st21;
+		} else if ( (*p) >= 65 )
+			goto st21;
+	} else
+		goto st184;
+	goto st0;
+tr180:
+#line 141 "../../src/uri.rl"
+	{ s = p; }
+#line 131 "../../src/uri.rl"
+	{ s = p; }
+	goto st185;
+st185:
+	if ( ++p == pe )
+		goto _test_eof185;
+case 185:
+#line 3084 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st21;
+		case 35: goto tr185;
+		case 37: goto st22;
+		case 47: goto tr186;
+		case 59: goto st21;
+		case 61: goto st21;
+		case 63: goto tr188;
+		case 64: goto tr23;
+		case 95: goto st21;
+		case 126: goto st21;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 57 )
+			goto st21;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st185;
+	} else
+		goto st185;
+	goto st0;
+tr153:
+#line 182 "../../src/uri.rl"
+	{ s = p; }
+	goto st186;
+st186:
+	if ( ++p == pe )
+		goto _test_eof186;
+case 186:
+#line 3114 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st187;
+		case 35: goto tr151;
+		case 37: goto st114;
+		case 61: goto st187;
+		case 63: goto tr155;
+		case 95: goto st187;
+		case 126: goto st187;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st187;
+	} else if ( (*p) > 59 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st187;
+		} else if ( (*p) >= 64 )
+			goto st187;
+	} else
+		goto st187;
+	goto st0;
+st187:
+	if ( ++p == pe )
+		goto _test_eof187;
+case 187:
+	switch( (*p) ) {
+		case 33: goto st187;
+		case 35: goto tr151;
+		case 37: goto st114;
+		case 61: goto st187;
+		case 63: goto tr155;
+		case 95: goto st187;
+		case 126: goto st187;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st187;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st187;
+	} else
+		goto st187;
+	goto st0;
+st114:
+	if ( ++p == pe )
+		goto _test_eof114;
+case 114:
+	switch( (*p) ) {
+		case 37: goto st187;
+		case 117: goto st115;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st187;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st187;
+	} else
+		goto st187;
+	goto st0;
+st115:
+	if ( ++p == pe )
+		goto _test_eof115;
+case 115:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st116;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st116;
+	} else
+		goto st116;
+	goto st0;
+st116:
+	if ( ++p == pe )
+		goto _test_eof116;
+case 116:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st117;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st117;
+	} else
+		goto st117;
+	goto st0;
+st117:
+	if ( ++p == pe )
+		goto _test_eof117;
+case 117:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st118;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st118;
+	} else
+		goto st118;
+	goto st0;
+st118:
+	if ( ++p == pe )
+		goto _test_eof118;
+case 118:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st187;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st187;
+	} else
+		goto st187;
+	goto st0;
+tr154:
+#line 137 "../../src/uri.rl"
+	{ s = p; }
+#line 99 "../../src/uri.rl"
+	{ s = p; }
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+#line 178 "../../src/uri.rl"
+	{ uri->service = p; }
+	goto st188;
+st188:
+	if ( ++p == pe )
+		goto _test_eof188;
+case 188:
+#line 3241 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 46: goto st189;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st145;
+		} else if ( (*p) >= 65 )
+			goto st145;
+	} else
+		goto st201;
+	goto st0;
+st189:
+	if ( ++p == pe )
+		goto _test_eof189;
+case 189:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st145;
+		} else if ( (*p) >= 65 )
+			goto st145;
+	} else
+		goto st190;
+	goto st0;
+st190:
+	if ( ++p == pe )
+		goto _test_eof190;
+case 190:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 46: goto st191;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st145;
+		} else if ( (*p) >= 65 )
+			goto st145;
+	} else
+		goto st199;
+	goto st0;
+st191:
+	if ( ++p == pe )
+		goto _test_eof191;
+case 191:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st145;
+		} else if ( (*p) >= 65 )
+			goto st145;
+	} else
+		goto st192;
+	goto st0;
+st192:
+	if ( ++p == pe )
+		goto _test_eof192;
+case 192:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 46: goto st193;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st145;
+		} else if ( (*p) >= 65 )
+			goto st145;
+	} else
+		goto st197;
+	goto st0;
+st193:
+	if ( ++p == pe )
+		goto _test_eof193;
+case 193:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st145;
+		} else if ( (*p) >= 65 )
+			goto st145;
+	} else
+		goto st194;
+	goto st0;
+st194:
+	if ( ++p == pe )
+		goto _test_eof194;
+case 194:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr200;
+		case 37: goto st6;
+		case 47: goto tr201;
+		case 58: goto tr240;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr204;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st145;
+		} else if ( (*p) >= 65 )
+			goto st145;
+	} else
+		goto st195;
+	goto st0;
+st195:
+	if ( ++p == pe )
+		goto _test_eof195;
+case 195:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr200;
+		case 37: goto st6;
+		case 47: goto tr201;
+		case 58: goto tr240;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr204;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st145;
+		} else if ( (*p) >= 65 )
+			goto st145;
+	} else
+		goto st196;
+	goto st0;
+st196:
+	if ( ++p == pe )
+		goto _test_eof196;
+case 196:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr200;
+		case 37: goto st6;
+		case 47: goto tr201;
+		case 58: goto tr240;
+		case 61: goto st145;
+		case 63: goto tr204;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st145;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st145;
+	} else
+		goto st145;
+	goto st0;
+st197:
+	if ( ++p == pe )
+		goto _test_eof197;
+case 197:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 46: goto st193;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st145;
+		} else if ( (*p) >= 65 )
+			goto st145;
+	} else
+		goto st198;
+	goto st0;
+st198:
+	if ( ++p == pe )
+		goto _test_eof198;
+case 198:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 46: goto st193;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st145;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st145;
+	} else
+		goto st145;
+	goto st0;
+st199:
+	if ( ++p == pe )
+		goto _test_eof199;
+case 199:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 46: goto st191;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st145;
+		} else if ( (*p) >= 65 )
+			goto st145;
+	} else
+		goto st200;
+	goto st0;
+st200:
+	if ( ++p == pe )
+		goto _test_eof200;
+case 200:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 46: goto st191;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st145;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st145;
+	} else
+		goto st145;
+	goto st0;
+st201:
+	if ( ++p == pe )
+		goto _test_eof201;
+case 201:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 46: goto st189;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st145;
+		} else if ( (*p) >= 65 )
+			goto st145;
+	} else
+		goto st202;
+	goto st0;
+st202:
+	if ( ++p == pe )
+		goto _test_eof202;
+case 202:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 46: goto st189;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st145;
+		} else if ( (*p) >= 65 )
+			goto st145;
+	} else
+		goto st203;
+	goto st0;
+st203:
+	if ( ++p == pe )
+		goto _test_eof203;
+case 203:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 47: goto tr161;
+		case 58: goto tr162;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st145;
+		} else if ( (*p) >= 65 )
+			goto st145;
+	} else
+		goto st203;
+	goto st0;
+st204:
+	if ( ++p == pe )
+		goto _test_eof204;
+case 204:
+	switch( (*p) ) {
+		case 35: goto tr151;
+		case 47: goto st148;
+		case 63: goto tr155;
+	}
+	goto st0;
+tr157:
+#line 151 "../../src/uri.rl"
+	{ s = p; }
+#line 137 "../../src/uri.rl"
+	{ s = p; }
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st205;
+st205:
+	if ( ++p == pe )
+		goto _test_eof205;
+case 205:
+#line 3721 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 43: goto st205;
+		case 47: goto tr161;
+		case 58: goto tr247;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 45 ) {
+		if ( 36 <= (*p) && (*p) <= 44 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st205;
+		} else if ( (*p) >= 65 )
+			goto st205;
+	} else
+		goto st205;
+	goto st0;
+tr247:
+#line 153 "../../src/uri.rl"
+	{scheme = s; scheme_len = p - s; }
+#line 138 "../../src/uri.rl"
+	{ login = s; login_len = p - s; }
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+	goto st206;
+st206:
+	if ( ++p == pe )
+		goto _test_eof206;
+case 206:
+#line 3760 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto tr174;
+		case 35: goto tr175;
+		case 37: goto tr176;
+		case 47: goto tr248;
+		case 59: goto tr174;
+		case 61: goto tr174;
+		case 63: goto tr179;
+		case 95: goto tr174;
+		case 126: goto tr174;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto tr174;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto tr180;
+		} else if ( (*p) >= 65 )
+			goto tr180;
+	} else
+		goto tr178;
+	goto st0;
+tr248:
+#line 169 "../../src/uri.rl"
+	{ uri->scheme = scheme; uri->scheme_len = scheme_len;}
+#line 131 "../../src/uri.rl"
+	{ s = p; }
+#line 132 "../../src/uri.rl"
+	{ uri->service = s; uri->service_len = p - s; }
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+	goto st207;
+st207:
+	if ( ++p == pe )
+		goto _test_eof207;
+case 207:
+#line 3798 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st148;
+		case 35: goto tr151;
+		case 37: goto st11;
+		case 47: goto st208;
+		case 61: goto st148;
+		case 63: goto tr155;
+		case 95: goto st148;
+		case 126: goto st148;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st148;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st148;
+	} else
+		goto st148;
+	goto st0;
+st208:
+	if ( ++p == pe )
+		goto _test_eof208;
+case 208:
+	switch( (*p) ) {
+		case 33: goto tr250;
+		case 35: goto tr151;
+		case 37: goto tr251;
+		case 47: goto st148;
+		case 58: goto st148;
+		case 59: goto tr250;
+		case 61: goto tr250;
+		case 63: goto tr155;
+		case 64: goto st148;
+		case 91: goto st38;
+		case 95: goto tr250;
+		case 117: goto tr253;
+		case 126: goto tr250;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto tr250;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto tr250;
+		} else if ( (*p) >= 65 )
+			goto tr250;
+	} else
+		goto tr252;
+	goto st0;
+tr250:
+#line 137 "../../src/uri.rl"
+	{ s = p; }
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st209;
+st209:
+	if ( ++p == pe )
+		goto _test_eof209;
+case 209:
+#line 3859 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st209;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st209;
+	} else
+		goto st209;
+	goto st0;
+tr251:
+#line 137 "../../src/uri.rl"
+	{ s = p; }
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st119;
+st119:
+	if ( ++p == pe )
+		goto _test_eof119;
+case 119:
+#line 3891 "../../src/uri.c"
+	switch( (*p) ) {
+		case 37: goto st209;
+		case 117: goto st120;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st209;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st209;
+	} else
+		goto st209;
+	goto st0;
+st120:
+	if ( ++p == pe )
+		goto _test_eof120;
+case 120:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st121;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st121;
+	} else
+		goto st121;
+	goto st0;
+st121:
+	if ( ++p == pe )
+		goto _test_eof121;
+case 121:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st122;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st122;
+	} else
+		goto st122;
+	goto st0;
+st122:
+	if ( ++p == pe )
+		goto _test_eof122;
+case 122:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st123;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st123;
+	} else
+		goto st123;
+	goto st0;
+st123:
+	if ( ++p == pe )
+		goto _test_eof123;
+case 123:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st209;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st209;
+	} else
+		goto st209;
+	goto st0;
+tr255:
+#line 138 "../../src/uri.rl"
+	{ login = s; login_len = p - s; }
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+	goto st210;
+tr303:
+#line 138 "../../src/uri.rl"
+	{ login = s; login_len = p - s; }
+#line 100 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;
+			   uri->host_hint = 1; }
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+	goto st210;
+st210:
+	if ( ++p == pe )
+		goto _test_eof210;
+case 210:
+#line 3976 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto tr257;
+		case 35: goto tr175;
+		case 37: goto tr258;
+		case 47: goto tr177;
+		case 58: goto st148;
+		case 59: goto tr257;
+		case 61: goto tr257;
+		case 63: goto tr179;
+		case 64: goto st148;
+		case 95: goto tr257;
+		case 126: goto tr257;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto tr257;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto tr260;
+		} else if ( (*p) >= 65 )
+			goto tr260;
+	} else
+		goto tr259;
+	goto st0;
+tr257:
+#line 141 "../../src/uri.rl"
+	{ s = p; }
+	goto st211;
+st211:
+	if ( ++p == pe )
+		goto _test_eof211;
+case 211:
+#line 4010 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st211;
+		case 35: goto tr151;
+		case 37: goto st124;
+		case 47: goto st148;
+		case 58: goto st148;
+		case 61: goto st211;
+		case 63: goto tr155;
+		case 64: goto tr262;
+		case 95: goto st211;
+		case 126: goto st211;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st211;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st211;
+	} else
+		goto st211;
+	goto st0;
+tr258:
+#line 141 "../../src/uri.rl"
+	{ s = p; }
+	goto st124;
+st124:
+	if ( ++p == pe )
+		goto _test_eof124;
+case 124:
+#line 4040 "../../src/uri.c"
+	switch( (*p) ) {
+		case 37: goto st211;
+		case 117: goto st125;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st211;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st211;
+	} else
+		goto st211;
+	goto st0;
+st125:
+	if ( ++p == pe )
+		goto _test_eof125;
+case 125:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st126;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st126;
+	} else
+		goto st126;
+	goto st0;
+st126:
+	if ( ++p == pe )
+		goto _test_eof126;
+case 126:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st127;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st127;
+	} else
+		goto st127;
+	goto st0;
+st127:
+	if ( ++p == pe )
+		goto _test_eof127;
+case 127:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st128;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st128;
+	} else
+		goto st128;
+	goto st0;
+st128:
+	if ( ++p == pe )
+		goto _test_eof128;
+case 128:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st211;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st211;
+	} else
+		goto st211;
+	goto st0;
+tr262:
+#line 142 "../../src/uri.rl"
+	{ uri->password = s; uri->password_len = p - s; }
+#line 146 "../../src/uri.rl"
+	{ uri->login = login; uri->login_len = login_len; }
+	goto st212;
+tr256:
+#line 138 "../../src/uri.rl"
+	{ login = s; login_len = p - s; }
+#line 146 "../../src/uri.rl"
+	{ uri->login = login; uri->login_len = login_len; }
+	goto st212;
+st212:
+	if ( ++p == pe )
+		goto _test_eof212;
+case 212:
+#line 4122 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto tr263;
+		case 35: goto tr151;
+		case 37: goto tr264;
+		case 47: goto st148;
+		case 58: goto st148;
+		case 59: goto tr263;
+		case 61: goto tr263;
+		case 63: goto tr155;
+		case 64: goto st148;
+		case 91: goto st38;
+		case 95: goto tr263;
+		case 117: goto tr266;
+		case 126: goto tr263;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto tr263;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto tr263;
+		} else if ( (*p) >= 65 )
+			goto tr263;
+	} else
+		goto tr265;
+	goto st0;
+tr263:
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st213;
+st213:
+	if ( ++p == pe )
+		goto _test_eof213;
+case 213:
+#line 4158 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st213;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st213;
+	} else
+		goto st213;
+	goto st0;
+tr264:
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st129;
+st129:
+	if ( ++p == pe )
+		goto _test_eof129;
+case 129:
+#line 4188 "../../src/uri.c"
+	switch( (*p) ) {
+		case 37: goto st213;
+		case 117: goto st130;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st213;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st213;
+	} else
+		goto st213;
+	goto st0;
+st130:
+	if ( ++p == pe )
+		goto _test_eof130;
+case 130:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st131;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st131;
+	} else
+		goto st131;
+	goto st0;
+st131:
+	if ( ++p == pe )
+		goto _test_eof131;
+case 131:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st132;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st132;
+	} else
+		goto st132;
+	goto st0;
+st132:
+	if ( ++p == pe )
+		goto _test_eof132;
+case 132:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st133;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st133;
+	} else
+		goto st133;
+	goto st0;
+st133:
+	if ( ++p == pe )
+		goto _test_eof133;
+case 133:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st213;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st213;
+	} else
+		goto st213;
+	goto st0;
+tr268:
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+	goto st214;
+tr283:
+#line 100 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;
+			   uri->host_hint = 1; }
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+	goto st214;
+st214:
+	if ( ++p == pe )
+		goto _test_eof214;
+case 214:
+#line 4269 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st148;
+		case 35: goto tr175;
+		case 37: goto st11;
+		case 47: goto tr177;
+		case 61: goto st148;
+		case 63: goto tr179;
+		case 64: goto st148;
+		case 95: goto st148;
+		case 126: goto st148;
+	}
+	if ( (*p) < 58 ) {
+		if ( (*p) > 46 ) {
+			if ( 48 <= (*p) && (*p) <= 57 )
+				goto tr269;
+		} else if ( (*p) >= 36 )
+			goto st148;
+	} else if ( (*p) > 59 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto tr270;
+		} else if ( (*p) >= 65 )
+			goto tr270;
+	} else
+		goto st148;
+	goto st0;
+tr269:
+#line 131 "../../src/uri.rl"
+	{ s = p; }
+	goto st215;
+st215:
+	if ( ++p == pe )
+		goto _test_eof215;
+case 215:
+#line 4304 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st148;
+		case 35: goto tr185;
+		case 37: goto st11;
+		case 47: goto tr186;
+		case 61: goto st148;
+		case 63: goto tr188;
+		case 95: goto st148;
+		case 126: goto st148;
+	}
+	if ( (*p) < 58 ) {
+		if ( (*p) > 46 ) {
+			if ( 48 <= (*p) && (*p) <= 57 )
+				goto st215;
+		} else if ( (*p) >= 36 )
+			goto st148;
+	} else if ( (*p) > 59 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st148;
+		} else if ( (*p) >= 64 )
+			goto st148;
+	} else
+		goto st148;
+	goto st0;
+tr270:
+#line 131 "../../src/uri.rl"
+	{ s = p; }
+	goto st216;
+st216:
+	if ( ++p == pe )
+		goto _test_eof216;
+case 216:
+#line 4338 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st148;
+		case 35: goto tr185;
+		case 37: goto st11;
+		case 47: goto tr186;
+		case 61: goto st148;
+		case 63: goto tr188;
+		case 64: goto st148;
+		case 95: goto st148;
+		case 126: goto st148;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st148;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st216;
+	} else
+		goto st216;
+	goto st0;
+tr265:
+#line 99 "../../src/uri.rl"
+	{ s = p; }
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st217;
+st217:
+	if ( ++p == pe )
+		goto _test_eof217;
+case 217:
+#line 4369 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 46: goto st218;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 59: goto st213;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st213;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st213;
+		} else if ( (*p) >= 65 )
+			goto st213;
+	} else
+		goto st230;
+	goto st0;
+st218:
+	if ( ++p == pe )
+		goto _test_eof218;
+case 218:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 59: goto st213;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st213;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st213;
+		} else if ( (*p) >= 65 )
+			goto st213;
+	} else
+		goto st219;
+	goto st0;
+st219:
+	if ( ++p == pe )
+		goto _test_eof219;
+case 219:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 46: goto st220;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 59: goto st213;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st213;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st213;
+		} else if ( (*p) >= 65 )
+			goto st213;
+	} else
+		goto st228;
+	goto st0;
+st220:
+	if ( ++p == pe )
+		goto _test_eof220;
+case 220:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 59: goto st213;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st213;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st213;
+		} else if ( (*p) >= 65 )
+			goto st213;
+	} else
+		goto st221;
+	goto st0;
+st221:
+	if ( ++p == pe )
+		goto _test_eof221;
+case 221:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 46: goto st222;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 59: goto st213;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st213;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st213;
+		} else if ( (*p) >= 65 )
+			goto st213;
+	} else
+		goto st226;
+	goto st0;
+st222:
+	if ( ++p == pe )
+		goto _test_eof222;
+case 222:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 59: goto st213;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st213;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st213;
+		} else if ( (*p) >= 65 )
+			goto st213;
+	} else
+		goto st223;
+	goto st0;
+st223:
+	if ( ++p == pe )
+		goto _test_eof223;
+case 223:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr200;
+		case 37: goto st129;
+		case 47: goto tr201;
+		case 58: goto tr283;
+		case 59: goto st213;
+		case 61: goto st213;
+		case 63: goto tr204;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st213;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st213;
+		} else if ( (*p) >= 65 )
+			goto st213;
+	} else
+		goto st224;
+	goto st0;
+st224:
+	if ( ++p == pe )
+		goto _test_eof224;
+case 224:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr200;
+		case 37: goto st129;
+		case 47: goto tr201;
+		case 58: goto tr283;
+		case 59: goto st213;
+		case 61: goto st213;
+		case 63: goto tr204;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st213;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st213;
+		} else if ( (*p) >= 65 )
+			goto st213;
+	} else
+		goto st225;
+	goto st0;
+st225:
+	if ( ++p == pe )
+		goto _test_eof225;
+case 225:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr200;
+		case 37: goto st129;
+		case 47: goto tr201;
+		case 58: goto tr283;
+		case 61: goto st213;
+		case 63: goto tr204;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st213;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st213;
+	} else
+		goto st213;
+	goto st0;
+st226:
+	if ( ++p == pe )
+		goto _test_eof226;
+case 226:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 46: goto st222;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 59: goto st213;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st213;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st213;
+		} else if ( (*p) >= 65 )
+			goto st213;
+	} else
+		goto st227;
+	goto st0;
+st227:
+	if ( ++p == pe )
+		goto _test_eof227;
+case 227:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 46: goto st222;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st213;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st213;
+	} else
+		goto st213;
+	goto st0;
+st228:
+	if ( ++p == pe )
+		goto _test_eof228;
+case 228:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 46: goto st220;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 59: goto st213;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st213;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st213;
+		} else if ( (*p) >= 65 )
+			goto st213;
+	} else
+		goto st229;
+	goto st0;
+st229:
+	if ( ++p == pe )
+		goto _test_eof229;
+case 229:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 46: goto st220;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st213;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st213;
+	} else
+		goto st213;
+	goto st0;
+st230:
+	if ( ++p == pe )
+		goto _test_eof230;
+case 230:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 46: goto st218;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 59: goto st213;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st213;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st213;
+		} else if ( (*p) >= 65 )
+			goto st213;
+	} else
+		goto st231;
+	goto st0;
+st231:
+	if ( ++p == pe )
+		goto _test_eof231;
+case 231:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 46: goto st218;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st213;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st213;
+	} else
+		goto st213;
+	goto st0;
+tr266:
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st232;
+st232:
+	if ( ++p == pe )
+		goto _test_eof232;
+case 232:
+#line 4802 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 110: goto st233;
+		case 126: goto st213;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st213;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st213;
+	} else
+		goto st213;
+	goto st0;
+st233:
+	if ( ++p == pe )
+		goto _test_eof233;
+case 233:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 105: goto st234;
+		case 126: goto st213;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st213;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st213;
+	} else
+		goto st213;
+	goto st0;
+st234:
+	if ( ++p == pe )
+		goto _test_eof234;
+case 234:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 47: goto tr161;
+		case 58: goto tr268;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 120: goto st235;
+		case 126: goto st213;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st213;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st213;
+	} else
+		goto st213;
+	goto st0;
+st235:
+	if ( ++p == pe )
+		goto _test_eof235;
+case 235:
+	switch( (*p) ) {
+		case 33: goto st213;
+		case 35: goto tr159;
+		case 37: goto st129;
+		case 47: goto tr216;
+		case 58: goto tr268;
+		case 61: goto st213;
+		case 63: goto tr163;
+		case 64: goto st148;
+		case 95: goto st213;
+		case 126: goto st213;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st213;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st213;
+	} else
+		goto st213;
+	goto st0;
+tr259:
+#line 141 "../../src/uri.rl"
+	{ s = p; }
+#line 131 "../../src/uri.rl"
+	{ s = p; }
+	goto st236;
+st236:
+	if ( ++p == pe )
+		goto _test_eof236;
+case 236:
+#line 4912 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st211;
+		case 35: goto tr185;
+		case 37: goto st124;
+		case 47: goto tr186;
+		case 58: goto st148;
+		case 59: goto st211;
+		case 61: goto st211;
+		case 63: goto tr188;
+		case 64: goto tr262;
+		case 95: goto st211;
+		case 126: goto st211;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st211;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st211;
+		} else if ( (*p) >= 65 )
+			goto st211;
+	} else
+		goto st236;
+	goto st0;
+tr260:
+#line 141 "../../src/uri.rl"
+	{ s = p; }
+#line 131 "../../src/uri.rl"
+	{ s = p; }
+	goto st237;
+st237:
+	if ( ++p == pe )
+		goto _test_eof237;
+case 237:
+#line 4948 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st211;
+		case 35: goto tr185;
+		case 37: goto st124;
+		case 47: goto tr186;
+		case 58: goto st148;
+		case 61: goto st211;
+		case 63: goto tr188;
+		case 64: goto tr262;
+		case 95: goto st211;
+		case 126: goto st211;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st211;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st237;
+	} else
+		goto st237;
+	goto st0;
+tr252:
+#line 137 "../../src/uri.rl"
+	{ s = p; }
+#line 99 "../../src/uri.rl"
+	{ s = p; }
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st238;
+st238:
+	if ( ++p == pe )
+		goto _test_eof238;
+case 238:
+#line 4982 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 46: goto st239;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 59: goto st209;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st209;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st209;
+		} else if ( (*p) >= 65 )
+			goto st209;
+	} else
+		goto st251;
+	goto st0;
+st239:
+	if ( ++p == pe )
+		goto _test_eof239;
+case 239:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 59: goto st209;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st209;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st209;
+		} else if ( (*p) >= 65 )
+			goto st209;
+	} else
+		goto st240;
+	goto st0;
+st240:
+	if ( ++p == pe )
+		goto _test_eof240;
+case 240:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 46: goto st241;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 59: goto st209;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st209;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st209;
+		} else if ( (*p) >= 65 )
+			goto st209;
+	} else
+		goto st249;
+	goto st0;
+st241:
+	if ( ++p == pe )
+		goto _test_eof241;
+case 241:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 59: goto st209;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st209;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st209;
+		} else if ( (*p) >= 65 )
+			goto st209;
+	} else
+		goto st242;
+	goto st0;
+st242:
+	if ( ++p == pe )
+		goto _test_eof242;
+case 242:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 46: goto st243;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 59: goto st209;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st209;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st209;
+		} else if ( (*p) >= 65 )
+			goto st209;
+	} else
+		goto st247;
+	goto st0;
+st243:
+	if ( ++p == pe )
+		goto _test_eof243;
+case 243:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 59: goto st209;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st209;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st209;
+		} else if ( (*p) >= 65 )
+			goto st209;
+	} else
+		goto st244;
+	goto st0;
+st244:
+	if ( ++p == pe )
+		goto _test_eof244;
+case 244:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr200;
+		case 37: goto st119;
+		case 47: goto tr201;
+		case 58: goto tr303;
+		case 59: goto st209;
+		case 61: goto st209;
+		case 63: goto tr204;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st209;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st209;
+		} else if ( (*p) >= 65 )
+			goto st209;
+	} else
+		goto st245;
+	goto st0;
+st245:
+	if ( ++p == pe )
+		goto _test_eof245;
+case 245:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr200;
+		case 37: goto st119;
+		case 47: goto tr201;
+		case 58: goto tr303;
+		case 59: goto st209;
+		case 61: goto st209;
+		case 63: goto tr204;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 46 )
+			goto st209;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st209;
+		} else if ( (*p) >= 65 )
+			goto st209;
+	} else
+		goto st246;
+	goto st0;
+st246:
+	if ( ++p == pe )
+		goto _test_eof246;
+case 246:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr200;
+		case 37: goto st119;
+		case 47: goto tr201;
+		case 58: goto tr303;
+		case 61: goto st209;
+		case 63: goto tr204;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st209;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st209;
+	} else
+		goto st209;
+	goto st0;
+st247:
+	if ( ++p == pe )
+		goto _test_eof247;
+case 247:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 46: goto st243;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 59: goto st209;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st209;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st209;
+		} else if ( (*p) >= 65 )
+			goto st209;
+	} else
+		goto st248;
+	goto st0;
+st248:
+	if ( ++p == pe )
+		goto _test_eof248;
+case 248:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 46: goto st243;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st209;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st209;
+	} else
+		goto st209;
+	goto st0;
+st249:
+	if ( ++p == pe )
+		goto _test_eof249;
+case 249:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 46: goto st241;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 59: goto st209;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st209;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st209;
+		} else if ( (*p) >= 65 )
+			goto st209;
+	} else
+		goto st250;
+	goto st0;
+st250:
+	if ( ++p == pe )
+		goto _test_eof250;
+case 250:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 46: goto st241;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st209;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st209;
+	} else
+		goto st209;
+	goto st0;
+st251:
+	if ( ++p == pe )
+		goto _test_eof251;
+case 251:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 46: goto st239;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 59: goto st209;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 48 ) {
+		if ( 36 <= (*p) && (*p) <= 45 )
+			goto st209;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st209;
+		} else if ( (*p) >= 65 )
+			goto st209;
+	} else
+		goto st252;
+	goto st0;
+st252:
+	if ( ++p == pe )
+		goto _test_eof252;
+case 252:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 46: goto st239;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st209;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st209;
+	} else
+		goto st209;
+	goto st0;
+tr253:
+#line 137 "../../src/uri.rl"
+	{ s = p; }
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st253;
+st253:
+	if ( ++p == pe )
+		goto _test_eof253;
+case 253:
+#line 5417 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 110: goto st254;
+		case 126: goto st209;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st209;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st209;
+	} else
+		goto st209;
+	goto st0;
+st254:
+	if ( ++p == pe )
+		goto _test_eof254;
+case 254:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 105: goto st255;
+		case 126: goto st209;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st209;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st209;
+	} else
+		goto st209;
+	goto st0;
+st255:
+	if ( ++p == pe )
+		goto _test_eof255;
+case 255:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 47: goto tr161;
+		case 58: goto tr255;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 120: goto st256;
+		case 126: goto st209;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st209;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st209;
+	} else
+		goto st209;
+	goto st0;
+st256:
+	if ( ++p == pe )
+		goto _test_eof256;
+case 256:
+	switch( (*p) ) {
+		case 33: goto st209;
+		case 35: goto tr159;
+		case 37: goto st119;
+		case 47: goto tr311;
+		case 58: goto tr255;
+		case 61: goto st209;
+		case 63: goto tr163;
+		case 64: goto tr256;
+		case 95: goto st209;
+		case 126: goto st209;
+	}
+	if ( (*p) < 65 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st209;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st209;
+	} else
+		goto st209;
+	goto st0;
+tr311:
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+	goto st257;
+st257:
+	if ( ++p == pe )
+		goto _test_eof257;
+case 257:
+#line 5527 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st148;
+		case 35: goto tr151;
+		case 37: goto st11;
+		case 58: goto st258;
+		case 61: goto st148;
+		case 63: goto tr155;
+		case 95: goto st148;
+		case 126: goto st148;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st148;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st148;
+	} else
+		goto st148;
+	goto st0;
+st258:
+	if ( ++p == pe )
+		goto _test_eof258;
+case 258:
+	switch( (*p) ) {
+		case 33: goto tr313;
+		case 35: goto tr314;
+		case 37: goto tr315;
+		case 47: goto tr316;
+		case 58: goto tr221;
+		case 61: goto tr313;
+		case 63: goto tr317;
+		case 95: goto tr313;
+		case 126: goto tr313;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto tr313;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto tr313;
+	} else
+		goto tr313;
+	goto st0;
+tr313:
+#line 128 "../../src/uri.rl"
+	{ s = p;}
+	goto st259;
+st259:
+	if ( ++p == pe )
+		goto _test_eof259;
+case 259:
+#line 5579 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st259;
+		case 35: goto tr318;
+		case 37: goto st134;
+		case 47: goto st260;
+		case 58: goto tr223;
+		case 61: goto st259;
+		case 63: goto tr320;
+		case 95: goto st259;
+		case 126: goto st259;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st259;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st259;
+	} else
+		goto st259;
+	goto st0;
+tr315:
+#line 128 "../../src/uri.rl"
+	{ s = p;}
+	goto st134;
+st134:
+	if ( ++p == pe )
+		goto _test_eof134;
+case 134:
+#line 5608 "../../src/uri.c"
+	switch( (*p) ) {
+		case 37: goto st259;
+		case 117: goto st135;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st259;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st259;
+	} else
+		goto st259;
+	goto st0;
+st135:
+	if ( ++p == pe )
+		goto _test_eof135;
+case 135:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st136;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st136;
+	} else
+		goto st136;
+	goto st0;
+st136:
+	if ( ++p == pe )
+		goto _test_eof136;
+case 136:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st137;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st137;
+	} else
+		goto st137;
+	goto st0;
+st137:
+	if ( ++p == pe )
+		goto _test_eof137;
+case 137:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st138;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st138;
+	} else
+		goto st138;
+	goto st0;
+st138:
+	if ( ++p == pe )
+		goto _test_eof138;
+case 138:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st259;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st259;
+	} else
+		goto st259;
+	goto st0;
+tr324:
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+	goto st260;
+tr316:
+#line 128 "../../src/uri.rl"
+	{ s = p;}
+	goto st260;
+st260:
+	if ( ++p == pe )
+		goto _test_eof260;
+case 260:
+#line 5686 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st260;
+		case 35: goto tr318;
+		case 37: goto st139;
+		case 58: goto tr322;
+		case 61: goto st260;
+		case 63: goto tr320;
+		case 95: goto st260;
+		case 126: goto st260;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st260;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st260;
+	} else
+		goto st260;
+	goto st0;
+st139:
+	if ( ++p == pe )
+		goto _test_eof139;
+case 139:
+	switch( (*p) ) {
+		case 37: goto st260;
+		case 117: goto st140;
+	}
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st260;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st260;
+	} else
+		goto st260;
+	goto st0;
+st140:
+	if ( ++p == pe )
+		goto _test_eof140;
+case 140:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st141;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st141;
+	} else
+		goto st141;
+	goto st0;
+st141:
+	if ( ++p == pe )
+		goto _test_eof141;
+case 141:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st142;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st142;
+	} else
+		goto st142;
+	goto st0;
+st142:
+	if ( ++p == pe )
+		goto _test_eof142;
+case 142:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st143;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st143;
+	} else
+		goto st143;
+	goto st0;
+st143:
+	if ( ++p == pe )
+		goto _test_eof143;
+case 143:
+	if ( (*p) < 65 ) {
+		if ( 48 <= (*p) && (*p) <= 57 )
+			goto st260;
+	} else if ( (*p) > 70 ) {
+		if ( 97 <= (*p) && (*p) <= 102 )
+			goto st260;
+	} else
+		goto st260;
+	goto st0;
+tr322:
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+	goto st261;
+st261:
+	if ( ++p == pe )
+		goto _test_eof261;
+case 261:
+#line 5798 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st260;
+		case 35: goto tr323;
+		case 37: goto st139;
+		case 47: goto tr324;
+		case 58: goto tr322;
+		case 61: goto st260;
+		case 63: goto tr325;
+		case 95: goto st260;
+		case 126: goto st260;
+	}
+	if ( (*p) < 64 ) {
+		if ( 36 <= (*p) && (*p) <= 59 )
+			goto st260;
+	} else if ( (*p) > 90 ) {
+		if ( 97 <= (*p) && (*p) <= 122 )
+			goto st260;
+	} else
+		goto st260;
+	goto st0;
+tr158:
+#line 151 "../../src/uri.rl"
+	{ s = p; }
+#line 137 "../../src/uri.rl"
+	{ s = p; }
+#line 92 "../../src/uri.rl"
+	{ s = p; }
+	goto st262;
+st262:
+	if ( ++p == pe )
+		goto _test_eof262;
+case 262:
+#line 5831 "../../src/uri.c"
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 43: goto st205;
+		case 47: goto tr161;
+		case 58: goto tr247;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 110: goto st263;
+		case 126: goto st145;
+	}
+	if ( (*p) < 45 ) {
+		if ( 36 <= (*p) && (*p) <= 44 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st205;
+		} else if ( (*p) >= 65 )
+			goto st205;
+	} else
+		goto st205;
+	goto st0;
+st263:
+	if ( ++p == pe )
+		goto _test_eof263;
+case 263:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 43: goto st205;
+		case 47: goto tr161;
+		case 58: goto tr247;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 105: goto st264;
+		case 126: goto st145;
+	}
+	if ( (*p) < 45 ) {
+		if ( 36 <= (*p) && (*p) <= 44 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st205;
+		} else if ( (*p) >= 65 )
+			goto st205;
+	} else
+		goto st205;
+	goto st0;
+st264:
+	if ( ++p == pe )
+		goto _test_eof264;
+case 264:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 43: goto st205;
+		case 47: goto tr161;
+		case 58: goto tr247;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 120: goto st265;
+		case 126: goto st145;
+	}
+	if ( (*p) < 45 ) {
+		if ( 36 <= (*p) && (*p) <= 44 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st205;
+		} else if ( (*p) >= 65 )
+			goto st205;
+	} else
+		goto st205;
+	goto st0;
+st265:
+	if ( ++p == pe )
+		goto _test_eof265;
+case 265:
+	switch( (*p) ) {
+		case 33: goto st145;
+		case 35: goto tr159;
+		case 37: goto st6;
+		case 43: goto st205;
+		case 47: goto tr311;
+		case 58: goto tr247;
+		case 59: goto st145;
+		case 61: goto st145;
+		case 63: goto tr163;
+		case 64: goto tr164;
+		case 95: goto st145;
+		case 126: goto st145;
+	}
+	if ( (*p) < 45 ) {
+		if ( 36 <= (*p) && (*p) <= 44 )
+			goto st145;
+	} else if ( (*p) > 57 ) {
+		if ( (*p) > 90 ) {
+			if ( 97 <= (*p) && (*p) <= 122 )
+				goto st205;
+		} else if ( (*p) >= 65 )
+			goto st205;
+	} else
+		goto st205;
+	goto st0;
+	}
+	_test_eof145: cs = 145; goto _test_eof; 
+	_test_eof146: cs = 146; goto _test_eof; 
+	_test_eof147: cs = 147; goto _test_eof; 
+	_test_eof1: cs = 1; goto _test_eof; 
+	_test_eof2: cs = 2; goto _test_eof; 
+	_test_eof3: cs = 3; goto _test_eof; 
+	_test_eof4: cs = 4; goto _test_eof; 
+	_test_eof5: cs = 5; goto _test_eof; 
+	_test_eof6: cs = 6; goto _test_eof; 
+	_test_eof7: cs = 7; goto _test_eof; 
+	_test_eof8: cs = 8; goto _test_eof; 
+	_test_eof9: cs = 9; goto _test_eof; 
+	_test_eof10: cs = 10; goto _test_eof; 
+	_test_eof148: cs = 148; goto _test_eof; 
+	_test_eof11: cs = 11; goto _test_eof; 
+	_test_eof12: cs = 12; goto _test_eof; 
+	_test_eof13: cs = 13; goto _test_eof; 
+	_test_eof14: cs = 14; goto _test_eof; 
+	_test_eof15: cs = 15; goto _test_eof; 
+	_test_eof149: cs = 149; goto _test_eof; 
+	_test_eof150: cs = 150; goto _test_eof; 
+	_test_eof16: cs = 16; goto _test_eof; 
+	_test_eof17: cs = 17; goto _test_eof; 
+	_test_eof18: cs = 18; goto _test_eof; 
+	_test_eof19: cs = 19; goto _test_eof; 
+	_test_eof20: cs = 20; goto _test_eof; 
+	_test_eof151: cs = 151; goto _test_eof; 
+	_test_eof21: cs = 21; goto _test_eof; 
+	_test_eof22: cs = 22; goto _test_eof; 
+	_test_eof23: cs = 23; goto _test_eof; 
+	_test_eof24: cs = 24; goto _test_eof; 
+	_test_eof25: cs = 25; goto _test_eof; 
+	_test_eof26: cs = 26; goto _test_eof; 
+	_test_eof27: cs = 27; goto _test_eof; 
+	_test_eof152: cs = 152; goto _test_eof; 
+	_test_eof28: cs = 28; goto _test_eof; 
+	_test_eof29: cs = 29; goto _test_eof; 
+	_test_eof30: cs = 30; goto _test_eof; 
+	_test_eof31: cs = 31; goto _test_eof; 
+	_test_eof32: cs = 32; goto _test_eof; 
+	_test_eof153: cs = 153; goto _test_eof; 
+	_test_eof154: cs = 154; goto _test_eof; 
+	_test_eof155: cs = 155; goto _test_eof; 
+	_test_eof156: cs = 156; goto _test_eof; 
+	_test_eof157: cs = 157; goto _test_eof; 
+	_test_eof33: cs = 33; goto _test_eof; 
+	_test_eof34: cs = 34; goto _test_eof; 
+	_test_eof35: cs = 35; goto _test_eof; 
+	_test_eof36: cs = 36; goto _test_eof; 
+	_test_eof37: cs = 37; goto _test_eof; 
+	_test_eof158: cs = 158; goto _test_eof; 
+	_test_eof159: cs = 159; goto _test_eof; 
+	_test_eof160: cs = 160; goto _test_eof; 
+	_test_eof161: cs = 161; goto _test_eof; 
+	_test_eof162: cs = 162; goto _test_eof; 
+	_test_eof163: cs = 163; goto _test_eof; 
+	_test_eof164: cs = 164; goto _test_eof; 
+	_test_eof165: cs = 165; goto _test_eof; 
+	_test_eof166: cs = 166; goto _test_eof; 
+	_test_eof167: cs = 167; goto _test_eof; 
+	_test_eof168: cs = 168; goto _test_eof; 
+	_test_eof169: cs = 169; goto _test_eof; 
+	_test_eof170: cs = 170; goto _test_eof; 
+	_test_eof171: cs = 171; goto _test_eof; 
+	_test_eof172: cs = 172; goto _test_eof; 
+	_test_eof38: cs = 38; goto _test_eof; 
+	_test_eof39: cs = 39; goto _test_eof; 
+	_test_eof40: cs = 40; goto _test_eof; 
+	_test_eof41: cs = 41; goto _test_eof; 
+	_test_eof42: cs = 42; goto _test_eof; 
+	_test_eof43: cs = 43; goto _test_eof; 
+	_test_eof44: cs = 44; goto _test_eof; 
+	_test_eof45: cs = 45; goto _test_eof; 
+	_test_eof46: cs = 46; goto _test_eof; 
+	_test_eof47: cs = 47; goto _test_eof; 
+	_test_eof48: cs = 48; goto _test_eof; 
+	_test_eof49: cs = 49; goto _test_eof; 
+	_test_eof50: cs = 50; goto _test_eof; 
+	_test_eof51: cs = 51; goto _test_eof; 
+	_test_eof52: cs = 52; goto _test_eof; 
+	_test_eof53: cs = 53; goto _test_eof; 
+	_test_eof54: cs = 54; goto _test_eof; 
+	_test_eof55: cs = 55; goto _test_eof; 
+	_test_eof56: cs = 56; goto _test_eof; 
+	_test_eof57: cs = 57; goto _test_eof; 
+	_test_eof58: cs = 58; goto _test_eof; 
+	_test_eof59: cs = 59; goto _test_eof; 
+	_test_eof60: cs = 60; goto _test_eof; 
+	_test_eof61: cs = 61; goto _test_eof; 
+	_test_eof62: cs = 62; goto _test_eof; 
+	_test_eof63: cs = 63; goto _test_eof; 
+	_test_eof64: cs = 64; goto _test_eof; 
+	_test_eof65: cs = 65; goto _test_eof; 
+	_test_eof66: cs = 66; goto _test_eof; 
+	_test_eof67: cs = 67; goto _test_eof; 
+	_test_eof68: cs = 68; goto _test_eof; 
+	_test_eof69: cs = 69; goto _test_eof; 
+	_test_eof70: cs = 70; goto _test_eof; 
+	_test_eof71: cs = 71; goto _test_eof; 
+	_test_eof72: cs = 72; goto _test_eof; 
+	_test_eof73: cs = 73; goto _test_eof; 
+	_test_eof74: cs = 74; goto _test_eof; 
+	_test_eof75: cs = 75; goto _test_eof; 
+	_test_eof76: cs = 76; goto _test_eof; 
+	_test_eof77: cs = 77; goto _test_eof; 
+	_test_eof78: cs = 78; goto _test_eof; 
+	_test_eof79: cs = 79; goto _test_eof; 
+	_test_eof80: cs = 80; goto _test_eof; 
+	_test_eof81: cs = 81; goto _test_eof; 
+	_test_eof82: cs = 82; goto _test_eof; 
+	_test_eof173: cs = 173; goto _test_eof; 
+	_test_eof83: cs = 83; goto _test_eof; 
+	_test_eof84: cs = 84; goto _test_eof; 
+	_test_eof85: cs = 85; goto _test_eof; 
+	_test_eof86: cs = 86; goto _test_eof; 
+	_test_eof87: cs = 87; goto _test_eof; 
+	_test_eof88: cs = 88; goto _test_eof; 
+	_test_eof89: cs = 89; goto _test_eof; 
+	_test_eof90: cs = 90; goto _test_eof; 
+	_test_eof91: cs = 91; goto _test_eof; 
+	_test_eof92: cs = 92; goto _test_eof; 
+	_test_eof93: cs = 93; goto _test_eof; 
+	_test_eof94: cs = 94; goto _test_eof; 
+	_test_eof95: cs = 95; goto _test_eof; 
+	_test_eof96: cs = 96; goto _test_eof; 
+	_test_eof97: cs = 97; goto _test_eof; 
+	_test_eof98: cs = 98; goto _test_eof; 
+	_test_eof99: cs = 99; goto _test_eof; 
+	_test_eof100: cs = 100; goto _test_eof; 
+	_test_eof101: cs = 101; goto _test_eof; 
+	_test_eof102: cs = 102; goto _test_eof; 
+	_test_eof103: cs = 103; goto _test_eof; 
+	_test_eof174: cs = 174; goto _test_eof; 
+	_test_eof175: cs = 175; goto _test_eof; 
+	_test_eof176: cs = 176; goto _test_eof; 
+	_test_eof177: cs = 177; goto _test_eof; 
+	_test_eof178: cs = 178; goto _test_eof; 
+	_test_eof179: cs = 179; goto _test_eof; 
+	_test_eof180: cs = 180; goto _test_eof; 
+	_test_eof104: cs = 104; goto _test_eof; 
+	_test_eof105: cs = 105; goto _test_eof; 
+	_test_eof106: cs = 106; goto _test_eof; 
+	_test_eof107: cs = 107; goto _test_eof; 
+	_test_eof108: cs = 108; goto _test_eof; 
+	_test_eof181: cs = 181; goto _test_eof; 
+	_test_eof109: cs = 109; goto _test_eof; 
+	_test_eof110: cs = 110; goto _test_eof; 
+	_test_eof111: cs = 111; goto _test_eof; 
+	_test_eof112: cs = 112; goto _test_eof; 
+	_test_eof113: cs = 113; goto _test_eof; 
+	_test_eof182: cs = 182; goto _test_eof; 
+	_test_eof183: cs = 183; goto _test_eof; 
+	_test_eof184: cs = 184; goto _test_eof; 
+	_test_eof185: cs = 185; goto _test_eof; 
+	_test_eof186: cs = 186; goto _test_eof; 
+	_test_eof187: cs = 187; goto _test_eof; 
+	_test_eof114: cs = 114; goto _test_eof; 
+	_test_eof115: cs = 115; goto _test_eof; 
+	_test_eof116: cs = 116; goto _test_eof; 
+	_test_eof117: cs = 117; goto _test_eof; 
+	_test_eof118: cs = 118; goto _test_eof; 
+	_test_eof188: cs = 188; goto _test_eof; 
+	_test_eof189: cs = 189; goto _test_eof; 
+	_test_eof190: cs = 190; goto _test_eof; 
+	_test_eof191: cs = 191; goto _test_eof; 
+	_test_eof192: cs = 192; goto _test_eof; 
+	_test_eof193: cs = 193; goto _test_eof; 
+	_test_eof194: cs = 194; goto _test_eof; 
+	_test_eof195: cs = 195; goto _test_eof; 
+	_test_eof196: cs = 196; goto _test_eof; 
+	_test_eof197: cs = 197; goto _test_eof; 
+	_test_eof198: cs = 198; goto _test_eof; 
+	_test_eof199: cs = 199; goto _test_eof; 
+	_test_eof200: cs = 200; goto _test_eof; 
+	_test_eof201: cs = 201; goto _test_eof; 
+	_test_eof202: cs = 202; goto _test_eof; 
+	_test_eof203: cs = 203; goto _test_eof; 
+	_test_eof204: cs = 204; goto _test_eof; 
+	_test_eof205: cs = 205; goto _test_eof; 
+	_test_eof206: cs = 206; goto _test_eof; 
+	_test_eof207: cs = 207; goto _test_eof; 
+	_test_eof208: cs = 208; goto _test_eof; 
+	_test_eof209: cs = 209; goto _test_eof; 
+	_test_eof119: cs = 119; goto _test_eof; 
+	_test_eof120: cs = 120; goto _test_eof; 
+	_test_eof121: cs = 121; goto _test_eof; 
+	_test_eof122: cs = 122; goto _test_eof; 
+	_test_eof123: cs = 123; goto _test_eof; 
+	_test_eof210: cs = 210; goto _test_eof; 
+	_test_eof211: cs = 211; goto _test_eof; 
+	_test_eof124: cs = 124; goto _test_eof; 
+	_test_eof125: cs = 125; goto _test_eof; 
+	_test_eof126: cs = 126; goto _test_eof; 
+	_test_eof127: cs = 127; goto _test_eof; 
+	_test_eof128: cs = 128; goto _test_eof; 
+	_test_eof212: cs = 212; goto _test_eof; 
+	_test_eof213: cs = 213; goto _test_eof; 
+	_test_eof129: cs = 129; goto _test_eof; 
+	_test_eof130: cs = 130; goto _test_eof; 
+	_test_eof131: cs = 131; goto _test_eof; 
+	_test_eof132: cs = 132; goto _test_eof; 
+	_test_eof133: cs = 133; goto _test_eof; 
+	_test_eof214: cs = 214; goto _test_eof; 
+	_test_eof215: cs = 215; goto _test_eof; 
+	_test_eof216: cs = 216; goto _test_eof; 
+	_test_eof217: cs = 217; goto _test_eof; 
+	_test_eof218: cs = 218; goto _test_eof; 
+	_test_eof219: cs = 219; goto _test_eof; 
+	_test_eof220: cs = 220; goto _test_eof; 
+	_test_eof221: cs = 221; goto _test_eof; 
+	_test_eof222: cs = 222; goto _test_eof; 
+	_test_eof223: cs = 223; goto _test_eof; 
+	_test_eof224: cs = 224; goto _test_eof; 
+	_test_eof225: cs = 225; goto _test_eof; 
+	_test_eof226: cs = 226; goto _test_eof; 
+	_test_eof227: cs = 227; goto _test_eof; 
+	_test_eof228: cs = 228; goto _test_eof; 
+	_test_eof229: cs = 229; goto _test_eof; 
+	_test_eof230: cs = 230; goto _test_eof; 
+	_test_eof231: cs = 231; goto _test_eof; 
+	_test_eof232: cs = 232; goto _test_eof; 
+	_test_eof233: cs = 233; goto _test_eof; 
+	_test_eof234: cs = 234; goto _test_eof; 
+	_test_eof235: cs = 235; goto _test_eof; 
+	_test_eof236: cs = 236; goto _test_eof; 
+	_test_eof237: cs = 237; goto _test_eof; 
+	_test_eof238: cs = 238; goto _test_eof; 
+	_test_eof239: cs = 239; goto _test_eof; 
+	_test_eof240: cs = 240; goto _test_eof; 
+	_test_eof241: cs = 241; goto _test_eof; 
+	_test_eof242: cs = 242; goto _test_eof; 
+	_test_eof243: cs = 243; goto _test_eof; 
+	_test_eof244: cs = 244; goto _test_eof; 
+	_test_eof245: cs = 245; goto _test_eof; 
+	_test_eof246: cs = 246; goto _test_eof; 
+	_test_eof247: cs = 247; goto _test_eof; 
+	_test_eof248: cs = 248; goto _test_eof; 
+	_test_eof249: cs = 249; goto _test_eof; 
+	_test_eof250: cs = 250; goto _test_eof; 
+	_test_eof251: cs = 251; goto _test_eof; 
+	_test_eof252: cs = 252; goto _test_eof; 
+	_test_eof253: cs = 253; goto _test_eof; 
+	_test_eof254: cs = 254; goto _test_eof; 
+	_test_eof255: cs = 255; goto _test_eof; 
+	_test_eof256: cs = 256; goto _test_eof; 
+	_test_eof257: cs = 257; goto _test_eof; 
+	_test_eof258: cs = 258; goto _test_eof; 
+	_test_eof259: cs = 259; goto _test_eof; 
+	_test_eof134: cs = 134; goto _test_eof; 
+	_test_eof135: cs = 135; goto _test_eof; 
+	_test_eof136: cs = 136; goto _test_eof; 
+	_test_eof137: cs = 137; goto _test_eof; 
+	_test_eof138: cs = 138; goto _test_eof; 
+	_test_eof260: cs = 260; goto _test_eof; 
+	_test_eof139: cs = 139; goto _test_eof; 
+	_test_eof140: cs = 140; goto _test_eof; 
+	_test_eof141: cs = 141; goto _test_eof; 
+	_test_eof142: cs = 142; goto _test_eof; 
+	_test_eof143: cs = 143; goto _test_eof; 
+	_test_eof261: cs = 261; goto _test_eof; 
+	_test_eof262: cs = 262; goto _test_eof; 
+	_test_eof263: cs = 263; goto _test_eof; 
+	_test_eof264: cs = 264; goto _test_eof; 
+	_test_eof265: cs = 265; goto _test_eof; 
+
+	_test_eof: {}
+	if ( p == eof )
+	{
+	switch ( cs ) {
+	case 150: 
+#line 69 "../../src/uri.rl"
+	{ uri->query = s; uri->query_len = p - s; }
+	break;
+	case 147: 
+#line 73 "../../src/uri.rl"
+	{ uri->fragment = s; uri->fragment_len = p - s; }
+	break;
+	case 156: 
+	case 157: 
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+	break;
+	case 144: 
+	case 148: 
+	case 178: 
+	case 179: 
+	case 180: 
+	case 181: 
+	case 204: 
+	case 207: 
+	case 208: 
+	case 211: 
+	case 212: 
+	case 257: 
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+	break;
+	case 149: 
+#line 68 "../../src/uri.rl"
+	{ s = p; }
+#line 69 "../../src/uri.rl"
+	{ uri->query = s; uri->query_len = p - s; }
+	break;
+	case 146: 
+#line 72 "../../src/uri.rl"
+	{ s = p; }
+#line 73 "../../src/uri.rl"
+	{ uri->fragment = s; uri->fragment_len = p - s; }
+	break;
+	case 173: 
+	case 182: 
+	case 183: 
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+	break;
+	case 186: 
+	case 187: 
+	case 259: 
+	case 260: 
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+	break;
+	case 145: 
+	case 152: 
+	case 158: 
+	case 159: 
+	case 160: 
+	case 161: 
+	case 162: 
+	case 163: 
+	case 167: 
+	case 168: 
+	case 169: 
+	case 170: 
+	case 171: 
+	case 172: 
+	case 174: 
+	case 175: 
+	case 176: 
+	case 177: 
+	case 189: 
+	case 190: 
+	case 191: 
+	case 192: 
+	case 193: 
+	case 197: 
+	case 198: 
+	case 199: 
+	case 200: 
+	case 205: 
+	case 209: 
+	case 213: 
+	case 217: 
+	case 218: 
+	case 219: 
+	case 220: 
+	case 221: 
+	case 222: 
+	case 226: 
+	case 227: 
+	case 228: 
+	case 229: 
+	case 230: 
+	case 231: 
+	case 232: 
+	case 233: 
+	case 234: 
+	case 235: 
+	case 238: 
+	case 239: 
+	case 240: 
+	case 241: 
+	case 242: 
+	case 243: 
+	case 247: 
+	case 248: 
+	case 249: 
+	case 250: 
+	case 251: 
+	case 252: 
+	case 253: 
+	case 254: 
+	case 255: 
+	case 256: 
+	case 262: 
+	case 263: 
+	case 264: 
+	case 265: 
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+	break;
+	case 154: 
+	case 155: 
+	case 184: 
+	case 185: 
+	case 215: 
+	case 216: 
+	case 236: 
+	case 237: 
+#line 132 "../../src/uri.rl"
+	{ uri->service = s; uri->service_len = p - s; }
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+	break;
+	case 261: 
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+	break;
+	case 258: 
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 128 "../../src/uri.rl"
+	{ s = p;}
+#line 111 "../../src/uri.rl"
+	{
+			/*
+			 * This action is also called for path_* terminals.
+			 * I absolute have no idea why. Please don't blame
+			 * and fix grammar if you have a LOT of free time.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+	break;
+	case 188: 
+	case 201: 
+	case 202: 
+	case 203: 
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+#line 179 "../../src/uri.rl"
+	{ uri->service_len = p - uri->service;
+			   uri->host = NULL; uri->host_len = 0; }
+	break;
+	case 164: 
+	case 165: 
+	case 166: 
+	case 194: 
+	case 195: 
+	case 196: 
+	case 223: 
+	case 224: 
+	case 225: 
+	case 244: 
+	case 245: 
+	case 246: 
+#line 100 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;
+			   uri->host_hint = 1; }
+#line 93 "../../src/uri.rl"
+	{ uri->host = s; uri->host_len = p - s;}
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+	break;
+	case 151: 
+	case 153: 
+	case 206: 
+	case 210: 
+	case 214: 
+#line 131 "../../src/uri.rl"
+	{ s = p; }
+#line 132 "../../src/uri.rl"
+	{ uri->service = s; uri->service_len = p - s; }
+#line 161 "../../src/uri.rl"
+	{ s = p; }
+#line 165 "../../src/uri.rl"
+	{ uri->path = s; uri->path_len = p - s; }
+	break;
+#line 6492 "../../src/uri.c"
+	}
+	}
+
+	_out: {}
+	}
+
+#line 192 "../../src/uri.rl"
+
+
+	if (uri->path_len == 0)
+		uri->path = NULL;
+	if (uri->service_len == 0)
+		uri->service = NULL;
+	if (uri->service_len >= URI_MAXSERVICE)
+		return -1;
+	if (uri->host_len >= URI_MAXHOST)
+		return -1;
+
+	(void)uri_first_final;
+	(void)uri_error;
+	(void)uri_en_main;
+	(void)eof;
+
+	return cs >= uri_first_final ? 0 : -1;
+}
+
+char *
+uri_format(const struct uri *uri)
+{
+	static char buf[1024];
+	/* very primitive implementation suitable for our needs */
+	snprintf(buf, sizeof(buf), "%.*s:%.*s",
+		 (int) uri->host_len, uri->host != NULL ? uri->host : "*",
+		 (int) uri->service_len, uri->service);
+	return buf;
+}
+/* vim: set ft=ragel: */
diff --git a/src/uri.cc b/src/uri.cc
deleted file mode 100644
index d970ef6ee7..0000000000
--- a/src/uri.cc
+++ /dev/null
@@ -1,5538 +0,0 @@
-
-#line 1 "src/uri.rl"
-/*
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * 1. Redistributions of source code must retain the above
- *    copyright notice, this list of conditions and the
- *    following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above
- *    copyright notice, this list of conditions and the following
- *    disclaimer in the documentation and/or other materials
- *    provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#include "uri.h"
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#include <sys/socket.h>
-#include <netinet/ip.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/un.h>
-#include <netdb.h>
-
-const char *
-uri_to_string(const struct uri * uri)
-{
-	static __thread char
-		str[NI_MAXSERV + NI_MAXHOST + sizeof(uri->schema)];
-
-	if (!uri || !uri->addr_len) {
-		snprintf(str, sizeof(str), "unknown address");
-		return str;
-	}
-
-	switch (uri->addr.sa_family) {
-	case AF_INET6:
-	case AF_INET:
-	{
-		char shost[NI_MAXHOST];
-		char sservice[NI_MAXSERV];
-		getnameinfo(
-			    (struct sockaddr *)&uri->addr,
-			    uri->addr_len,
-			    shost, sizeof(shost),
-			    sservice, sizeof(sservice),
-			    NI_NUMERICHOST|NI_NUMERICSERV);
-		if (uri->addr.sa_family == AF_INET) {
-			if (strncmp(uri->schema, "tcp", 3) == 0) {
-				snprintf(str, sizeof(str), "%s:%s",
-					 shost, sservice);
-			} else {
-				snprintf(str, sizeof(str), "%s://%s:%s",
-					 uri->schema, shost, sservice);
-			}
-		} else {
-			if (strncmp(uri->schema, "tcp", 3) == 0) {
-				snprintf(str, sizeof(str), "%s:%s",
-					 shost, sservice);
-			} else {
-				snprintf(str, sizeof(str), "%s://[%s]:%s",
-					 uri->schema, shost, sservice);
-			}
-		}
-                break;
-	}
-	case AF_UNIX:
-	{
-		struct sockaddr_un *un =
-			(struct sockaddr_un *)&uri->addr;
-		snprintf(str, sizeof(str), "unix://%.*s",
-			 (int) sizeof(un->sun_path), un->sun_path);
-	        break;
-	}
-	default:
-		snprintf(str, sizeof(str), "unknown address");
-	        break;
-	}
-	return str;
-}
-
-int
-uri_parse(struct uri *uri, const char *p)
-{
-	(void) uri;
-	const char *pe = p + strlen(p);
-	const char *eof = pe;
-	int cs;
-	memset(uri, 0, sizeof(*uri));
-
-	struct {
-		const char *start;
-		const char *end;
-	}	schema		= { 0, 0 },
-		host		= { 0, 0 },
-		service		= { 0, 0 },
-		sport		= { 0, 0 },
-		login		= { 0, 0 },
-		password	= { 0, 0 },
-		ip4		= { 0, 0 },
-		ip6		= { 0, 0 },
-		path		= { 0, 0 },
-		dport		= { 0, 0 }
-	;
-
-	unsigned port = 0;
-
-	
-#line 128 "src/uri.cc"
-static const int uri_start = 1;
-static const int uri_first_final = 74;
-static const int uri_error = 0;
-
-static const int uri_en_main = 1;
-
-
-#line 136 "src/uri.cc"
-	{
-	cs = uri_start;
-	}
-
-#line 141 "src/uri.cc"
-	{
-	if ( p == pe )
-		goto _test_eof;
-	switch ( cs )
-	{
-case 1:
-	switch( (*p) ) {
-		case 47: goto tr1;
-		case 48: goto tr2;
-		case 58: goto st0;
-		case 63: goto st0;
-		case 91: goto tr6;
-		case 117: goto tr7;
-	}
-	if ( (*p) < 65 ) {
-		if ( 49 <= (*p) && (*p) <= 57 )
-			goto tr3;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto tr5;
-	} else
-		goto tr5;
-	goto tr0;
-tr0:
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-	goto st74;
-tr82:
-#line 133 "src/uri.rl"
-	{ schema.end   = p - 3; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-	goto st74;
-st74:
-	if ( ++p == pe )
-		goto _test_eof74;
-case 74:
-#line 179 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto tr94;
-		case 63: goto st0;
-	}
-	goto st74;
-tr94:
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st2;
-tr144:
-#line 145 "src/uri.rl"
-	{ ip4.end   = p; }
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st2;
-tr157:
-#line 154 "src/uri.rl"
-	{ ip6.end   = p - 1; }
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st2;
-st2:
-	if ( ++p == pe )
-		goto _test_eof2;
-case 2:
-#line 205 "src/uri.cc"
-	if ( (*p) < 65 ) {
-		if ( 49 <= (*p) && (*p) <= 57 )
-			goto tr8;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto tr9;
-	} else
-		goto tr9;
-	goto st0;
-st0:
-cs = 0;
-	goto _out;
-tr8:
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-#line 161 "src/uri.rl"
-	{ dport.start   = p; port = 0; }
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st75;
-tr95:
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st75;
-st75:
-	if ( ++p == pe )
-		goto _test_eof75;
-case 75:
-#line 234 "src/uri.cc"
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto tr95;
-	goto st0;
-tr9:
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-	goto st76;
-st76:
-	if ( ++p == pe )
-		goto _test_eof76;
-case 76:
-#line 246 "src/uri.cc"
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st77;
-	} else if ( (*p) >= 65 )
-		goto st77;
-	goto st0;
-st77:
-	if ( ++p == pe )
-		goto _test_eof77;
-case 77:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st78;
-	} else if ( (*p) >= 65 )
-		goto st78;
-	goto st0;
-st78:
-	if ( ++p == pe )
-		goto _test_eof78;
-case 78:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st79;
-	} else if ( (*p) >= 65 )
-		goto st79;
-	goto st0;
-st79:
-	if ( ++p == pe )
-		goto _test_eof79;
-case 79:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st80;
-	} else if ( (*p) >= 65 )
-		goto st80;
-	goto st0;
-st80:
-	if ( ++p == pe )
-		goto _test_eof80;
-case 80:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st81;
-	} else if ( (*p) >= 65 )
-		goto st81;
-	goto st0;
-st81:
-	if ( ++p == pe )
-		goto _test_eof81;
-case 81:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st82;
-	} else if ( (*p) >= 65 )
-		goto st82;
-	goto st0;
-st82:
-	if ( ++p == pe )
-		goto _test_eof82;
-case 82:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st83;
-	} else if ( (*p) >= 65 )
-		goto st83;
-	goto st0;
-st83:
-	if ( ++p == pe )
-		goto _test_eof83;
-case 83:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st84;
-	} else if ( (*p) >= 65 )
-		goto st84;
-	goto st0;
-st84:
-	if ( ++p == pe )
-		goto _test_eof84;
-case 84:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st85;
-	} else if ( (*p) >= 65 )
-		goto st85;
-	goto st0;
-st85:
-	if ( ++p == pe )
-		goto _test_eof85;
-case 85:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st86;
-	} else if ( (*p) >= 65 )
-		goto st86;
-	goto st0;
-st86:
-	if ( ++p == pe )
-		goto _test_eof86;
-case 86:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st87;
-	} else if ( (*p) >= 65 )
-		goto st87;
-	goto st0;
-st87:
-	if ( ++p == pe )
-		goto _test_eof87;
-case 87:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st88;
-	} else if ( (*p) >= 65 )
-		goto st88;
-	goto st0;
-st88:
-	if ( ++p == pe )
-		goto _test_eof88;
-case 88:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st89;
-	} else if ( (*p) >= 65 )
-		goto st89;
-	goto st0;
-st89:
-	if ( ++p == pe )
-		goto _test_eof89;
-case 89:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st90;
-	} else if ( (*p) >= 65 )
-		goto st90;
-	goto st0;
-st90:
-	if ( ++p == pe )
-		goto _test_eof90;
-case 90:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st91;
-	} else if ( (*p) >= 65 )
-		goto st91;
-	goto st0;
-st91:
-	if ( ++p == pe )
-		goto _test_eof91;
-case 91:
-	goto st0;
-tr1:
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-#line 176 "src/uri.rl"
-	{ path.start = p; }
-	goto st92;
-st92:
-	if ( ++p == pe )
-		goto _test_eof92;
-case 92:
-#line 408 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto tr112;
-		case 63: goto st95;
-	}
-	goto st93;
-st93:
-	if ( ++p == pe )
-		goto _test_eof93;
-case 93:
-	switch( (*p) ) {
-		case 58: goto tr112;
-		case 63: goto st95;
-	}
-	goto st93;
-tr112:
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st94;
-st94:
-	if ( ++p == pe )
-		goto _test_eof94;
-case 94:
-#line 431 "src/uri.cc"
-	if ( (*p) < 65 ) {
-		if ( 49 <= (*p) && (*p) <= 57 )
-			goto tr114;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto tr115;
-	} else
-		goto tr115;
-	goto st95;
-st95:
-	if ( ++p == pe )
-		goto _test_eof95;
-case 95:
-	goto st95;
-tr114:
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-#line 161 "src/uri.rl"
-	{ dport.start   = p; port = 0; }
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st96;
-tr116:
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st96;
-st96:
-	if ( ++p == pe )
-		goto _test_eof96;
-case 96:
-#line 462 "src/uri.cc"
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto tr116;
-	goto st95;
-tr115:
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-	goto st97;
-st97:
-	if ( ++p == pe )
-		goto _test_eof97;
-case 97:
-#line 474 "src/uri.cc"
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st98;
-	} else if ( (*p) >= 65 )
-		goto st98;
-	goto st95;
-st98:
-	if ( ++p == pe )
-		goto _test_eof98;
-case 98:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st99;
-	} else if ( (*p) >= 65 )
-		goto st99;
-	goto st95;
-st99:
-	if ( ++p == pe )
-		goto _test_eof99;
-case 99:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st100;
-	} else if ( (*p) >= 65 )
-		goto st100;
-	goto st95;
-st100:
-	if ( ++p == pe )
-		goto _test_eof100;
-case 100:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st101;
-	} else if ( (*p) >= 65 )
-		goto st101;
-	goto st95;
-st101:
-	if ( ++p == pe )
-		goto _test_eof101;
-case 101:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st102;
-	} else if ( (*p) >= 65 )
-		goto st102;
-	goto st95;
-st102:
-	if ( ++p == pe )
-		goto _test_eof102;
-case 102:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st103;
-	} else if ( (*p) >= 65 )
-		goto st103;
-	goto st95;
-st103:
-	if ( ++p == pe )
-		goto _test_eof103;
-case 103:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st104;
-	} else if ( (*p) >= 65 )
-		goto st104;
-	goto st95;
-st104:
-	if ( ++p == pe )
-		goto _test_eof104;
-case 104:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st105;
-	} else if ( (*p) >= 65 )
-		goto st105;
-	goto st95;
-st105:
-	if ( ++p == pe )
-		goto _test_eof105;
-case 105:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st106;
-	} else if ( (*p) >= 65 )
-		goto st106;
-	goto st95;
-st106:
-	if ( ++p == pe )
-		goto _test_eof106;
-case 106:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st107;
-	} else if ( (*p) >= 65 )
-		goto st107;
-	goto st95;
-st107:
-	if ( ++p == pe )
-		goto _test_eof107;
-case 107:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st108;
-	} else if ( (*p) >= 65 )
-		goto st108;
-	goto st95;
-st108:
-	if ( ++p == pe )
-		goto _test_eof108;
-case 108:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st109;
-	} else if ( (*p) >= 65 )
-		goto st109;
-	goto st95;
-st109:
-	if ( ++p == pe )
-		goto _test_eof109;
-case 109:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st110;
-	} else if ( (*p) >= 65 )
-		goto st110;
-	goto st95;
-st110:
-	if ( ++p == pe )
-		goto _test_eof110;
-case 110:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st111;
-	} else if ( (*p) >= 65 )
-		goto st111;
-	goto st95;
-st111:
-	if ( ++p == pe )
-		goto _test_eof111;
-case 111:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st112;
-	} else if ( (*p) >= 65 )
-		goto st112;
-	goto st95;
-st112:
-	if ( ++p == pe )
-		goto _test_eof112;
-case 112:
-	goto st95;
-tr2:
-#line 136 "src/uri.rl"
-	{ login.start  = p; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-#line 144 "src/uri.rl"
-	{ ip4.start = p; }
-	goto st113;
-tr83:
-#line 133 "src/uri.rl"
-	{ schema.end   = p - 3; }
-#line 136 "src/uri.rl"
-	{ login.start  = p; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-#line 144 "src/uri.rl"
-	{ ip4.start = p; }
-	goto st113;
-st113:
-	if ( ++p == pe )
-		goto _test_eof113;
-case 113:
-#line 648 "src/uri.cc"
-	switch( (*p) ) {
-		case 46: goto st114;
-		case 58: goto tr134;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st126;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st128;
-	} else
-		goto st128;
-	goto st74;
-st114:
-	if ( ++p == pe )
-		goto _test_eof114;
-case 114:
-	switch( (*p) ) {
-		case 58: goto tr94;
-		case 63: goto st0;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st115;
-	goto st74;
-st115:
-	if ( ++p == pe )
-		goto _test_eof115;
-case 115:
-	switch( (*p) ) {
-		case 46: goto st116;
-		case 58: goto tr94;
-		case 63: goto st0;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st124;
-	goto st74;
-st116:
-	if ( ++p == pe )
-		goto _test_eof116;
-case 116:
-	switch( (*p) ) {
-		case 58: goto tr94;
-		case 63: goto st0;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st117;
-	goto st74;
-st117:
-	if ( ++p == pe )
-		goto _test_eof117;
-case 117:
-	switch( (*p) ) {
-		case 46: goto st118;
-		case 58: goto tr94;
-		case 63: goto st0;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st122;
-	goto st74;
-st118:
-	if ( ++p == pe )
-		goto _test_eof118;
-case 118:
-	switch( (*p) ) {
-		case 58: goto tr94;
-		case 63: goto st0;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st119;
-	goto st74;
-st119:
-	if ( ++p == pe )
-		goto _test_eof119;
-case 119:
-	switch( (*p) ) {
-		case 58: goto tr144;
-		case 63: goto st0;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st120;
-	goto st74;
-st120:
-	if ( ++p == pe )
-		goto _test_eof120;
-case 120:
-	switch( (*p) ) {
-		case 58: goto tr144;
-		case 63: goto st0;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st121;
-	goto st74;
-st121:
-	if ( ++p == pe )
-		goto _test_eof121;
-case 121:
-	switch( (*p) ) {
-		case 58: goto tr144;
-		case 63: goto st0;
-	}
-	goto st74;
-st122:
-	if ( ++p == pe )
-		goto _test_eof122;
-case 122:
-	switch( (*p) ) {
-		case 46: goto st118;
-		case 58: goto tr94;
-		case 63: goto st0;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st123;
-	goto st74;
-st123:
-	if ( ++p == pe )
-		goto _test_eof123;
-case 123:
-	switch( (*p) ) {
-		case 46: goto st118;
-		case 58: goto tr94;
-		case 63: goto st0;
-	}
-	goto st74;
-st124:
-	if ( ++p == pe )
-		goto _test_eof124;
-case 124:
-	switch( (*p) ) {
-		case 46: goto st116;
-		case 58: goto tr94;
-		case 63: goto st0;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st125;
-	goto st74;
-st125:
-	if ( ++p == pe )
-		goto _test_eof125;
-case 125:
-	switch( (*p) ) {
-		case 46: goto st116;
-		case 58: goto tr94;
-		case 63: goto st0;
-	}
-	goto st74;
-st126:
-	if ( ++p == pe )
-		goto _test_eof126;
-case 126:
-	switch( (*p) ) {
-		case 46: goto st114;
-		case 58: goto tr134;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st127;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st128;
-	} else
-		goto st128;
-	goto st74;
-st127:
-	if ( ++p == pe )
-		goto _test_eof127;
-case 127:
-	switch( (*p) ) {
-		case 46: goto st114;
-		case 58: goto tr134;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st128;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st128;
-	} else
-		goto st128;
-	goto st74;
-tr84:
-#line 133 "src/uri.rl"
-	{ schema.end   = p - 3; }
-#line 136 "src/uri.rl"
-	{ login.start  = p; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-	goto st128;
-st128:
-	if ( ++p == pe )
-		goto _test_eof128;
-case 128:
-#line 843 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto tr134;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st128;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st128;
-	} else
-		goto st128;
-	goto st74;
-tr134:
-#line 137 "src/uri.rl"
-	{ login.end    = p; }
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st3;
-st3:
-	if ( ++p == pe )
-		goto _test_eof3;
-case 3:
-#line 867 "src/uri.cc"
-	if ( (*p) == 48 )
-		goto tr10;
-	if ( (*p) < 65 ) {
-		if ( 49 <= (*p) && (*p) <= 57 )
-			goto tr11;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto tr12;
-	} else
-		goto tr12;
-	goto st0;
-tr10:
-#line 140 "src/uri.rl"
-	{ password.start = p; }
-	goto st4;
-st4:
-	if ( ++p == pe )
-		goto _test_eof4;
-case 4:
-#line 887 "src/uri.cc"
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st4;
-	} else
-		goto st4;
-	goto st0;
-tr14:
-#line 141 "src/uri.rl"
-	{ password.end   = p; }
-	goto st5;
-st5:
-	if ( ++p == pe )
-		goto _test_eof5;
-case 5:
-#line 907 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto st0;
-		case 63: goto st0;
-		case 91: goto tr6;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto tr15;
-	goto tr0;
-tr15:
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-#line 144 "src/uri.rl"
-	{ ip4.start = p; }
-	goto st129;
-st129:
-	if ( ++p == pe )
-		goto _test_eof129;
-case 129:
-#line 926 "src/uri.cc"
-	switch( (*p) ) {
-		case 46: goto st114;
-		case 58: goto tr94;
-		case 63: goto st0;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st130;
-	goto st74;
-st130:
-	if ( ++p == pe )
-		goto _test_eof130;
-case 130:
-	switch( (*p) ) {
-		case 46: goto st114;
-		case 58: goto tr94;
-		case 63: goto st0;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st131;
-	goto st74;
-st131:
-	if ( ++p == pe )
-		goto _test_eof131;
-case 131:
-	switch( (*p) ) {
-		case 46: goto st114;
-		case 58: goto tr94;
-		case 63: goto st0;
-	}
-	goto st74;
-tr6:
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-#line 153 "src/uri.rl"
-	{ ip6.start = p + 1; }
-	goto st132;
-tr85:
-#line 133 "src/uri.rl"
-	{ schema.end   = p - 3; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-#line 153 "src/uri.rl"
-	{ ip6.start = p + 1; }
-	goto st132;
-st132:
-	if ( ++p == pe )
-		goto _test_eof132;
-case 132:
-#line 975 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto tr152;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st133;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st133;
-	} else
-		goto st133;
-	goto st74;
-st133:
-	if ( ++p == pe )
-		goto _test_eof133;
-case 133:
-	switch( (*p) ) {
-		case 58: goto tr154;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st134;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st134;
-	} else
-		goto st134;
-	goto st74;
-st134:
-	if ( ++p == pe )
-		goto _test_eof134;
-case 134:
-	switch( (*p) ) {
-		case 58: goto tr154;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st135;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st135;
-	} else
-		goto st135;
-	goto st74;
-st135:
-	if ( ++p == pe )
-		goto _test_eof135;
-case 135:
-	switch( (*p) ) {
-		case 58: goto tr154;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st136;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st136;
-	} else
-		goto st136;
-	goto st74;
-st136:
-	if ( ++p == pe )
-		goto _test_eof136;
-case 136:
-	switch( (*p) ) {
-		case 58: goto tr154;
-		case 63: goto st0;
-	}
-	goto st74;
-tr154:
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st6;
-st6:
-	if ( ++p == pe )
-		goto _test_eof6;
-case 6:
-#line 1057 "src/uri.cc"
-	switch( (*p) ) {
-		case 48: goto st7;
-		case 58: goto st11;
-		case 93: goto st137;
-	}
-	if ( (*p) < 71 ) {
-		if ( (*p) > 57 ) {
-			if ( 65 <= (*p) && (*p) <= 70 )
-				goto tr19;
-		} else if ( (*p) >= 49 )
-			goto tr17;
-	} else if ( (*p) > 90 ) {
-		if ( (*p) > 102 ) {
-			if ( 103 <= (*p) && (*p) <= 122 )
-				goto tr9;
-		} else if ( (*p) >= 97 )
-			goto tr19;
-	} else
-		goto tr9;
-	goto st0;
-st7:
-	if ( ++p == pe )
-		goto _test_eof7;
-case 7:
-	switch( (*p) ) {
-		case 58: goto st11;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st8;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st8;
-	} else
-		goto st8;
-	goto st0;
-st8:
-	if ( ++p == pe )
-		goto _test_eof8;
-case 8:
-	switch( (*p) ) {
-		case 58: goto st11;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st9;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st9;
-	} else
-		goto st9;
-	goto st0;
-st9:
-	if ( ++p == pe )
-		goto _test_eof9;
-case 9:
-	switch( (*p) ) {
-		case 58: goto st11;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st10;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st10;
-	} else
-		goto st10;
-	goto st0;
-st10:
-	if ( ++p == pe )
-		goto _test_eof10;
-case 10:
-	switch( (*p) ) {
-		case 58: goto st11;
-		case 93: goto st137;
-	}
-	goto st0;
-st11:
-	if ( ++p == pe )
-		goto _test_eof11;
-case 11:
-	switch( (*p) ) {
-		case 58: goto st16;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st12;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st12;
-	} else
-		goto st12;
-	goto st0;
-st12:
-	if ( ++p == pe )
-		goto _test_eof12;
-case 12:
-	switch( (*p) ) {
-		case 58: goto st16;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st13;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st13;
-	} else
-		goto st13;
-	goto st0;
-st13:
-	if ( ++p == pe )
-		goto _test_eof13;
-case 13:
-	switch( (*p) ) {
-		case 58: goto st16;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st14;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st14;
-	} else
-		goto st14;
-	goto st0;
-st14:
-	if ( ++p == pe )
-		goto _test_eof14;
-case 14:
-	switch( (*p) ) {
-		case 58: goto st16;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st15;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st15;
-	} else
-		goto st15;
-	goto st0;
-st15:
-	if ( ++p == pe )
-		goto _test_eof15;
-case 15:
-	switch( (*p) ) {
-		case 58: goto st16;
-		case 93: goto st137;
-	}
-	goto st0;
-st16:
-	if ( ++p == pe )
-		goto _test_eof16;
-case 16:
-	switch( (*p) ) {
-		case 58: goto st21;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st17;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st17;
-	} else
-		goto st17;
-	goto st0;
-st17:
-	if ( ++p == pe )
-		goto _test_eof17;
-case 17:
-	switch( (*p) ) {
-		case 58: goto st21;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st18;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st18;
-	} else
-		goto st18;
-	goto st0;
-st18:
-	if ( ++p == pe )
-		goto _test_eof18;
-case 18:
-	switch( (*p) ) {
-		case 58: goto st21;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st19;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st19;
-	} else
-		goto st19;
-	goto st0;
-st19:
-	if ( ++p == pe )
-		goto _test_eof19;
-case 19:
-	switch( (*p) ) {
-		case 58: goto st21;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st20;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st20;
-	} else
-		goto st20;
-	goto st0;
-st20:
-	if ( ++p == pe )
-		goto _test_eof20;
-case 20:
-	switch( (*p) ) {
-		case 58: goto st21;
-		case 93: goto st137;
-	}
-	goto st0;
-st21:
-	if ( ++p == pe )
-		goto _test_eof21;
-case 21:
-	switch( (*p) ) {
-		case 58: goto st26;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st22;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st22;
-	} else
-		goto st22;
-	goto st0;
-st22:
-	if ( ++p == pe )
-		goto _test_eof22;
-case 22:
-	switch( (*p) ) {
-		case 58: goto st26;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st23;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st23;
-	} else
-		goto st23;
-	goto st0;
-st23:
-	if ( ++p == pe )
-		goto _test_eof23;
-case 23:
-	switch( (*p) ) {
-		case 58: goto st26;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st24;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st24;
-	} else
-		goto st24;
-	goto st0;
-st24:
-	if ( ++p == pe )
-		goto _test_eof24;
-case 24:
-	switch( (*p) ) {
-		case 58: goto st26;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st25;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st25;
-	} else
-		goto st25;
-	goto st0;
-st25:
-	if ( ++p == pe )
-		goto _test_eof25;
-case 25:
-	switch( (*p) ) {
-		case 58: goto st26;
-		case 93: goto st137;
-	}
-	goto st0;
-st26:
-	if ( ++p == pe )
-		goto _test_eof26;
-case 26:
-	switch( (*p) ) {
-		case 58: goto st31;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st27;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st27;
-	} else
-		goto st27;
-	goto st0;
-st27:
-	if ( ++p == pe )
-		goto _test_eof27;
-case 27:
-	switch( (*p) ) {
-		case 58: goto st31;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st28;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st28;
-	} else
-		goto st28;
-	goto st0;
-st28:
-	if ( ++p == pe )
-		goto _test_eof28;
-case 28:
-	switch( (*p) ) {
-		case 58: goto st31;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st29;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st29;
-	} else
-		goto st29;
-	goto st0;
-st29:
-	if ( ++p == pe )
-		goto _test_eof29;
-case 29:
-	switch( (*p) ) {
-		case 58: goto st31;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st30;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st30;
-	} else
-		goto st30;
-	goto st0;
-st30:
-	if ( ++p == pe )
-		goto _test_eof30;
-case 30:
-	switch( (*p) ) {
-		case 58: goto st31;
-		case 93: goto st137;
-	}
-	goto st0;
-st31:
-	if ( ++p == pe )
-		goto _test_eof31;
-case 31:
-	switch( (*p) ) {
-		case 58: goto st36;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st32;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st32;
-	} else
-		goto st32;
-	goto st0;
-st32:
-	if ( ++p == pe )
-		goto _test_eof32;
-case 32:
-	switch( (*p) ) {
-		case 58: goto st36;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st33;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st33;
-	} else
-		goto st33;
-	goto st0;
-st33:
-	if ( ++p == pe )
-		goto _test_eof33;
-case 33:
-	switch( (*p) ) {
-		case 58: goto st36;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st34;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st34;
-	} else
-		goto st34;
-	goto st0;
-st34:
-	if ( ++p == pe )
-		goto _test_eof34;
-case 34:
-	switch( (*p) ) {
-		case 58: goto st36;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st35;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st35;
-	} else
-		goto st35;
-	goto st0;
-st35:
-	if ( ++p == pe )
-		goto _test_eof35;
-case 35:
-	switch( (*p) ) {
-		case 58: goto st36;
-		case 93: goto st137;
-	}
-	goto st0;
-st36:
-	if ( ++p == pe )
-		goto _test_eof36;
-case 36:
-	switch( (*p) ) {
-		case 58: goto st41;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st37;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st37;
-	} else
-		goto st37;
-	goto st0;
-st37:
-	if ( ++p == pe )
-		goto _test_eof37;
-case 37:
-	switch( (*p) ) {
-		case 58: goto st41;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st38;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st38;
-	} else
-		goto st38;
-	goto st0;
-st38:
-	if ( ++p == pe )
-		goto _test_eof38;
-case 38:
-	switch( (*p) ) {
-		case 58: goto st41;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st39;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st39;
-	} else
-		goto st39;
-	goto st0;
-st39:
-	if ( ++p == pe )
-		goto _test_eof39;
-case 39:
-	switch( (*p) ) {
-		case 58: goto st41;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st40;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st40;
-	} else
-		goto st40;
-	goto st0;
-st40:
-	if ( ++p == pe )
-		goto _test_eof40;
-case 40:
-	switch( (*p) ) {
-		case 58: goto st41;
-		case 93: goto st137;
-	}
-	goto st0;
-st41:
-	if ( ++p == pe )
-		goto _test_eof41;
-case 41:
-	if ( (*p) == 93 )
-		goto st137;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st42;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st42;
-	} else
-		goto st42;
-	goto st0;
-st42:
-	if ( ++p == pe )
-		goto _test_eof42;
-case 42:
-	if ( (*p) == 93 )
-		goto st137;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st43;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st43;
-	} else
-		goto st43;
-	goto st0;
-st43:
-	if ( ++p == pe )
-		goto _test_eof43;
-case 43:
-	if ( (*p) == 93 )
-		goto st137;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st44;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st44;
-	} else
-		goto st44;
-	goto st0;
-st44:
-	if ( ++p == pe )
-		goto _test_eof44;
-case 44:
-	if ( (*p) == 93 )
-		goto st137;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st45;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st45;
-	} else
-		goto st45;
-	goto st0;
-st45:
-	if ( ++p == pe )
-		goto _test_eof45;
-case 45:
-	if ( (*p) == 93 )
-		goto st137;
-	goto st0;
-st137:
-	if ( ++p == pe )
-		goto _test_eof137;
-case 137:
-	if ( (*p) == 58 )
-		goto tr157;
-	goto st0;
-tr17:
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-#line 161 "src/uri.rl"
-	{ dport.start   = p; port = 0; }
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st138;
-st138:
-	if ( ++p == pe )
-		goto _test_eof138;
-case 138:
-#line 1686 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto st11;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr158;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st8;
-	} else
-		goto st8;
-	goto st0;
-tr158:
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st139;
-st139:
-	if ( ++p == pe )
-		goto _test_eof139;
-case 139:
-#line 1708 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto st11;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr159;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st9;
-	} else
-		goto st9;
-	goto st0;
-tr159:
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st140;
-st140:
-	if ( ++p == pe )
-		goto _test_eof140;
-case 140:
-#line 1730 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto st11;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr160;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st10;
-	} else
-		goto st10;
-	goto st0;
-tr160:
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st141;
-st141:
-	if ( ++p == pe )
-		goto _test_eof141;
-case 141:
-#line 1752 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto st11;
-		case 93: goto st137;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto tr95;
-	goto st0;
-tr19:
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-	goto st142;
-st142:
-	if ( ++p == pe )
-		goto _test_eof142;
-case 142:
-#line 1768 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto st11;
-		case 93: goto st137;
-	}
-	if ( (*p) < 71 ) {
-		if ( (*p) > 57 ) {
-			if ( 65 <= (*p) && (*p) <= 70 )
-				goto st143;
-		} else if ( (*p) >= 48 )
-			goto st8;
-	} else if ( (*p) > 90 ) {
-		if ( (*p) > 102 ) {
-			if ( 103 <= (*p) && (*p) <= 122 )
-				goto st77;
-		} else if ( (*p) >= 97 )
-			goto st143;
-	} else
-		goto st77;
-	goto st0;
-st143:
-	if ( ++p == pe )
-		goto _test_eof143;
-case 143:
-	switch( (*p) ) {
-		case 58: goto st11;
-		case 93: goto st137;
-	}
-	if ( (*p) < 71 ) {
-		if ( (*p) > 57 ) {
-			if ( 65 <= (*p) && (*p) <= 70 )
-				goto st144;
-		} else if ( (*p) >= 48 )
-			goto st9;
-	} else if ( (*p) > 90 ) {
-		if ( (*p) > 102 ) {
-			if ( 103 <= (*p) && (*p) <= 122 )
-				goto st78;
-		} else if ( (*p) >= 97 )
-			goto st144;
-	} else
-		goto st78;
-	goto st0;
-st144:
-	if ( ++p == pe )
-		goto _test_eof144;
-case 144:
-	switch( (*p) ) {
-		case 58: goto st11;
-		case 93: goto st137;
-	}
-	if ( (*p) < 71 ) {
-		if ( (*p) > 57 ) {
-			if ( 65 <= (*p) && (*p) <= 70 )
-				goto st145;
-		} else if ( (*p) >= 48 )
-			goto st10;
-	} else if ( (*p) > 90 ) {
-		if ( (*p) > 102 ) {
-			if ( 103 <= (*p) && (*p) <= 122 )
-				goto st79;
-		} else if ( (*p) >= 97 )
-			goto st145;
-	} else
-		goto st79;
-	goto st0;
-st145:
-	if ( ++p == pe )
-		goto _test_eof145;
-case 145:
-	switch( (*p) ) {
-		case 58: goto st11;
-		case 93: goto st137;
-	}
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st80;
-	} else if ( (*p) >= 65 )
-		goto st80;
-	goto st0;
-tr152:
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st46;
-st46:
-	if ( ++p == pe )
-		goto _test_eof46;
-case 46:
-#line 1856 "src/uri.cc"
-	switch( (*p) ) {
-		case 48: goto st7;
-		case 58: goto st47;
-		case 93: goto st137;
-	}
-	if ( (*p) < 71 ) {
-		if ( (*p) > 57 ) {
-			if ( 65 <= (*p) && (*p) <= 70 )
-				goto tr19;
-		} else if ( (*p) >= 49 )
-			goto tr17;
-	} else if ( (*p) > 90 ) {
-		if ( (*p) > 102 ) {
-			if ( 103 <= (*p) && (*p) <= 122 )
-				goto tr9;
-		} else if ( (*p) >= 97 )
-			goto tr19;
-	} else
-		goto tr9;
-	goto st0;
-st47:
-	if ( ++p == pe )
-		goto _test_eof47;
-case 47:
-	switch( (*p) ) {
-		case 58: goto st16;
-		case 70: goto st48;
-		case 93: goto st137;
-		case 102: goto st48;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st12;
-	} else if ( (*p) > 69 ) {
-		if ( 97 <= (*p) && (*p) <= 101 )
-			goto st12;
-	} else
-		goto st12;
-	goto st0;
-st48:
-	if ( ++p == pe )
-		goto _test_eof48;
-case 48:
-	switch( (*p) ) {
-		case 58: goto st16;
-		case 70: goto st49;
-		case 93: goto st137;
-		case 102: goto st49;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st13;
-	} else if ( (*p) > 69 ) {
-		if ( 97 <= (*p) && (*p) <= 101 )
-			goto st13;
-	} else
-		goto st13;
-	goto st0;
-st49:
-	if ( ++p == pe )
-		goto _test_eof49;
-case 49:
-	switch( (*p) ) {
-		case 58: goto st16;
-		case 70: goto st50;
-		case 93: goto st137;
-		case 102: goto st50;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st14;
-	} else if ( (*p) > 69 ) {
-		if ( 97 <= (*p) && (*p) <= 101 )
-			goto st14;
-	} else
-		goto st14;
-	goto st0;
-st50:
-	if ( ++p == pe )
-		goto _test_eof50;
-case 50:
-	switch( (*p) ) {
-		case 58: goto st16;
-		case 70: goto st51;
-		case 93: goto st137;
-		case 102: goto st51;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st15;
-	} else if ( (*p) > 69 ) {
-		if ( 97 <= (*p) && (*p) <= 101 )
-			goto st15;
-	} else
-		goto st15;
-	goto st0;
-st51:
-	if ( ++p == pe )
-		goto _test_eof51;
-case 51:
-	switch( (*p) ) {
-		case 58: goto st52;
-		case 93: goto st137;
-	}
-	goto st0;
-st52:
-	if ( ++p == pe )
-		goto _test_eof52;
-case 52:
-	switch( (*p) ) {
-		case 58: goto st21;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr64;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st17;
-	} else
-		goto st17;
-	goto st0;
-tr64:
-#line 144 "src/uri.rl"
-	{ ip4.start = p; }
-	goto st53;
-st53:
-	if ( ++p == pe )
-		goto _test_eof53;
-case 53:
-#line 1987 "src/uri.cc"
-	switch( (*p) ) {
-		case 46: goto st54;
-		case 58: goto st21;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st66;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st18;
-	} else
-		goto st18;
-	goto st0;
-st54:
-	if ( ++p == pe )
-		goto _test_eof54;
-case 54:
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st55;
-	goto st0;
-st55:
-	if ( ++p == pe )
-		goto _test_eof55;
-case 55:
-	if ( (*p) == 46 )
-		goto st56;
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st64;
-	goto st0;
-st56:
-	if ( ++p == pe )
-		goto _test_eof56;
-case 56:
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st57;
-	goto st0;
-st57:
-	if ( ++p == pe )
-		goto _test_eof57;
-case 57:
-	if ( (*p) == 46 )
-		goto st58;
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st62;
-	goto st0;
-st58:
-	if ( ++p == pe )
-		goto _test_eof58;
-case 58:
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st59;
-	goto st0;
-st59:
-	if ( ++p == pe )
-		goto _test_eof59;
-case 59:
-	if ( (*p) == 93 )
-		goto tr75;
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st60;
-	goto st0;
-st60:
-	if ( ++p == pe )
-		goto _test_eof60;
-case 60:
-	if ( (*p) == 93 )
-		goto tr75;
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st61;
-	goto st0;
-st61:
-	if ( ++p == pe )
-		goto _test_eof61;
-case 61:
-	if ( (*p) == 93 )
-		goto tr75;
-	goto st0;
-tr75:
-#line 145 "src/uri.rl"
-	{ ip4.end   = p; }
-	goto st146;
-st146:
-	if ( ++p == pe )
-		goto _test_eof146;
-case 146:
-#line 2074 "src/uri.cc"
-	if ( (*p) == 58 )
-		goto tr94;
-	goto st0;
-st62:
-	if ( ++p == pe )
-		goto _test_eof62;
-case 62:
-	if ( (*p) == 46 )
-		goto st58;
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st63;
-	goto st0;
-st63:
-	if ( ++p == pe )
-		goto _test_eof63;
-case 63:
-	if ( (*p) == 46 )
-		goto st58;
-	goto st0;
-st64:
-	if ( ++p == pe )
-		goto _test_eof64;
-case 64:
-	if ( (*p) == 46 )
-		goto st56;
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st65;
-	goto st0;
-st65:
-	if ( ++p == pe )
-		goto _test_eof65;
-case 65:
-	if ( (*p) == 46 )
-		goto st56;
-	goto st0;
-st66:
-	if ( ++p == pe )
-		goto _test_eof66;
-case 66:
-	switch( (*p) ) {
-		case 46: goto st54;
-		case 58: goto st21;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st67;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st19;
-	} else
-		goto st19;
-	goto st0;
-st67:
-	if ( ++p == pe )
-		goto _test_eof67;
-case 67:
-	switch( (*p) ) {
-		case 46: goto st54;
-		case 58: goto st21;
-		case 93: goto st137;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st20;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st20;
-	} else
-		goto st20;
-	goto st0;
-tr11:
-#line 140 "src/uri.rl"
-	{ password.start = p; }
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-#line 161 "src/uri.rl"
-	{ dport.start   = p; port = 0; }
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st147;
-tr164:
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st147;
-st147:
-	if ( ++p == pe )
-		goto _test_eof147;
-case 147:
-#line 2164 "src/uri.cc"
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr164;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st4;
-	} else
-		goto st4;
-	goto st0;
-tr12:
-#line 140 "src/uri.rl"
-	{ password.start = p; }
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-	goto st148;
-st148:
-	if ( ++p == pe )
-		goto _test_eof148;
-case 148:
-#line 2186 "src/uri.cc"
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st149;
-	} else
-		goto st149;
-	goto st0;
-st149:
-	if ( ++p == pe )
-		goto _test_eof149;
-case 149:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st150;
-	} else
-		goto st150;
-	goto st0;
-st150:
-	if ( ++p == pe )
-		goto _test_eof150;
-case 150:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st151;
-	} else
-		goto st151;
-	goto st0;
-st151:
-	if ( ++p == pe )
-		goto _test_eof151;
-case 151:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st152;
-	} else
-		goto st152;
-	goto st0;
-st152:
-	if ( ++p == pe )
-		goto _test_eof152;
-case 152:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st153;
-	} else
-		goto st153;
-	goto st0;
-st153:
-	if ( ++p == pe )
-		goto _test_eof153;
-case 153:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st154;
-	} else
-		goto st154;
-	goto st0;
-st154:
-	if ( ++p == pe )
-		goto _test_eof154;
-case 154:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st155;
-	} else
-		goto st155;
-	goto st0;
-st155:
-	if ( ++p == pe )
-		goto _test_eof155;
-case 155:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st156;
-	} else
-		goto st156;
-	goto st0;
-st156:
-	if ( ++p == pe )
-		goto _test_eof156;
-case 156:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st157;
-	} else
-		goto st157;
-	goto st0;
-st157:
-	if ( ++p == pe )
-		goto _test_eof157;
-case 157:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st158;
-	} else
-		goto st158;
-	goto st0;
-st158:
-	if ( ++p == pe )
-		goto _test_eof158;
-case 158:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st159;
-	} else
-		goto st159;
-	goto st0;
-st159:
-	if ( ++p == pe )
-		goto _test_eof159;
-case 159:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st160;
-	} else
-		goto st160;
-	goto st0;
-st160:
-	if ( ++p == pe )
-		goto _test_eof160;
-case 160:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st161;
-	} else
-		goto st161;
-	goto st0;
-st161:
-	if ( ++p == pe )
-		goto _test_eof161;
-case 161:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st162;
-	} else
-		goto st162;
-	goto st0;
-st162:
-	if ( ++p == pe )
-		goto _test_eof162;
-case 162:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st163;
-	} else
-		goto st163;
-	goto st0;
-st163:
-	if ( ++p == pe )
-		goto _test_eof163;
-case 163:
-	if ( (*p) == 64 )
-		goto tr14;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st4;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st4;
-	} else
-		goto st4;
-	goto st0;
-tr3:
-#line 136 "src/uri.rl"
-	{ login.start  = p; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-#line 144 "src/uri.rl"
-	{ ip4.start = p; }
-#line 171 "src/uri.rl"
-	{ sport.start   = p; port = 0; }
-#line 172 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st164;
-st164:
-	if ( ++p == pe )
-		goto _test_eof164;
-case 164:
-#line 2439 "src/uri.cc"
-	switch( (*p) ) {
-		case 46: goto st114;
-		case 58: goto tr134;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr180;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st128;
-	} else
-		goto st128;
-	goto st74;
-tr180:
-#line 172 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st165;
-st165:
-	if ( ++p == pe )
-		goto _test_eof165;
-case 165:
-#line 2462 "src/uri.cc"
-	switch( (*p) ) {
-		case 46: goto st114;
-		case 58: goto tr134;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr181;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st128;
-	} else
-		goto st128;
-	goto st74;
-tr181:
-#line 172 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st166;
-st166:
-	if ( ++p == pe )
-		goto _test_eof166;
-case 166:
-#line 2485 "src/uri.cc"
-	switch( (*p) ) {
-		case 46: goto st114;
-		case 58: goto tr134;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr182;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st128;
-	} else
-		goto st128;
-	goto st74;
-tr182:
-#line 172 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st167;
-st167:
-	if ( ++p == pe )
-		goto _test_eof167;
-case 167:
-#line 2508 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto tr134;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr182;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st128;
-	} else
-		goto st128;
-	goto st74;
-tr5:
-#line 132 "src/uri.rl"
-	{ schema.start = p; }
-#line 136 "src/uri.rl"
-	{ login.start  = p; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-	goto st168;
-st168:
-	if ( ++p == pe )
-		goto _test_eof168;
-case 168:
-#line 2534 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto tr183;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st128;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st168;
-	} else
-		goto st168;
-	goto st74;
-tr183:
-#line 137 "src/uri.rl"
-	{ login.end    = p; }
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st68;
-st68:
-	if ( ++p == pe )
-		goto _test_eof68;
-case 68:
-#line 2558 "src/uri.cc"
-	switch( (*p) ) {
-		case 47: goto st69;
-		case 48: goto tr10;
-	}
-	if ( (*p) < 65 ) {
-		if ( 49 <= (*p) && (*p) <= 57 )
-			goto tr11;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto tr12;
-	} else
-		goto tr12;
-	goto st0;
-st69:
-	if ( ++p == pe )
-		goto _test_eof69;
-case 69:
-	if ( (*p) == 47 )
-		goto st70;
-	goto st0;
-st70:
-	if ( ++p == pe )
-		goto _test_eof70;
-case 70:
-	switch( (*p) ) {
-		case 58: goto st0;
-		case 63: goto st0;
-		case 91: goto tr85;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr83;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto tr84;
-	} else
-		goto tr84;
-	goto tr82;
-tr7:
-#line 132 "src/uri.rl"
-	{ schema.start = p; }
-#line 136 "src/uri.rl"
-	{ login.start  = p; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-	goto st169;
-st169:
-	if ( ++p == pe )
-		goto _test_eof169;
-case 169:
-#line 2609 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto tr183;
-		case 63: goto st0;
-		case 110: goto st170;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st128;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st168;
-	} else
-		goto st168;
-	goto st74;
-st170:
-	if ( ++p == pe )
-		goto _test_eof170;
-case 170:
-	switch( (*p) ) {
-		case 58: goto tr183;
-		case 63: goto st0;
-		case 105: goto st171;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st128;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st168;
-	} else
-		goto st168;
-	goto st74;
-st171:
-	if ( ++p == pe )
-		goto _test_eof171;
-case 171:
-	switch( (*p) ) {
-		case 58: goto tr183;
-		case 63: goto st0;
-		case 120: goto st172;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st128;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st168;
-	} else
-		goto st168;
-	goto st74;
-st172:
-	if ( ++p == pe )
-		goto _test_eof172;
-case 172:
-	switch( (*p) ) {
-		case 58: goto tr188;
-		case 63: goto st0;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st128;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st168;
-	} else
-		goto st168;
-	goto st74;
-tr188:
-#line 137 "src/uri.rl"
-	{ login.end    = p; }
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st71;
-st71:
-	if ( ++p == pe )
-		goto _test_eof71;
-case 71:
-#line 2687 "src/uri.cc"
-	switch( (*p) ) {
-		case 47: goto st72;
-		case 48: goto tr10;
-	}
-	if ( (*p) < 65 ) {
-		if ( 49 <= (*p) && (*p) <= 57 )
-			goto tr11;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto tr12;
-	} else
-		goto tr12;
-	goto st0;
-st72:
-	if ( ++p == pe )
-		goto _test_eof72;
-case 72:
-	if ( (*p) == 47 )
-		goto st73;
-	goto st0;
-st73:
-	if ( ++p == pe )
-		goto _test_eof73;
-case 73:
-	switch( (*p) ) {
-		case 58: goto tr90;
-		case 63: goto tr90;
-		case 91: goto tr92;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr89;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto tr91;
-	} else
-		goto tr91;
-	goto tr88;
-tr88:
-#line 180 "src/uri.rl"
-	{ path.start = p; }
-#line 133 "src/uri.rl"
-	{ schema.end   = p - 3; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-	goto st173;
-tr232:
-#line 180 "src/uri.rl"
-	{ path.start = p; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-	goto st173;
-st173:
-	if ( ++p == pe )
-		goto _test_eof173;
-case 173:
-#line 2744 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto tr190;
-		case 63: goto st175;
-	}
-	goto st173;
-tr190:
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st174;
-tr222:
-#line 145 "src/uri.rl"
-	{ ip4.end   = p; }
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st174;
-tr285:
-#line 154 "src/uri.rl"
-	{ ip6.end   = p - 1; }
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st174;
-st174:
-	if ( ++p == pe )
-		goto _test_eof174;
-case 174:
-#line 2770 "src/uri.cc"
-	if ( (*p) < 65 ) {
-		if ( 49 <= (*p) && (*p) <= 57 )
-			goto tr192;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto tr193;
-	} else
-		goto tr193;
-	goto st175;
-tr90:
-#line 180 "src/uri.rl"
-	{ path.start = p; }
-	goto st175;
-st175:
-	if ( ++p == pe )
-		goto _test_eof175;
-case 175:
-#line 2788 "src/uri.cc"
-	goto st175;
-tr192:
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-#line 161 "src/uri.rl"
-	{ dport.start   = p; port = 0; }
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st176;
-tr194:
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st176;
-st176:
-	if ( ++p == pe )
-		goto _test_eof176;
-case 176:
-#line 2806 "src/uri.cc"
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto tr194;
-	goto st175;
-tr193:
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-	goto st177;
-st177:
-	if ( ++p == pe )
-		goto _test_eof177;
-case 177:
-#line 2818 "src/uri.cc"
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st178;
-	} else if ( (*p) >= 65 )
-		goto st178;
-	goto st175;
-st178:
-	if ( ++p == pe )
-		goto _test_eof178;
-case 178:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st179;
-	} else if ( (*p) >= 65 )
-		goto st179;
-	goto st175;
-st179:
-	if ( ++p == pe )
-		goto _test_eof179;
-case 179:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st180;
-	} else if ( (*p) >= 65 )
-		goto st180;
-	goto st175;
-st180:
-	if ( ++p == pe )
-		goto _test_eof180;
-case 180:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st181;
-	} else if ( (*p) >= 65 )
-		goto st181;
-	goto st175;
-st181:
-	if ( ++p == pe )
-		goto _test_eof181;
-case 181:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st182;
-	} else if ( (*p) >= 65 )
-		goto st182;
-	goto st175;
-st182:
-	if ( ++p == pe )
-		goto _test_eof182;
-case 182:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st183;
-	} else if ( (*p) >= 65 )
-		goto st183;
-	goto st175;
-st183:
-	if ( ++p == pe )
-		goto _test_eof183;
-case 183:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st184;
-	} else if ( (*p) >= 65 )
-		goto st184;
-	goto st175;
-st184:
-	if ( ++p == pe )
-		goto _test_eof184;
-case 184:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st185;
-	} else if ( (*p) >= 65 )
-		goto st185;
-	goto st175;
-st185:
-	if ( ++p == pe )
-		goto _test_eof185;
-case 185:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st186;
-	} else if ( (*p) >= 65 )
-		goto st186;
-	goto st175;
-st186:
-	if ( ++p == pe )
-		goto _test_eof186;
-case 186:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st187;
-	} else if ( (*p) >= 65 )
-		goto st187;
-	goto st175;
-st187:
-	if ( ++p == pe )
-		goto _test_eof187;
-case 187:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st188;
-	} else if ( (*p) >= 65 )
-		goto st188;
-	goto st175;
-st188:
-	if ( ++p == pe )
-		goto _test_eof188;
-case 188:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st189;
-	} else if ( (*p) >= 65 )
-		goto st189;
-	goto st175;
-st189:
-	if ( ++p == pe )
-		goto _test_eof189;
-case 189:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st190;
-	} else if ( (*p) >= 65 )
-		goto st190;
-	goto st175;
-st190:
-	if ( ++p == pe )
-		goto _test_eof190;
-case 190:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st191;
-	} else if ( (*p) >= 65 )
-		goto st191;
-	goto st175;
-st191:
-	if ( ++p == pe )
-		goto _test_eof191;
-case 191:
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st192;
-	} else if ( (*p) >= 65 )
-		goto st192;
-	goto st175;
-st192:
-	if ( ++p == pe )
-		goto _test_eof192;
-case 192:
-	goto st175;
-tr89:
-#line 136 "src/uri.rl"
-	{ login.start  = p; }
-#line 180 "src/uri.rl"
-	{ path.start = p; }
-#line 133 "src/uri.rl"
-	{ schema.end   = p - 3; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-#line 144 "src/uri.rl"
-	{ ip4.start = p; }
-	goto st193;
-st193:
-	if ( ++p == pe )
-		goto _test_eof193;
-case 193:
-#line 2986 "src/uri.cc"
-	switch( (*p) ) {
-		case 46: goto st194;
-		case 58: goto tr212;
-		case 63: goto st175;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st206;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st208;
-	} else
-		goto st208;
-	goto st173;
-st194:
-	if ( ++p == pe )
-		goto _test_eof194;
-case 194:
-	switch( (*p) ) {
-		case 58: goto tr190;
-		case 63: goto st175;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st195;
-	goto st173;
-st195:
-	if ( ++p == pe )
-		goto _test_eof195;
-case 195:
-	switch( (*p) ) {
-		case 46: goto st196;
-		case 58: goto tr190;
-		case 63: goto st175;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st204;
-	goto st173;
-st196:
-	if ( ++p == pe )
-		goto _test_eof196;
-case 196:
-	switch( (*p) ) {
-		case 58: goto tr190;
-		case 63: goto st175;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st197;
-	goto st173;
-st197:
-	if ( ++p == pe )
-		goto _test_eof197;
-case 197:
-	switch( (*p) ) {
-		case 46: goto st198;
-		case 58: goto tr190;
-		case 63: goto st175;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st202;
-	goto st173;
-st198:
-	if ( ++p == pe )
-		goto _test_eof198;
-case 198:
-	switch( (*p) ) {
-		case 58: goto tr190;
-		case 63: goto st175;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st199;
-	goto st173;
-st199:
-	if ( ++p == pe )
-		goto _test_eof199;
-case 199:
-	switch( (*p) ) {
-		case 58: goto tr222;
-		case 63: goto st175;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st200;
-	goto st173;
-st200:
-	if ( ++p == pe )
-		goto _test_eof200;
-case 200:
-	switch( (*p) ) {
-		case 58: goto tr222;
-		case 63: goto st175;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st201;
-	goto st173;
-st201:
-	if ( ++p == pe )
-		goto _test_eof201;
-case 201:
-	switch( (*p) ) {
-		case 58: goto tr222;
-		case 63: goto st175;
-	}
-	goto st173;
-st202:
-	if ( ++p == pe )
-		goto _test_eof202;
-case 202:
-	switch( (*p) ) {
-		case 46: goto st198;
-		case 58: goto tr190;
-		case 63: goto st175;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st203;
-	goto st173;
-st203:
-	if ( ++p == pe )
-		goto _test_eof203;
-case 203:
-	switch( (*p) ) {
-		case 46: goto st198;
-		case 58: goto tr190;
-		case 63: goto st175;
-	}
-	goto st173;
-st204:
-	if ( ++p == pe )
-		goto _test_eof204;
-case 204:
-	switch( (*p) ) {
-		case 46: goto st196;
-		case 58: goto tr190;
-		case 63: goto st175;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st205;
-	goto st173;
-st205:
-	if ( ++p == pe )
-		goto _test_eof205;
-case 205:
-	switch( (*p) ) {
-		case 46: goto st196;
-		case 58: goto tr190;
-		case 63: goto st175;
-	}
-	goto st173;
-st206:
-	if ( ++p == pe )
-		goto _test_eof206;
-case 206:
-	switch( (*p) ) {
-		case 46: goto st194;
-		case 58: goto tr212;
-		case 63: goto st175;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st207;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st208;
-	} else
-		goto st208;
-	goto st173;
-st207:
-	if ( ++p == pe )
-		goto _test_eof207;
-case 207:
-	switch( (*p) ) {
-		case 46: goto st194;
-		case 58: goto tr212;
-		case 63: goto st175;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st208;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st208;
-	} else
-		goto st208;
-	goto st173;
-tr91:
-#line 136 "src/uri.rl"
-	{ login.start  = p; }
-#line 180 "src/uri.rl"
-	{ path.start = p; }
-#line 133 "src/uri.rl"
-	{ schema.end   = p - 3; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-	goto st208;
-st208:
-	if ( ++p == pe )
-		goto _test_eof208;
-case 208:
-#line 3183 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto tr212;
-		case 63: goto st175;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st208;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st208;
-	} else
-		goto st208;
-	goto st173;
-tr212:
-#line 137 "src/uri.rl"
-	{ login.end    = p; }
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st209;
-st209:
-	if ( ++p == pe )
-		goto _test_eof209;
-case 209:
-#line 3207 "src/uri.cc"
-	if ( (*p) == 48 )
-		goto tr227;
-	if ( (*p) < 65 ) {
-		if ( 49 <= (*p) && (*p) <= 57 )
-			goto tr228;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto tr229;
-	} else
-		goto tr229;
-	goto st175;
-tr227:
-#line 140 "src/uri.rl"
-	{ password.start = p; }
-	goto st210;
-st210:
-	if ( ++p == pe )
-		goto _test_eof210;
-case 210:
-#line 3227 "src/uri.cc"
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st210;
-	} else
-		goto st210;
-	goto st175;
-tr231:
-#line 141 "src/uri.rl"
-	{ password.end   = p; }
-	goto st211;
-st211:
-	if ( ++p == pe )
-		goto _test_eof211;
-case 211:
-#line 3247 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto tr90;
-		case 63: goto tr90;
-		case 91: goto tr234;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto tr233;
-	goto tr232;
-tr233:
-#line 180 "src/uri.rl"
-	{ path.start = p; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-#line 144 "src/uri.rl"
-	{ ip4.start = p; }
-	goto st212;
-st212:
-	if ( ++p == pe )
-		goto _test_eof212;
-case 212:
-#line 3268 "src/uri.cc"
-	switch( (*p) ) {
-		case 46: goto st194;
-		case 58: goto tr190;
-		case 63: goto st175;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st213;
-	goto st173;
-st213:
-	if ( ++p == pe )
-		goto _test_eof213;
-case 213:
-	switch( (*p) ) {
-		case 46: goto st194;
-		case 58: goto tr190;
-		case 63: goto st175;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st214;
-	goto st173;
-st214:
-	if ( ++p == pe )
-		goto _test_eof214;
-case 214:
-	switch( (*p) ) {
-		case 46: goto st194;
-		case 58: goto tr190;
-		case 63: goto st175;
-	}
-	goto st173;
-tr92:
-#line 180 "src/uri.rl"
-	{ path.start = p; }
-#line 133 "src/uri.rl"
-	{ schema.end   = p - 3; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-#line 153 "src/uri.rl"
-	{ ip6.start = p + 1; }
-	goto st215;
-tr234:
-#line 180 "src/uri.rl"
-	{ path.start = p; }
-#line 157 "src/uri.rl"
-	{ host.start   = p; }
-#line 153 "src/uri.rl"
-	{ ip6.start = p + 1; }
-	goto st215;
-st215:
-	if ( ++p == pe )
-		goto _test_eof215;
-case 215:
-#line 3321 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto tr238;
-		case 63: goto st175;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st216;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st216;
-	} else
-		goto st216;
-	goto st173;
-st216:
-	if ( ++p == pe )
-		goto _test_eof216;
-case 216:
-	switch( (*p) ) {
-		case 58: goto tr240;
-		case 63: goto st175;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st217;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st217;
-	} else
-		goto st217;
-	goto st173;
-st217:
-	if ( ++p == pe )
-		goto _test_eof217;
-case 217:
-	switch( (*p) ) {
-		case 58: goto tr240;
-		case 63: goto st175;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st218;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st218;
-	} else
-		goto st218;
-	goto st173;
-st218:
-	if ( ++p == pe )
-		goto _test_eof218;
-case 218:
-	switch( (*p) ) {
-		case 58: goto tr240;
-		case 63: goto st175;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st219;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st219;
-	} else
-		goto st219;
-	goto st173;
-st219:
-	if ( ++p == pe )
-		goto _test_eof219;
-case 219:
-	switch( (*p) ) {
-		case 58: goto tr240;
-		case 63: goto st175;
-	}
-	goto st173;
-tr240:
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st220;
-st220:
-	if ( ++p == pe )
-		goto _test_eof220;
-case 220:
-#line 3403 "src/uri.cc"
-	switch( (*p) ) {
-		case 48: goto st221;
-		case 58: goto st225;
-		case 93: goto st260;
-	}
-	if ( (*p) < 71 ) {
-		if ( (*p) > 57 ) {
-			if ( 65 <= (*p) && (*p) <= 70 )
-				goto tr246;
-		} else if ( (*p) >= 49 )
-			goto tr244;
-	} else if ( (*p) > 90 ) {
-		if ( (*p) > 102 ) {
-			if ( 103 <= (*p) && (*p) <= 122 )
-				goto tr193;
-		} else if ( (*p) >= 97 )
-			goto tr246;
-	} else
-		goto tr193;
-	goto st175;
-st221:
-	if ( ++p == pe )
-		goto _test_eof221;
-case 221:
-	switch( (*p) ) {
-		case 58: goto st225;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st222;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st222;
-	} else
-		goto st222;
-	goto st175;
-st222:
-	if ( ++p == pe )
-		goto _test_eof222;
-case 222:
-	switch( (*p) ) {
-		case 58: goto st225;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st223;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st223;
-	} else
-		goto st223;
-	goto st175;
-st223:
-	if ( ++p == pe )
-		goto _test_eof223;
-case 223:
-	switch( (*p) ) {
-		case 58: goto st225;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st224;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st224;
-	} else
-		goto st224;
-	goto st175;
-st224:
-	if ( ++p == pe )
-		goto _test_eof224;
-case 224:
-	switch( (*p) ) {
-		case 58: goto st225;
-		case 93: goto st260;
-	}
-	goto st175;
-st225:
-	if ( ++p == pe )
-		goto _test_eof225;
-case 225:
-	switch( (*p) ) {
-		case 58: goto st230;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st226;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st226;
-	} else
-		goto st226;
-	goto st175;
-st226:
-	if ( ++p == pe )
-		goto _test_eof226;
-case 226:
-	switch( (*p) ) {
-		case 58: goto st230;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st227;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st227;
-	} else
-		goto st227;
-	goto st175;
-st227:
-	if ( ++p == pe )
-		goto _test_eof227;
-case 227:
-	switch( (*p) ) {
-		case 58: goto st230;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st228;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st228;
-	} else
-		goto st228;
-	goto st175;
-st228:
-	if ( ++p == pe )
-		goto _test_eof228;
-case 228:
-	switch( (*p) ) {
-		case 58: goto st230;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st229;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st229;
-	} else
-		goto st229;
-	goto st175;
-st229:
-	if ( ++p == pe )
-		goto _test_eof229;
-case 229:
-	switch( (*p) ) {
-		case 58: goto st230;
-		case 93: goto st260;
-	}
-	goto st175;
-st230:
-	if ( ++p == pe )
-		goto _test_eof230;
-case 230:
-	switch( (*p) ) {
-		case 58: goto st235;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st231;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st231;
-	} else
-		goto st231;
-	goto st175;
-st231:
-	if ( ++p == pe )
-		goto _test_eof231;
-case 231:
-	switch( (*p) ) {
-		case 58: goto st235;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st232;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st232;
-	} else
-		goto st232;
-	goto st175;
-st232:
-	if ( ++p == pe )
-		goto _test_eof232;
-case 232:
-	switch( (*p) ) {
-		case 58: goto st235;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st233;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st233;
-	} else
-		goto st233;
-	goto st175;
-st233:
-	if ( ++p == pe )
-		goto _test_eof233;
-case 233:
-	switch( (*p) ) {
-		case 58: goto st235;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st234;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st234;
-	} else
-		goto st234;
-	goto st175;
-st234:
-	if ( ++p == pe )
-		goto _test_eof234;
-case 234:
-	switch( (*p) ) {
-		case 58: goto st235;
-		case 93: goto st260;
-	}
-	goto st175;
-st235:
-	if ( ++p == pe )
-		goto _test_eof235;
-case 235:
-	switch( (*p) ) {
-		case 58: goto st240;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st236;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st236;
-	} else
-		goto st236;
-	goto st175;
-st236:
-	if ( ++p == pe )
-		goto _test_eof236;
-case 236:
-	switch( (*p) ) {
-		case 58: goto st240;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st237;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st237;
-	} else
-		goto st237;
-	goto st175;
-st237:
-	if ( ++p == pe )
-		goto _test_eof237;
-case 237:
-	switch( (*p) ) {
-		case 58: goto st240;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st238;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st238;
-	} else
-		goto st238;
-	goto st175;
-st238:
-	if ( ++p == pe )
-		goto _test_eof238;
-case 238:
-	switch( (*p) ) {
-		case 58: goto st240;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st239;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st239;
-	} else
-		goto st239;
-	goto st175;
-st239:
-	if ( ++p == pe )
-		goto _test_eof239;
-case 239:
-	switch( (*p) ) {
-		case 58: goto st240;
-		case 93: goto st260;
-	}
-	goto st175;
-st240:
-	if ( ++p == pe )
-		goto _test_eof240;
-case 240:
-	switch( (*p) ) {
-		case 58: goto st245;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st241;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st241;
-	} else
-		goto st241;
-	goto st175;
-st241:
-	if ( ++p == pe )
-		goto _test_eof241;
-case 241:
-	switch( (*p) ) {
-		case 58: goto st245;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st242;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st242;
-	} else
-		goto st242;
-	goto st175;
-st242:
-	if ( ++p == pe )
-		goto _test_eof242;
-case 242:
-	switch( (*p) ) {
-		case 58: goto st245;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st243;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st243;
-	} else
-		goto st243;
-	goto st175;
-st243:
-	if ( ++p == pe )
-		goto _test_eof243;
-case 243:
-	switch( (*p) ) {
-		case 58: goto st245;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st244;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st244;
-	} else
-		goto st244;
-	goto st175;
-st244:
-	if ( ++p == pe )
-		goto _test_eof244;
-case 244:
-	switch( (*p) ) {
-		case 58: goto st245;
-		case 93: goto st260;
-	}
-	goto st175;
-st245:
-	if ( ++p == pe )
-		goto _test_eof245;
-case 245:
-	switch( (*p) ) {
-		case 58: goto st250;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st246;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st246;
-	} else
-		goto st246;
-	goto st175;
-st246:
-	if ( ++p == pe )
-		goto _test_eof246;
-case 246:
-	switch( (*p) ) {
-		case 58: goto st250;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st247;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st247;
-	} else
-		goto st247;
-	goto st175;
-st247:
-	if ( ++p == pe )
-		goto _test_eof247;
-case 247:
-	switch( (*p) ) {
-		case 58: goto st250;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st248;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st248;
-	} else
-		goto st248;
-	goto st175;
-st248:
-	if ( ++p == pe )
-		goto _test_eof248;
-case 248:
-	switch( (*p) ) {
-		case 58: goto st250;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st249;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st249;
-	} else
-		goto st249;
-	goto st175;
-st249:
-	if ( ++p == pe )
-		goto _test_eof249;
-case 249:
-	switch( (*p) ) {
-		case 58: goto st250;
-		case 93: goto st260;
-	}
-	goto st175;
-st250:
-	if ( ++p == pe )
-		goto _test_eof250;
-case 250:
-	switch( (*p) ) {
-		case 58: goto st255;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st251;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st251;
-	} else
-		goto st251;
-	goto st175;
-st251:
-	if ( ++p == pe )
-		goto _test_eof251;
-case 251:
-	switch( (*p) ) {
-		case 58: goto st255;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st252;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st252;
-	} else
-		goto st252;
-	goto st175;
-st252:
-	if ( ++p == pe )
-		goto _test_eof252;
-case 252:
-	switch( (*p) ) {
-		case 58: goto st255;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st253;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st253;
-	} else
-		goto st253;
-	goto st175;
-st253:
-	if ( ++p == pe )
-		goto _test_eof253;
-case 253:
-	switch( (*p) ) {
-		case 58: goto st255;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st254;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st254;
-	} else
-		goto st254;
-	goto st175;
-st254:
-	if ( ++p == pe )
-		goto _test_eof254;
-case 254:
-	switch( (*p) ) {
-		case 58: goto st255;
-		case 93: goto st260;
-	}
-	goto st175;
-st255:
-	if ( ++p == pe )
-		goto _test_eof255;
-case 255:
-	if ( (*p) == 93 )
-		goto st260;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st256;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st256;
-	} else
-		goto st256;
-	goto st175;
-st256:
-	if ( ++p == pe )
-		goto _test_eof256;
-case 256:
-	if ( (*p) == 93 )
-		goto st260;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st257;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st257;
-	} else
-		goto st257;
-	goto st175;
-st257:
-	if ( ++p == pe )
-		goto _test_eof257;
-case 257:
-	if ( (*p) == 93 )
-		goto st260;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st258;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st258;
-	} else
-		goto st258;
-	goto st175;
-st258:
-	if ( ++p == pe )
-		goto _test_eof258;
-case 258:
-	if ( (*p) == 93 )
-		goto st260;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st259;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st259;
-	} else
-		goto st259;
-	goto st175;
-st259:
-	if ( ++p == pe )
-		goto _test_eof259;
-case 259:
-	if ( (*p) == 93 )
-		goto st260;
-	goto st175;
-st260:
-	if ( ++p == pe )
-		goto _test_eof260;
-case 260:
-	if ( (*p) == 58 )
-		goto tr285;
-	goto st175;
-tr244:
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-#line 161 "src/uri.rl"
-	{ dport.start   = p; port = 0; }
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st261;
-st261:
-	if ( ++p == pe )
-		goto _test_eof261;
-case 261:
-#line 4032 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto st225;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr286;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st222;
-	} else
-		goto st222;
-	goto st175;
-tr286:
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st262;
-st262:
-	if ( ++p == pe )
-		goto _test_eof262;
-case 262:
-#line 4054 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto st225;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr287;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st223;
-	} else
-		goto st223;
-	goto st175;
-tr287:
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st263;
-st263:
-	if ( ++p == pe )
-		goto _test_eof263;
-case 263:
-#line 4076 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto st225;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr288;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st224;
-	} else
-		goto st224;
-	goto st175;
-tr288:
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st264;
-st264:
-	if ( ++p == pe )
-		goto _test_eof264;
-case 264:
-#line 4098 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto st225;
-		case 93: goto st260;
-	}
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto tr194;
-	goto st175;
-tr246:
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-	goto st265;
-st265:
-	if ( ++p == pe )
-		goto _test_eof265;
-case 265:
-#line 4114 "src/uri.cc"
-	switch( (*p) ) {
-		case 58: goto st225;
-		case 93: goto st260;
-	}
-	if ( (*p) < 71 ) {
-		if ( (*p) > 57 ) {
-			if ( 65 <= (*p) && (*p) <= 70 )
-				goto st266;
-		} else if ( (*p) >= 48 )
-			goto st222;
-	} else if ( (*p) > 90 ) {
-		if ( (*p) > 102 ) {
-			if ( 103 <= (*p) && (*p) <= 122 )
-				goto st178;
-		} else if ( (*p) >= 97 )
-			goto st266;
-	} else
-		goto st178;
-	goto st175;
-st266:
-	if ( ++p == pe )
-		goto _test_eof266;
-case 266:
-	switch( (*p) ) {
-		case 58: goto st225;
-		case 93: goto st260;
-	}
-	if ( (*p) < 71 ) {
-		if ( (*p) > 57 ) {
-			if ( 65 <= (*p) && (*p) <= 70 )
-				goto st267;
-		} else if ( (*p) >= 48 )
-			goto st223;
-	} else if ( (*p) > 90 ) {
-		if ( (*p) > 102 ) {
-			if ( 103 <= (*p) && (*p) <= 122 )
-				goto st179;
-		} else if ( (*p) >= 97 )
-			goto st267;
-	} else
-		goto st179;
-	goto st175;
-st267:
-	if ( ++p == pe )
-		goto _test_eof267;
-case 267:
-	switch( (*p) ) {
-		case 58: goto st225;
-		case 93: goto st260;
-	}
-	if ( (*p) < 71 ) {
-		if ( (*p) > 57 ) {
-			if ( 65 <= (*p) && (*p) <= 70 )
-				goto st268;
-		} else if ( (*p) >= 48 )
-			goto st224;
-	} else if ( (*p) > 90 ) {
-		if ( (*p) > 102 ) {
-			if ( 103 <= (*p) && (*p) <= 122 )
-				goto st180;
-		} else if ( (*p) >= 97 )
-			goto st268;
-	} else
-		goto st180;
-	goto st175;
-st268:
-	if ( ++p == pe )
-		goto _test_eof268;
-case 268:
-	switch( (*p) ) {
-		case 58: goto st225;
-		case 93: goto st260;
-	}
-	if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st181;
-	} else if ( (*p) >= 65 )
-		goto st181;
-	goto st175;
-tr238:
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	goto st269;
-st269:
-	if ( ++p == pe )
-		goto _test_eof269;
-case 269:
-#line 4202 "src/uri.cc"
-	switch( (*p) ) {
-		case 48: goto st221;
-		case 58: goto st270;
-		case 93: goto st260;
-	}
-	if ( (*p) < 71 ) {
-		if ( (*p) > 57 ) {
-			if ( 65 <= (*p) && (*p) <= 70 )
-				goto tr246;
-		} else if ( (*p) >= 49 )
-			goto tr244;
-	} else if ( (*p) > 90 ) {
-		if ( (*p) > 102 ) {
-			if ( 103 <= (*p) && (*p) <= 122 )
-				goto tr193;
-		} else if ( (*p) >= 97 )
-			goto tr246;
-	} else
-		goto tr193;
-	goto st175;
-st270:
-	if ( ++p == pe )
-		goto _test_eof270;
-case 270:
-	switch( (*p) ) {
-		case 58: goto st230;
-		case 70: goto st271;
-		case 93: goto st260;
-		case 102: goto st271;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st226;
-	} else if ( (*p) > 69 ) {
-		if ( 97 <= (*p) && (*p) <= 101 )
-			goto st226;
-	} else
-		goto st226;
-	goto st175;
-st271:
-	if ( ++p == pe )
-		goto _test_eof271;
-case 271:
-	switch( (*p) ) {
-		case 58: goto st230;
-		case 70: goto st272;
-		case 93: goto st260;
-		case 102: goto st272;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st227;
-	} else if ( (*p) > 69 ) {
-		if ( 97 <= (*p) && (*p) <= 101 )
-			goto st227;
-	} else
-		goto st227;
-	goto st175;
-st272:
-	if ( ++p == pe )
-		goto _test_eof272;
-case 272:
-	switch( (*p) ) {
-		case 58: goto st230;
-		case 70: goto st273;
-		case 93: goto st260;
-		case 102: goto st273;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st228;
-	} else if ( (*p) > 69 ) {
-		if ( 97 <= (*p) && (*p) <= 101 )
-			goto st228;
-	} else
-		goto st228;
-	goto st175;
-st273:
-	if ( ++p == pe )
-		goto _test_eof273;
-case 273:
-	switch( (*p) ) {
-		case 58: goto st230;
-		case 70: goto st274;
-		case 93: goto st260;
-		case 102: goto st274;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st229;
-	} else if ( (*p) > 69 ) {
-		if ( 97 <= (*p) && (*p) <= 101 )
-			goto st229;
-	} else
-		goto st229;
-	goto st175;
-st274:
-	if ( ++p == pe )
-		goto _test_eof274;
-case 274:
-	switch( (*p) ) {
-		case 58: goto st275;
-		case 93: goto st260;
-	}
-	goto st175;
-st275:
-	if ( ++p == pe )
-		goto _test_eof275;
-case 275:
-	switch( (*p) ) {
-		case 58: goto st235;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr298;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st231;
-	} else
-		goto st231;
-	goto st175;
-tr298:
-#line 144 "src/uri.rl"
-	{ ip4.start = p; }
-	goto st276;
-st276:
-	if ( ++p == pe )
-		goto _test_eof276;
-case 276:
-#line 4333 "src/uri.cc"
-	switch( (*p) ) {
-		case 46: goto st277;
-		case 58: goto st235;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st290;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st232;
-	} else
-		goto st232;
-	goto st175;
-st277:
-	if ( ++p == pe )
-		goto _test_eof277;
-case 277:
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st278;
-	goto st175;
-st278:
-	if ( ++p == pe )
-		goto _test_eof278;
-case 278:
-	if ( (*p) == 46 )
-		goto st279;
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st288;
-	goto st175;
-st279:
-	if ( ++p == pe )
-		goto _test_eof279;
-case 279:
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st280;
-	goto st175;
-st280:
-	if ( ++p == pe )
-		goto _test_eof280;
-case 280:
-	if ( (*p) == 46 )
-		goto st281;
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st286;
-	goto st175;
-st281:
-	if ( ++p == pe )
-		goto _test_eof281;
-case 281:
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st282;
-	goto st175;
-st282:
-	if ( ++p == pe )
-		goto _test_eof282;
-case 282:
-	if ( (*p) == 93 )
-		goto tr309;
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st283;
-	goto st175;
-st283:
-	if ( ++p == pe )
-		goto _test_eof283;
-case 283:
-	if ( (*p) == 93 )
-		goto tr309;
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st284;
-	goto st175;
-st284:
-	if ( ++p == pe )
-		goto _test_eof284;
-case 284:
-	if ( (*p) == 93 )
-		goto tr309;
-	goto st175;
-tr309:
-#line 145 "src/uri.rl"
-	{ ip4.end   = p; }
-	goto st285;
-st285:
-	if ( ++p == pe )
-		goto _test_eof285;
-case 285:
-#line 4420 "src/uri.cc"
-	if ( (*p) == 58 )
-		goto tr190;
-	goto st175;
-st286:
-	if ( ++p == pe )
-		goto _test_eof286;
-case 286:
-	if ( (*p) == 46 )
-		goto st281;
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st287;
-	goto st175;
-st287:
-	if ( ++p == pe )
-		goto _test_eof287;
-case 287:
-	if ( (*p) == 46 )
-		goto st281;
-	goto st175;
-st288:
-	if ( ++p == pe )
-		goto _test_eof288;
-case 288:
-	if ( (*p) == 46 )
-		goto st279;
-	if ( 48 <= (*p) && (*p) <= 57 )
-		goto st289;
-	goto st175;
-st289:
-	if ( ++p == pe )
-		goto _test_eof289;
-case 289:
-	if ( (*p) == 46 )
-		goto st279;
-	goto st175;
-st290:
-	if ( ++p == pe )
-		goto _test_eof290;
-case 290:
-	switch( (*p) ) {
-		case 46: goto st277;
-		case 58: goto st235;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st291;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st233;
-	} else
-		goto st233;
-	goto st175;
-st291:
-	if ( ++p == pe )
-		goto _test_eof291;
-case 291:
-	switch( (*p) ) {
-		case 46: goto st277;
-		case 58: goto st235;
-		case 93: goto st260;
-	}
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st234;
-	} else if ( (*p) > 70 ) {
-		if ( 97 <= (*p) && (*p) <= 102 )
-			goto st234;
-	} else
-		goto st234;
-	goto st175;
-tr228:
-#line 140 "src/uri.rl"
-	{ password.start = p; }
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-#line 161 "src/uri.rl"
-	{ dport.start   = p; port = 0; }
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st292;
-tr314:
-#line 162 "src/uri.rl"
-	{ port = port * 10 + (int)(*p - '0'); }
-	goto st292;
-st292:
-	if ( ++p == pe )
-		goto _test_eof292;
-case 292:
-#line 4510 "src/uri.cc"
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto tr314;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st210;
-	} else
-		goto st210;
-	goto st175;
-tr229:
-#line 140 "src/uri.rl"
-	{ password.start = p; }
-#line 166 "src/uri.rl"
-	{ service.start = p; }
-	goto st293;
-st293:
-	if ( ++p == pe )
-		goto _test_eof293;
-case 293:
-#line 4532 "src/uri.cc"
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st294;
-	} else
-		goto st294;
-	goto st175;
-st294:
-	if ( ++p == pe )
-		goto _test_eof294;
-case 294:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st295;
-	} else
-		goto st295;
-	goto st175;
-st295:
-	if ( ++p == pe )
-		goto _test_eof295;
-case 295:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st296;
-	} else
-		goto st296;
-	goto st175;
-st296:
-	if ( ++p == pe )
-		goto _test_eof296;
-case 296:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st297;
-	} else
-		goto st297;
-	goto st175;
-st297:
-	if ( ++p == pe )
-		goto _test_eof297;
-case 297:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st298;
-	} else
-		goto st298;
-	goto st175;
-st298:
-	if ( ++p == pe )
-		goto _test_eof298;
-case 298:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st299;
-	} else
-		goto st299;
-	goto st175;
-st299:
-	if ( ++p == pe )
-		goto _test_eof299;
-case 299:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st300;
-	} else
-		goto st300;
-	goto st175;
-st300:
-	if ( ++p == pe )
-		goto _test_eof300;
-case 300:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st301;
-	} else
-		goto st301;
-	goto st175;
-st301:
-	if ( ++p == pe )
-		goto _test_eof301;
-case 301:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st302;
-	} else
-		goto st302;
-	goto st175;
-st302:
-	if ( ++p == pe )
-		goto _test_eof302;
-case 302:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st303;
-	} else
-		goto st303;
-	goto st175;
-st303:
-	if ( ++p == pe )
-		goto _test_eof303;
-case 303:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st304;
-	} else
-		goto st304;
-	goto st175;
-st304:
-	if ( ++p == pe )
-		goto _test_eof304;
-case 304:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st305;
-	} else
-		goto st305;
-	goto st175;
-st305:
-	if ( ++p == pe )
-		goto _test_eof305;
-case 305:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st306;
-	} else
-		goto st306;
-	goto st175;
-st306:
-	if ( ++p == pe )
-		goto _test_eof306;
-case 306:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st307;
-	} else
-		goto st307;
-	goto st175;
-st307:
-	if ( ++p == pe )
-		goto _test_eof307;
-case 307:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st308;
-	} else
-		goto st308;
-	goto st175;
-st308:
-	if ( ++p == pe )
-		goto _test_eof308;
-case 308:
-	if ( (*p) == 64 )
-		goto tr231;
-	if ( (*p) < 65 ) {
-		if ( 48 <= (*p) && (*p) <= 57 )
-			goto st210;
-	} else if ( (*p) > 90 ) {
-		if ( 97 <= (*p) && (*p) <= 122 )
-			goto st210;
-	} else
-		goto st210;
-	goto st175;
-	}
-	_test_eof74: cs = 74; goto _test_eof; 
-	_test_eof2: cs = 2; goto _test_eof; 
-	_test_eof75: cs = 75; goto _test_eof; 
-	_test_eof76: cs = 76; goto _test_eof; 
-	_test_eof77: cs = 77; goto _test_eof; 
-	_test_eof78: cs = 78; goto _test_eof; 
-	_test_eof79: cs = 79; goto _test_eof; 
-	_test_eof80: cs = 80; goto _test_eof; 
-	_test_eof81: cs = 81; goto _test_eof; 
-	_test_eof82: cs = 82; goto _test_eof; 
-	_test_eof83: cs = 83; goto _test_eof; 
-	_test_eof84: cs = 84; goto _test_eof; 
-	_test_eof85: cs = 85; goto _test_eof; 
-	_test_eof86: cs = 86; goto _test_eof; 
-	_test_eof87: cs = 87; goto _test_eof; 
-	_test_eof88: cs = 88; goto _test_eof; 
-	_test_eof89: cs = 89; goto _test_eof; 
-	_test_eof90: cs = 90; goto _test_eof; 
-	_test_eof91: cs = 91; goto _test_eof; 
-	_test_eof92: cs = 92; goto _test_eof; 
-	_test_eof93: cs = 93; goto _test_eof; 
-	_test_eof94: cs = 94; goto _test_eof; 
-	_test_eof95: cs = 95; goto _test_eof; 
-	_test_eof96: cs = 96; goto _test_eof; 
-	_test_eof97: cs = 97; goto _test_eof; 
-	_test_eof98: cs = 98; goto _test_eof; 
-	_test_eof99: cs = 99; goto _test_eof; 
-	_test_eof100: cs = 100; goto _test_eof; 
-	_test_eof101: cs = 101; goto _test_eof; 
-	_test_eof102: cs = 102; goto _test_eof; 
-	_test_eof103: cs = 103; goto _test_eof; 
-	_test_eof104: cs = 104; goto _test_eof; 
-	_test_eof105: cs = 105; goto _test_eof; 
-	_test_eof106: cs = 106; goto _test_eof; 
-	_test_eof107: cs = 107; goto _test_eof; 
-	_test_eof108: cs = 108; goto _test_eof; 
-	_test_eof109: cs = 109; goto _test_eof; 
-	_test_eof110: cs = 110; goto _test_eof; 
-	_test_eof111: cs = 111; goto _test_eof; 
-	_test_eof112: cs = 112; goto _test_eof; 
-	_test_eof113: cs = 113; goto _test_eof; 
-	_test_eof114: cs = 114; goto _test_eof; 
-	_test_eof115: cs = 115; goto _test_eof; 
-	_test_eof116: cs = 116; goto _test_eof; 
-	_test_eof117: cs = 117; goto _test_eof; 
-	_test_eof118: cs = 118; goto _test_eof; 
-	_test_eof119: cs = 119; goto _test_eof; 
-	_test_eof120: cs = 120; goto _test_eof; 
-	_test_eof121: cs = 121; goto _test_eof; 
-	_test_eof122: cs = 122; goto _test_eof; 
-	_test_eof123: cs = 123; goto _test_eof; 
-	_test_eof124: cs = 124; goto _test_eof; 
-	_test_eof125: cs = 125; goto _test_eof; 
-	_test_eof126: cs = 126; goto _test_eof; 
-	_test_eof127: cs = 127; goto _test_eof; 
-	_test_eof128: cs = 128; goto _test_eof; 
-	_test_eof3: cs = 3; goto _test_eof; 
-	_test_eof4: cs = 4; goto _test_eof; 
-	_test_eof5: cs = 5; goto _test_eof; 
-	_test_eof129: cs = 129; goto _test_eof; 
-	_test_eof130: cs = 130; goto _test_eof; 
-	_test_eof131: cs = 131; goto _test_eof; 
-	_test_eof132: cs = 132; goto _test_eof; 
-	_test_eof133: cs = 133; goto _test_eof; 
-	_test_eof134: cs = 134; goto _test_eof; 
-	_test_eof135: cs = 135; goto _test_eof; 
-	_test_eof136: cs = 136; goto _test_eof; 
-	_test_eof6: cs = 6; goto _test_eof; 
-	_test_eof7: cs = 7; goto _test_eof; 
-	_test_eof8: cs = 8; goto _test_eof; 
-	_test_eof9: cs = 9; goto _test_eof; 
-	_test_eof10: cs = 10; goto _test_eof; 
-	_test_eof11: cs = 11; goto _test_eof; 
-	_test_eof12: cs = 12; goto _test_eof; 
-	_test_eof13: cs = 13; goto _test_eof; 
-	_test_eof14: cs = 14; goto _test_eof; 
-	_test_eof15: cs = 15; goto _test_eof; 
-	_test_eof16: cs = 16; goto _test_eof; 
-	_test_eof17: cs = 17; goto _test_eof; 
-	_test_eof18: cs = 18; goto _test_eof; 
-	_test_eof19: cs = 19; goto _test_eof; 
-	_test_eof20: cs = 20; goto _test_eof; 
-	_test_eof21: cs = 21; goto _test_eof; 
-	_test_eof22: cs = 22; goto _test_eof; 
-	_test_eof23: cs = 23; goto _test_eof; 
-	_test_eof24: cs = 24; goto _test_eof; 
-	_test_eof25: cs = 25; goto _test_eof; 
-	_test_eof26: cs = 26; goto _test_eof; 
-	_test_eof27: cs = 27; goto _test_eof; 
-	_test_eof28: cs = 28; goto _test_eof; 
-	_test_eof29: cs = 29; goto _test_eof; 
-	_test_eof30: cs = 30; goto _test_eof; 
-	_test_eof31: cs = 31; goto _test_eof; 
-	_test_eof32: cs = 32; goto _test_eof; 
-	_test_eof33: cs = 33; goto _test_eof; 
-	_test_eof34: cs = 34; goto _test_eof; 
-	_test_eof35: cs = 35; goto _test_eof; 
-	_test_eof36: cs = 36; goto _test_eof; 
-	_test_eof37: cs = 37; goto _test_eof; 
-	_test_eof38: cs = 38; goto _test_eof; 
-	_test_eof39: cs = 39; goto _test_eof; 
-	_test_eof40: cs = 40; goto _test_eof; 
-	_test_eof41: cs = 41; goto _test_eof; 
-	_test_eof42: cs = 42; goto _test_eof; 
-	_test_eof43: cs = 43; goto _test_eof; 
-	_test_eof44: cs = 44; goto _test_eof; 
-	_test_eof45: cs = 45; goto _test_eof; 
-	_test_eof137: cs = 137; goto _test_eof; 
-	_test_eof138: cs = 138; goto _test_eof; 
-	_test_eof139: cs = 139; goto _test_eof; 
-	_test_eof140: cs = 140; goto _test_eof; 
-	_test_eof141: cs = 141; goto _test_eof; 
-	_test_eof142: cs = 142; goto _test_eof; 
-	_test_eof143: cs = 143; goto _test_eof; 
-	_test_eof144: cs = 144; goto _test_eof; 
-	_test_eof145: cs = 145; goto _test_eof; 
-	_test_eof46: cs = 46; goto _test_eof; 
-	_test_eof47: cs = 47; goto _test_eof; 
-	_test_eof48: cs = 48; goto _test_eof; 
-	_test_eof49: cs = 49; goto _test_eof; 
-	_test_eof50: cs = 50; goto _test_eof; 
-	_test_eof51: cs = 51; goto _test_eof; 
-	_test_eof52: cs = 52; goto _test_eof; 
-	_test_eof53: cs = 53; goto _test_eof; 
-	_test_eof54: cs = 54; goto _test_eof; 
-	_test_eof55: cs = 55; goto _test_eof; 
-	_test_eof56: cs = 56; goto _test_eof; 
-	_test_eof57: cs = 57; goto _test_eof; 
-	_test_eof58: cs = 58; goto _test_eof; 
-	_test_eof59: cs = 59; goto _test_eof; 
-	_test_eof60: cs = 60; goto _test_eof; 
-	_test_eof61: cs = 61; goto _test_eof; 
-	_test_eof146: cs = 146; goto _test_eof; 
-	_test_eof62: cs = 62; goto _test_eof; 
-	_test_eof63: cs = 63; goto _test_eof; 
-	_test_eof64: cs = 64; goto _test_eof; 
-	_test_eof65: cs = 65; goto _test_eof; 
-	_test_eof66: cs = 66; goto _test_eof; 
-	_test_eof67: cs = 67; goto _test_eof; 
-	_test_eof147: cs = 147; goto _test_eof; 
-	_test_eof148: cs = 148; goto _test_eof; 
-	_test_eof149: cs = 149; goto _test_eof; 
-	_test_eof150: cs = 150; goto _test_eof; 
-	_test_eof151: cs = 151; goto _test_eof; 
-	_test_eof152: cs = 152; goto _test_eof; 
-	_test_eof153: cs = 153; goto _test_eof; 
-	_test_eof154: cs = 154; goto _test_eof; 
-	_test_eof155: cs = 155; goto _test_eof; 
-	_test_eof156: cs = 156; goto _test_eof; 
-	_test_eof157: cs = 157; goto _test_eof; 
-	_test_eof158: cs = 158; goto _test_eof; 
-	_test_eof159: cs = 159; goto _test_eof; 
-	_test_eof160: cs = 160; goto _test_eof; 
-	_test_eof161: cs = 161; goto _test_eof; 
-	_test_eof162: cs = 162; goto _test_eof; 
-	_test_eof163: cs = 163; goto _test_eof; 
-	_test_eof164: cs = 164; goto _test_eof; 
-	_test_eof165: cs = 165; goto _test_eof; 
-	_test_eof166: cs = 166; goto _test_eof; 
-	_test_eof167: cs = 167; goto _test_eof; 
-	_test_eof168: cs = 168; goto _test_eof; 
-	_test_eof68: cs = 68; goto _test_eof; 
-	_test_eof69: cs = 69; goto _test_eof; 
-	_test_eof70: cs = 70; goto _test_eof; 
-	_test_eof169: cs = 169; goto _test_eof; 
-	_test_eof170: cs = 170; goto _test_eof; 
-	_test_eof171: cs = 171; goto _test_eof; 
-	_test_eof172: cs = 172; goto _test_eof; 
-	_test_eof71: cs = 71; goto _test_eof; 
-	_test_eof72: cs = 72; goto _test_eof; 
-	_test_eof73: cs = 73; goto _test_eof; 
-	_test_eof173: cs = 173; goto _test_eof; 
-	_test_eof174: cs = 174; goto _test_eof; 
-	_test_eof175: cs = 175; goto _test_eof; 
-	_test_eof176: cs = 176; goto _test_eof; 
-	_test_eof177: cs = 177; goto _test_eof; 
-	_test_eof178: cs = 178; goto _test_eof; 
-	_test_eof179: cs = 179; goto _test_eof; 
-	_test_eof180: cs = 180; goto _test_eof; 
-	_test_eof181: cs = 181; goto _test_eof; 
-	_test_eof182: cs = 182; goto _test_eof; 
-	_test_eof183: cs = 183; goto _test_eof; 
-	_test_eof184: cs = 184; goto _test_eof; 
-	_test_eof185: cs = 185; goto _test_eof; 
-	_test_eof186: cs = 186; goto _test_eof; 
-	_test_eof187: cs = 187; goto _test_eof; 
-	_test_eof188: cs = 188; goto _test_eof; 
-	_test_eof189: cs = 189; goto _test_eof; 
-	_test_eof190: cs = 190; goto _test_eof; 
-	_test_eof191: cs = 191; goto _test_eof; 
-	_test_eof192: cs = 192; goto _test_eof; 
-	_test_eof193: cs = 193; goto _test_eof; 
-	_test_eof194: cs = 194; goto _test_eof; 
-	_test_eof195: cs = 195; goto _test_eof; 
-	_test_eof196: cs = 196; goto _test_eof; 
-	_test_eof197: cs = 197; goto _test_eof; 
-	_test_eof198: cs = 198; goto _test_eof; 
-	_test_eof199: cs = 199; goto _test_eof; 
-	_test_eof200: cs = 200; goto _test_eof; 
-	_test_eof201: cs = 201; goto _test_eof; 
-	_test_eof202: cs = 202; goto _test_eof; 
-	_test_eof203: cs = 203; goto _test_eof; 
-	_test_eof204: cs = 204; goto _test_eof; 
-	_test_eof205: cs = 205; goto _test_eof; 
-	_test_eof206: cs = 206; goto _test_eof; 
-	_test_eof207: cs = 207; goto _test_eof; 
-	_test_eof208: cs = 208; goto _test_eof; 
-	_test_eof209: cs = 209; goto _test_eof; 
-	_test_eof210: cs = 210; goto _test_eof; 
-	_test_eof211: cs = 211; goto _test_eof; 
-	_test_eof212: cs = 212; goto _test_eof; 
-	_test_eof213: cs = 213; goto _test_eof; 
-	_test_eof214: cs = 214; goto _test_eof; 
-	_test_eof215: cs = 215; goto _test_eof; 
-	_test_eof216: cs = 216; goto _test_eof; 
-	_test_eof217: cs = 217; goto _test_eof; 
-	_test_eof218: cs = 218; goto _test_eof; 
-	_test_eof219: cs = 219; goto _test_eof; 
-	_test_eof220: cs = 220; goto _test_eof; 
-	_test_eof221: cs = 221; goto _test_eof; 
-	_test_eof222: cs = 222; goto _test_eof; 
-	_test_eof223: cs = 223; goto _test_eof; 
-	_test_eof224: cs = 224; goto _test_eof; 
-	_test_eof225: cs = 225; goto _test_eof; 
-	_test_eof226: cs = 226; goto _test_eof; 
-	_test_eof227: cs = 227; goto _test_eof; 
-	_test_eof228: cs = 228; goto _test_eof; 
-	_test_eof229: cs = 229; goto _test_eof; 
-	_test_eof230: cs = 230; goto _test_eof; 
-	_test_eof231: cs = 231; goto _test_eof; 
-	_test_eof232: cs = 232; goto _test_eof; 
-	_test_eof233: cs = 233; goto _test_eof; 
-	_test_eof234: cs = 234; goto _test_eof; 
-	_test_eof235: cs = 235; goto _test_eof; 
-	_test_eof236: cs = 236; goto _test_eof; 
-	_test_eof237: cs = 237; goto _test_eof; 
-	_test_eof238: cs = 238; goto _test_eof; 
-	_test_eof239: cs = 239; goto _test_eof; 
-	_test_eof240: cs = 240; goto _test_eof; 
-	_test_eof241: cs = 241; goto _test_eof; 
-	_test_eof242: cs = 242; goto _test_eof; 
-	_test_eof243: cs = 243; goto _test_eof; 
-	_test_eof244: cs = 244; goto _test_eof; 
-	_test_eof245: cs = 245; goto _test_eof; 
-	_test_eof246: cs = 246; goto _test_eof; 
-	_test_eof247: cs = 247; goto _test_eof; 
-	_test_eof248: cs = 248; goto _test_eof; 
-	_test_eof249: cs = 249; goto _test_eof; 
-	_test_eof250: cs = 250; goto _test_eof; 
-	_test_eof251: cs = 251; goto _test_eof; 
-	_test_eof252: cs = 252; goto _test_eof; 
-	_test_eof253: cs = 253; goto _test_eof; 
-	_test_eof254: cs = 254; goto _test_eof; 
-	_test_eof255: cs = 255; goto _test_eof; 
-	_test_eof256: cs = 256; goto _test_eof; 
-	_test_eof257: cs = 257; goto _test_eof; 
-	_test_eof258: cs = 258; goto _test_eof; 
-	_test_eof259: cs = 259; goto _test_eof; 
-	_test_eof260: cs = 260; goto _test_eof; 
-	_test_eof261: cs = 261; goto _test_eof; 
-	_test_eof262: cs = 262; goto _test_eof; 
-	_test_eof263: cs = 263; goto _test_eof; 
-	_test_eof264: cs = 264; goto _test_eof; 
-	_test_eof265: cs = 265; goto _test_eof; 
-	_test_eof266: cs = 266; goto _test_eof; 
-	_test_eof267: cs = 267; goto _test_eof; 
-	_test_eof268: cs = 268; goto _test_eof; 
-	_test_eof269: cs = 269; goto _test_eof; 
-	_test_eof270: cs = 270; goto _test_eof; 
-	_test_eof271: cs = 271; goto _test_eof; 
-	_test_eof272: cs = 272; goto _test_eof; 
-	_test_eof273: cs = 273; goto _test_eof; 
-	_test_eof274: cs = 274; goto _test_eof; 
-	_test_eof275: cs = 275; goto _test_eof; 
-	_test_eof276: cs = 276; goto _test_eof; 
-	_test_eof277: cs = 277; goto _test_eof; 
-	_test_eof278: cs = 278; goto _test_eof; 
-	_test_eof279: cs = 279; goto _test_eof; 
-	_test_eof280: cs = 280; goto _test_eof; 
-	_test_eof281: cs = 281; goto _test_eof; 
-	_test_eof282: cs = 282; goto _test_eof; 
-	_test_eof283: cs = 283; goto _test_eof; 
-	_test_eof284: cs = 284; goto _test_eof; 
-	_test_eof285: cs = 285; goto _test_eof; 
-	_test_eof286: cs = 286; goto _test_eof; 
-	_test_eof287: cs = 287; goto _test_eof; 
-	_test_eof288: cs = 288; goto _test_eof; 
-	_test_eof289: cs = 289; goto _test_eof; 
-	_test_eof290: cs = 290; goto _test_eof; 
-	_test_eof291: cs = 291; goto _test_eof; 
-	_test_eof292: cs = 292; goto _test_eof; 
-	_test_eof293: cs = 293; goto _test_eof; 
-	_test_eof294: cs = 294; goto _test_eof; 
-	_test_eof295: cs = 295; goto _test_eof; 
-	_test_eof296: cs = 296; goto _test_eof; 
-	_test_eof297: cs = 297; goto _test_eof; 
-	_test_eof298: cs = 298; goto _test_eof; 
-	_test_eof299: cs = 299; goto _test_eof; 
-	_test_eof300: cs = 300; goto _test_eof; 
-	_test_eof301: cs = 301; goto _test_eof; 
-	_test_eof302: cs = 302; goto _test_eof; 
-	_test_eof303: cs = 303; goto _test_eof; 
-	_test_eof304: cs = 304; goto _test_eof; 
-	_test_eof305: cs = 305; goto _test_eof; 
-	_test_eof306: cs = 306; goto _test_eof; 
-	_test_eof307: cs = 307; goto _test_eof; 
-	_test_eof308: cs = 308; goto _test_eof; 
-
-	_test_eof: {}
-	if ( p == eof )
-	{
-	switch ( cs ) {
-	case 74: 
-	case 92: 
-	case 113: 
-	case 114: 
-	case 115: 
-	case 116: 
-	case 117: 
-	case 118: 
-	case 122: 
-	case 123: 
-	case 124: 
-	case 125: 
-	case 126: 
-	case 127: 
-	case 128: 
-	case 129: 
-	case 130: 
-	case 131: 
-	case 132: 
-	case 133: 
-	case 134: 
-	case 135: 
-	case 136: 
-	case 146: 
-	case 168: 
-	case 169: 
-	case 170: 
-	case 171: 
-	case 172: 
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	break;
-	case 76: 
-	case 77: 
-	case 78: 
-	case 79: 
-	case 80: 
-	case 81: 
-	case 82: 
-	case 83: 
-	case 84: 
-	case 85: 
-	case 86: 
-	case 87: 
-	case 88: 
-	case 89: 
-	case 90: 
-	case 91: 
-	case 142: 
-	case 143: 
-	case 144: 
-	case 145: 
-	case 148: 
-	case 149: 
-	case 150: 
-	case 151: 
-	case 152: 
-	case 153: 
-	case 154: 
-	case 155: 
-	case 156: 
-	case 157: 
-	case 158: 
-	case 159: 
-	case 160: 
-	case 161: 
-	case 162: 
-	case 163: 
-#line 167 "src/uri.rl"
-	{ service.end   = p; }
-	break;
-	case 94: 
-	case 95: 
-#line 177 "src/uri.rl"
-	{ path.end   = p; }
-	break;
-	case 174: 
-	case 175: 
-	case 209: 
-	case 210: 
-	case 211: 
-	case 220: 
-	case 221: 
-	case 222: 
-	case 223: 
-	case 224: 
-	case 225: 
-	case 226: 
-	case 227: 
-	case 228: 
-	case 229: 
-	case 230: 
-	case 231: 
-	case 232: 
-	case 233: 
-	case 234: 
-	case 235: 
-	case 236: 
-	case 237: 
-	case 238: 
-	case 239: 
-	case 240: 
-	case 241: 
-	case 242: 
-	case 243: 
-	case 244: 
-	case 245: 
-	case 246: 
-	case 247: 
-	case 248: 
-	case 249: 
-	case 250: 
-	case 251: 
-	case 252: 
-	case 253: 
-	case 254: 
-	case 255: 
-	case 256: 
-	case 257: 
-	case 258: 
-	case 259: 
-	case 269: 
-	case 270: 
-	case 271: 
-	case 272: 
-	case 273: 
-	case 274: 
-	case 275: 
-	case 276: 
-	case 277: 
-	case 278: 
-	case 279: 
-	case 280: 
-	case 281: 
-	case 282: 
-	case 283: 
-	case 284: 
-	case 286: 
-	case 287: 
-	case 288: 
-	case 289: 
-	case 290: 
-	case 291: 
-#line 181 "src/uri.rl"
-	{ path.end   = p; }
-	break;
-	case 119: 
-	case 120: 
-	case 121: 
-#line 145 "src/uri.rl"
-	{ ip4.end   = p; }
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	break;
-	case 137: 
-#line 154 "src/uri.rl"
-	{ ip6.end   = p - 1; }
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	break;
-	case 164: 
-	case 165: 
-	case 166: 
-	case 167: 
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-#line 173 "src/uri.rl"
-	{ sport.end     = p; }
-	break;
-	case 93: 
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-#line 177 "src/uri.rl"
-	{ path.end   = p; }
-	break;
-	case 75: 
-	case 138: 
-	case 139: 
-	case 140: 
-	case 141: 
-	case 147: 
-#line 163 "src/uri.rl"
-	{ dport.end	 = p; }
-#line 167 "src/uri.rl"
-	{ service.end   = p; }
-	break;
-	case 97: 
-	case 98: 
-	case 99: 
-	case 100: 
-	case 101: 
-	case 102: 
-	case 103: 
-	case 104: 
-	case 105: 
-	case 106: 
-	case 107: 
-	case 108: 
-	case 109: 
-	case 110: 
-	case 111: 
-	case 112: 
-#line 167 "src/uri.rl"
-	{ service.end   = p; }
-#line 177 "src/uri.rl"
-	{ path.end   = p; }
-	break;
-	case 173: 
-	case 193: 
-	case 194: 
-	case 195: 
-	case 196: 
-	case 197: 
-	case 198: 
-	case 202: 
-	case 203: 
-	case 204: 
-	case 205: 
-	case 206: 
-	case 207: 
-	case 208: 
-	case 212: 
-	case 213: 
-	case 214: 
-	case 215: 
-	case 216: 
-	case 217: 
-	case 218: 
-	case 219: 
-	case 285: 
-#line 181 "src/uri.rl"
-	{ path.end   = p; }
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	break;
-	case 177: 
-	case 178: 
-	case 179: 
-	case 180: 
-	case 181: 
-	case 182: 
-	case 183: 
-	case 184: 
-	case 185: 
-	case 186: 
-	case 187: 
-	case 188: 
-	case 189: 
-	case 190: 
-	case 191: 
-	case 192: 
-	case 265: 
-	case 266: 
-	case 267: 
-	case 268: 
-	case 293: 
-	case 294: 
-	case 295: 
-	case 296: 
-	case 297: 
-	case 298: 
-	case 299: 
-	case 300: 
-	case 301: 
-	case 302: 
-	case 303: 
-	case 304: 
-	case 305: 
-	case 306: 
-	case 307: 
-	case 308: 
-#line 181 "src/uri.rl"
-	{ path.end   = p; }
-#line 167 "src/uri.rl"
-	{ service.end   = p; }
-	break;
-	case 96: 
-#line 163 "src/uri.rl"
-	{ dport.end	 = p; }
-#line 167 "src/uri.rl"
-	{ service.end   = p; }
-#line 177 "src/uri.rl"
-	{ path.end   = p; }
-	break;
-	case 199: 
-	case 200: 
-	case 201: 
-#line 181 "src/uri.rl"
-	{ path.end   = p; }
-#line 145 "src/uri.rl"
-	{ ip4.end   = p; }
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	break;
-	case 260: 
-#line 181 "src/uri.rl"
-	{ path.end   = p; }
-#line 154 "src/uri.rl"
-	{ ip6.end   = p - 1; }
-#line 158 "src/uri.rl"
-	{ host.end     = p; }
-	break;
-	case 176: 
-	case 261: 
-	case 262: 
-	case 263: 
-	case 264: 
-	case 292: 
-#line 181 "src/uri.rl"
-	{ path.end   = p; }
-#line 163 "src/uri.rl"
-	{ dport.end	 = p; }
-#line 167 "src/uri.rl"
-	{ service.end   = p; }
-	break;
-#line 5397 "src/uri.cc"
-	}
-	}
-
-	_out: {}
-	}
-
-#line 198 "src/uri.rl"
-
-
-	(void)uri_first_final;
-	(void)uri_error;
-	(void)uri_en_main;
-
-	if (login.start && login.end && password.start && password.end) {
-		snprintf(uri->login, sizeof(uri->login),
-			 "%.*s", (int) (login.end - login.start), login.start);
-		snprintf(uri->password, sizeof(uri->password),
-			 "%.*s", (int) (password.end - password.start),
-			 password.start);
-	}
-
-	if (path.start && path.end) {
-		struct sockaddr_un *un = (struct sockaddr_un *)&uri->addr;
-		uri->addr_len = sizeof(*un);
-		un->sun_family = AF_UNIX;
-		if (path.end - path.start >= sizeof(un->sun_path))
-			return -1;
-
-		snprintf(un->sun_path, sizeof(un->sun_path),
-			 "%.*s", (int) (path.end - path.start), path.start);
-		snprintf(uri->schema, sizeof(uri->schema), "unix");
-		return 0;
-	}
-
-	if (schema.start && schema.end) {
-		snprintf(uri->schema, sizeof(uri->schema),
-			 "%.*s", (int) (schema.end - schema.start), schema.start);
-	} else {
-		snprintf(uri->schema, sizeof(uri->schema), "tcp");
-	}
-
-
-	/* only port was defined */
-	if (sport.start && sport.end) {
-		struct sockaddr_in *in = (struct sockaddr_in *)&uri->addr;
-		uri->addr_len = sizeof(*in);
-
-		in->sin_family = AF_INET;
-		in->sin_port = htons(port);
-		in->sin_addr.s_addr = INADDR_ANY;
-		return 0;
-	}
-
-
-	if (!(dport.start && dport.end)) {
-		port = 0;
-		if (service.start && service.end) {
-			if (service.end - service.start >= NI_MAXSERV)
-				return -1;
-			char sname[NI_MAXSERV];
-			snprintf(sname, sizeof(sname), "%.*s",
-				 (int) (service.end - service.start),
-                 service.start);
-			struct servent *s = getservbyname(sname, NULL);
-			if (!s)
-				return -1;
-			port = ntohs(s->s_port);
-		}
-	}
-
-
-	/* IPv4 uri */
-	if (ip4.start && ip4.end) {
-		struct sockaddr_in *in =
-			(struct sockaddr_in *)&uri->addr;
-		uri->addr_len = sizeof(*in);
-
-		in->sin_family = AF_INET;
-		in->sin_port = htons(port);
-
-		char sip4[3 * 4 + 3 + 1];
-		memset(sip4, 0, sizeof(sip4));
-		snprintf(sip4, sizeof(sip4), "%.*s", (int) (ip4.end - ip4.start),
-			 ip4.start);
-		if (inet_aton(sip4, &in->sin_addr))
-			return 0;
-		return -1;
-	}
-
-	/* IPv6 uri */
-	if (ip6.start && ip6.end) {
-		struct sockaddr_in6 *in6 =
-			(struct sockaddr_in6 *)&uri->addr;
-		uri->addr_len = sizeof(*in6);
-
-
-		char sip6[8 * 4 + 7 + 1];
-		memset(sip6, 0, sizeof(sip6));
-		snprintf(sip6, sizeof(sip6), "%.*s", (int) (ip6.end - ip6.start),
-			 ip6.start);
-
-		in6->sin6_family = AF_INET6;
-		in6->sin6_port = htonl(port);
-
-		if (inet_pton(AF_INET6, sip6, (void *)&in6->sin6_addr))
-			return 0;
-
-		return -1;
-	}
-
-
-	if (!host.start || !host.end)
-		return -1;
-
-	if (host.end - host.start >= NI_MAXHOST)
-		return -1;
-
-	char shost[NI_MAXHOST];
-	char sservice[NI_MAXSERV];
-	snprintf(shost, sizeof(shost), "%.*s", (int) (host.end - host.start),
-		 host.start);
-	if (service.end) {
-		snprintf(sservice, sizeof(sservice), "%.*s",
-			 (int) (service.end - service.start), service.start);
-	} else {
-		sservice[0] = '\0';
-	}
-
-	struct addrinfo hints, *res;
-	memset(&hints, 0, sizeof(hints));
-	hints.ai_protocol = getprotobyname("tcp")->p_proto;
-
-	if (getaddrinfo(shost, sservice, &hints, &res) != 0)
-		return -1;
-
-	uri->addr_len = res->ai_addrlen;
-	memcpy((void *)&uri->addr, (void *)res->ai_addr, res->ai_addrlen);
-	freeaddrinfo(res);
-	return 0;
-}
-
-/* vim: set ft=ragel: */
diff --git a/src/uri.h b/src/uri.h
index 377b4a3cb0..8bdf34e13d 100644
--- a/src/uri.h
+++ b/src/uri.h
@@ -28,43 +28,47 @@
  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-#include <sys/types.h>		/* for netinet/ip.h on BSD */
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
-#include <netdb.h>
-#include <sys/un.h>
 
-enum { URI_STR_LEN = 32 };
+#include <stddef.h>
+#include <netdb.h> /* NI_MAXHOST, NI_MAXSERV */
+#include <limits.h> /* _POSIX_PATH_MAX */
 
-/** A parsed representation of an URI */
-struct uri {
-
-	union {
-		struct sockaddr addr;
-		struct sockaddr_in in;
-		struct sockaddr_un un;
-		struct sockaddr_in6 in6;
-		struct sockaddr_storage addr_storage;
-	};
-	socklen_t addr_len;
+#if defined(__cplusplus)
+extern "C" {
+#endif /* defined(__cplusplus) */
 
-	char schema[URI_STR_LEN];
-	char login[URI_STR_LEN];
-	char password[URI_STR_LEN];
+struct uri {
+	const char *scheme;
+	size_t scheme_len;
+	const char *login;
+	size_t login_len;
+	const char *password;
+	size_t password_len;
+	const char *host;
+	size_t host_len;
+	const char *service;
+	size_t service_len;
+	const char *path;
+	size_t path_len;
+	const char *query;
+	size_t query_len;
+	const char *fragment;
+	size_t fragment_len;
+	int host_hint;
 };
 
-/**
- * Parse a string and fill uri struct.
- * @retval 0 success
- * @retval -1 error
- */
+#define URI_HOST_UNIX "unix/"
+#define URI_MAXHOST NI_MAXHOST
+#define URI_MAXSERVICE _POSIX_PATH_MAX /* _POSIX_PATH_MAX always > NI_MAXSERV */
+
 int
 uri_parse(struct uri *uri, const char *str);
 
-/** Convert an uri to string */
-const char *
-uri_to_string(const struct uri * uri);
+char *
+uri_format(const struct uri *uri);
 
+#if defined(__cplusplus)
+} /* extern "C" */
+#endif /* defined(__cplusplus) */
 
 #endif /* TARANTOOL_URI_H_INCLUDED */
diff --git a/src/uri.rl b/src/uri.rl
index ddde079ba3..151341bfb1 100644
--- a/src/uri.rl
+++ b/src/uri.rl
@@ -28,305 +28,193 @@
  */
 #include "uri.h"
 #include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#include <sys/socket.h>
-#include <netinet/ip.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/un.h>
-#include <netdb.h>
-
-const char *
-uri_to_string(const struct uri * uri)
-{
-	static __thread char
-		str[NI_MAXSERV + NI_MAXHOST + sizeof(uri->schema)];
-
-	if (!uri || !uri->addr_len) {
-		snprintf(str, sizeof(str), "unknown address");
-		return str;
-	}
-
-	switch (uri->addr.sa_family) {
-	case AF_INET6:
-	case AF_INET:
-	{
-		char shost[NI_MAXHOST];
-		char sservice[NI_MAXSERV];
-		getnameinfo(
-			    (struct sockaddr *)&uri->addr,
-			    uri->addr_len,
-			    shost, sizeof(shost),
-			    sservice, sizeof(sservice),
-			    NI_NUMERICHOST|NI_NUMERICSERV);
-		if (uri->addr.sa_family == AF_INET) {
-			if (strncmp(uri->schema, "tcp", 3) == 0) {
-				snprintf(str, sizeof(str), "%s:%s",
-					 shost, sservice);
-			} else {
-				snprintf(str, sizeof(str), "%s://%s:%s",
-					 uri->schema, shost, sservice);
-			}
-		} else {
-			if (strncmp(uri->schema, "tcp", 3) == 0) {
-				snprintf(str, sizeof(str), "%s:%s",
-					 shost, sservice);
-			} else {
-				snprintf(str, sizeof(str), "%s://[%s]:%s",
-					 uri->schema, shost, sservice);
-			}
-		}
-                break;
-	}
-	case AF_UNIX:
-	{
-		struct sockaddr_un *un =
-			(struct sockaddr_un *)&uri->addr;
-		snprintf(str, sizeof(str), "unix://%.*s",
-			 (int) sizeof(un->sun_path), un->sun_path);
-	        break;
-	}
-	default:
-		snprintf(str, sizeof(str), "unknown address");
-	        break;
-	}
-	return str;
-}
-
+#include <stdio.h> /* snprintf */
 int
 uri_parse(struct uri *uri, const char *p)
 {
-	(void) uri;
 	const char *pe = p + strlen(p);
 	const char *eof = pe;
 	int cs;
 	memset(uri, 0, sizeof(*uri));
 
-	struct {
-		const char *start;
-		const char *end;
-	}	schema		= { 0, 0 },
-		host		= { 0, 0 },
-		service		= { 0, 0 },
-		sport		= { 0, 0 },
-		login		= { 0, 0 },
-		password	= { 0, 0 },
-		ip4		= { 0, 0 },
-		ip6		= { 0, 0 },
-		path		= { 0, 0 },
-		dport		= { 0, 0 }
-	;
-
-	unsigned port = 0;
+	if (p == pe)
+		return -1;
+
+	const char *s = NULL, *login = NULL, *scheme = NULL;
+	size_t login_len = 0, scheme_len = 0;
 
 	%%{
 		machine uri;
 		write data;
 
-		hex1_4 = ([0-9a-fA-F]{1,4});
-
+		#
+		# Line by line translation of RFC3986
+		# http://tools.ietf.org/html/rfc3986#appendix-A
+		#
+
+		gen_delims = (":" | "/" | "?" | "#" | "[" | "]" | "@");
+		sub_delims = ("!" | "$" | "&" | "'" | "(" | ")"
+				 | "*" | "+" | "," | ";" | "=");
+
+		reserved = (gen_delims | sub_delims);
+		unreserved = alpha | digit | "-" | "_" | "~" | ".";
+		pct_encoded = ("%%" | ("%" xdigit xdigit?)
+				   | ("%u" xdigit xdigit xdigit xdigit));
+
+		pchar_nc = unreserved | pct_encoded | sub_delims | "@";
+		pchar = pchar_nc | ":";
+
+		query = (pchar | "/" | "?")*
+			>{ s = p; }
+			%{ uri->query = s; uri->query_len = p - s; };
+
+		fragment = (pchar | "/" | "?")*
+			>{ s = p; }
+			%{ uri->fragment = s; uri->fragment_len = p - s; };
+
+		segment = pchar*;
+		segment_nz = pchar+;
+		segment_nz_nc = pchar_nc+;
+
+		path_abempty  = ( "/" segment )*;
+		path_absolute = ("/" ( segment_nz ( "/" segment )* )?);
+		path_noscheme = (segment_nz_nc ( "/" segment )*);
+		path_rootless = (pchar_nc ( "/" segment )*);
+		path_empty    = "";
+
+		path = path_abempty    # begins with "/" or is empty
+		     | path_absolute   # begins with "/" but not "//"
+		     | path_noscheme   # begins with a non-colon segment
+		     | path_rootless   # begins with a segment
+		     | path_empty;     # zero characters
+
+		reg_name = (unreserved | pct_encoded | sub_delims)+
+			>{ s = p; }
+			%{ uri->host = s; uri->host_len = p - s;};
+
+		hex1_4 = ([0-9a-fa-f]{1,4});
+
+		ip4addr = ((digit{1,3}) (("." digit{1,3}){3}));
+		ip4 = ip4addr
+			>{ s = p; }
+			%{ uri->host = s; uri->host_len = p - s;
+			   uri->host_hint = 1; };
+
+		ip6	= ("[" (
+				((hex1_4?) ((":" (hex1_4?)){1,8})) |
+				("::" [ff][ff][ff][ff] ":" ip4addr))
+			>{ s = p; }
+			%{ uri->host = s; uri->host_len = p - s;
+				   uri->host_hint = 2; }
+			   "]");
+
+		action unix{
+			/*
+			 * This action is also called for path_* terms.
+			 * I absolutely have no idea why.
+			 */
+			if (uri->host_hint != 3) {
+				uri->host_hint = 3;
+				uri->host = URI_HOST_UNIX;
+				uri->host_len = strlen(URI_HOST_UNIX);
+				uri->service = s; uri->service_len = p - s;
+				/* a workaround for grammar limitations */
+				uri->path = NULL;
+				uri->path_len = 0;
+			};
+		}
+		# Non-standard: "unix/" support
+		unix = ("unix/:" %{ s = p;} path) %unix;
 
-		schema		= ((alpha+) "://")
-			>{ schema.start = p; }
-		    %{ schema.end   = p - 3; };
+		service = (digit+ | alpha*)
+			>{ s = p; }
+			%{ uri->service = s; uri->service_len = p - s; };
 
-		login		= (alnum+)
-			>{ login.start  = p; }
-		    %{ login.end    = p; };
+		host =  (ip4 | ip6 | reg_name);
 
-		password	= (alnum+)
-			>{ password.start = p; }
-		    %{ password.end   = p; };
+		login = (unreserved | pct_encoded | sub_delims )+
+			>{ s = p; }
+			%{ login = s; login_len = p - s; };
 
-		ip4	= ((digit{1,3}) (("." digit{1,3}){3}))
-			>{ ip4.start = p; }
-		    %{ ip4.end   = p; };
+		password = (unreserved | pct_encoded | sub_delims )+
+			>{ s = p; }
+			%{ uri->password = s; uri->password_len = p - s; };
 
-		ip4_6	= ("[::" [fF][fF][fF][fF] ":" ip4 "]");
+		# Non-standard: split userinfo to login and password
+		userinfo = login (":" password)?
+			%{ uri->login = login; uri->login_len = login_len; };
 
-		ip6	= ("["
-			   (hex1_4?)
-			   ((":" (hex1_4?)){1,8})
-			   "]")
-			>{ ip6.start = p + 1; }
-		    %{ ip6.end   = p - 1; };
+		# Non-standard: use service instead of port here + support unix
+		authority = (userinfo "@")? ((host (":" service)?) | (unix  ":"));
 
-		host		= (ip4_6 | ip4 | ip6 | ([^:?]+))
-			>{ host.start   = p; }
-		    %{ host.end     = p; };
+		scheme = alpha > { s = p; }
+			 (alpha | digit | "+" | "-" | ".")*
+			%{scheme = s; scheme_len = p - s; };
 
-		dport		= ([1-9] (digit*))
-			>{ dport.start   = p; port = 0; }
-		    ${ port = port * 10 + (int)(*p - '0'); }
-		    %{ dport.end	 = p; };
+		# relative_part = "//" authority > { s  =  p } path_abempty |
+		#	 path_absolute |
+		#	 path_noscheme |
+		#	 path_empty;
 
-		service		= (dport | (alpha{1,16}))
-			>{ service.start = p; }
-		    %{ service.end   = p; };
+		# Non-standard: allow URI without scheme
+		hier_part_noscheme = (((authority %{ s = p; } path_abempty?
+					  | path_absolute?
+					  | path_rootless?
+					  | path_empty?
+				) %{ uri->path = s; uri->path_len = p - s; }) |
+				unix);
 
+		hier_part = "//"
+			>{ uri->scheme = scheme; uri->scheme_len = scheme_len;}
+			hier_part_noscheme;
 
-		port		= ([1-9] digit*)
-			>{ sport.start   = p; port = 0; }
-		    ${ port = port * 10 + (int)(*p - '0'); }
-		    %{ sport.end     = p; };
+		# relative_ref = relative_part ("?" >{ s = p; } query)?
+		#	("#" >{ s = p; } fragment)?;
 
-		abspath		= ("/" any+)
-			>{ path.start = p; }
-		    %{ path.end   = p; };
+		# absolute_URI = scheme ":" hier_part ("?" >{ s = p; } query);
 
-		file		= (any+)
-			>{ path.start = p; }
-		    %{ path.end   = p; };
+		PORT = digit+
+			>{ uri->service = p; }
+			%{ uri->service_len = p - uri->service;
+			   uri->host = NULL; uri->host_len = 0; };
 
+		PATH = ((userinfo "@")? %{ s = p; } path_absolute %unix);
 
-		main := (
-		    ("unix://"
-		      ((login ":" password "@") ?) file) |
+		URI = ((scheme ":" hier_part) | hier_part_noscheme)
+			("?" >{ s = p; } query)? ("#" >{ s = p; } fragment)?;
 
-		     ((schema)?
-			((login ":" password "@")?)
-			host
-			((":" service)?))		    |
+		# Non-RFC: support port and absolute path
+		main := URI | PORT | PATH;
 
-		     port				    |
-		     abspath
-		);
 		write init;
 		write exec;
 	}%%
 
-	(void)uri_first_final;
-	(void)uri_error;
-	(void)uri_en_main;
-
-	if (login.start && login.end && password.start && password.end) {
-		snprintf(uri->login, sizeof(uri->login),
-			 "%.*s", (int) (login.end - login.start), login.start);
-		snprintf(uri->password, sizeof(uri->password),
-			 "%.*s", (int) (password.end - password.start),
-			 password.start);
-	}
-
-	if (path.start && path.end) {
-		struct sockaddr_un *un = (struct sockaddr_un *)&uri->addr;
-		uri->addr_len = sizeof(*un);
-		un->sun_family = AF_UNIX;
-		if (path.end - path.start >= sizeof(un->sun_path))
-			return -1;
-
-		snprintf(un->sun_path, sizeof(un->sun_path),
-			 "%.*s", (int) (path.end - path.start), path.start);
-		snprintf(uri->schema, sizeof(uri->schema), "unix");
-		return 0;
-	}
-
-	if (schema.start && schema.end) {
-		snprintf(uri->schema, sizeof(uri->schema),
-			 "%.*s", (int) (schema.end - schema.start), schema.start);
-	} else {
-		snprintf(uri->schema, sizeof(uri->schema), "tcp");
-	}
-
-
-	/* only port was defined */
-	if (sport.start && sport.end) {
-		struct sockaddr_in *in = (struct sockaddr_in *)&uri->addr;
-		uri->addr_len = sizeof(*in);
-
-		in->sin_family = AF_INET;
-		in->sin_port = htons(port);
-		in->sin_addr.s_addr = INADDR_ANY;
-		return 0;
-	}
-
-
-	if (!(dport.start && dport.end)) {
-		port = 0;
-		if (service.start && service.end) {
-			if (service.end - service.start >= NI_MAXSERV)
-				return -1;
-			char sname[NI_MAXSERV];
-			snprintf(sname, sizeof(sname), "%.*s",
-				 (int) (service.end - service.start),
-                 service.start);
-			struct servent *s = getservbyname(sname, NULL);
-			if (!s)
-				return -1;
-			port = ntohs(s->s_port);
-		}
-	}
-
-
-	/* IPv4 uri */
-	if (ip4.start && ip4.end) {
-		struct sockaddr_in *in =
-			(struct sockaddr_in *)&uri->addr;
-		uri->addr_len = sizeof(*in);
-
-		in->sin_family = AF_INET;
-		in->sin_port = htons(port);
-
-		char sip4[3 * 4 + 3 + 1];
-		memset(sip4, 0, sizeof(sip4));
-		snprintf(sip4, sizeof(sip4), "%.*s", (int) (ip4.end - ip4.start),
-			 ip4.start);
-		if (inet_aton(sip4, &in->sin_addr))
-			return 0;
+	if (uri->path_len == 0)
+		uri->path = NULL;
+	if (uri->service_len == 0)
+		uri->service = NULL;
+	if (uri->service_len >= URI_MAXSERVICE)
 		return -1;
-	}
-
-	/* IPv6 uri */
-	if (ip6.start && ip6.end) {
-		struct sockaddr_in6 *in6 =
-			(struct sockaddr_in6 *)&uri->addr;
-		uri->addr_len = sizeof(*in6);
-
-
-		char sip6[8 * 4 + 7 + 1];
-		memset(sip6, 0, sizeof(sip6));
-		snprintf(sip6, sizeof(sip6), "%.*s", (int) (ip6.end - ip6.start),
-			 ip6.start);
-
-		in6->sin6_family = AF_INET6;
-		in6->sin6_port = htonl(port);
-
-		if (inet_pton(AF_INET6, sip6, (void *)&in6->sin6_addr))
-			return 0;
-
-		return -1;
-	}
-
-
-	if (!host.start || !host.end)
+	if (uri->host_len >= URI_MAXHOST)
 		return -1;
 
-	if (host.end - host.start >= NI_MAXHOST)
-		return -1;
-
-	char shost[NI_MAXHOST];
-	char sservice[NI_MAXSERV];
-	snprintf(shost, sizeof(shost), "%.*s", (int) (host.end - host.start),
-		 host.start);
-	if (service.end) {
-		snprintf(sservice, sizeof(sservice), "%.*s",
-			 (int) (service.end - service.start), service.start);
-	} else {
-		sservice[0] = '\0';
-	}
-
-	struct addrinfo hints, *res;
-	memset(&hints, 0, sizeof(hints));
-	hints.ai_protocol = getprotobyname("tcp")->p_proto;
-
-	if (getaddrinfo(shost, sservice, &hints, &res) != 0)
-		return -1;
+	(void)uri_first_final;
+	(void)uri_error;
+	(void)uri_en_main;
+	(void)eof;
 
-	uri->addr_len = res->ai_addrlen;
-	memcpy((void *)&uri->addr, (void *)res->ai_addr, res->ai_addrlen);
-	freeaddrinfo(res);
-	return 0;
+	return cs >= uri_first_final ? 0 : -1;
 }
 
+char *
+uri_format(const struct uri *uri)
+{
+	static char buf[1024];
+	/* very primitive implementation suitable for our needs */
+	snprintf(buf, sizeof(buf), "%.*s:%.*s",
+		 (int) uri->host_len, uri->host != NULL ? uri->host : "*",
+		 (int) uri->service_len, uri->service);
+	return buf;
+}
 /* vim: set ft=ragel: */
diff --git a/test/app/console.test.lua b/test/app/console.test.lua
index 516d4eb46d..b569dce375 100755
--- a/test/app/console.test.lua
+++ b/test/app/console.test.lua
@@ -12,7 +12,7 @@ os.remove(CONSOLE_SOCKET)
 os.remove(IPROTO_SOCKET)
 
 box.cfg{
-    listen='unix://'..IPROTO_SOCKET;
+    listen=IPROTO_SOCKET;
     slab_alloc_arena=0.1,
     logger="tarantool.log",
 }
diff --git a/test/app/uri.result b/test/app/uri.result
new file mode 100644
index 0000000000..d1ab786691
--- /dev/null
+++ b/test/app/uri.result
@@ -0,0 +1,25 @@
+TAP version 13
+# uri
+1..1
+    # parse
+    1..17
+    ok - scheme
+    ok - login
+    ok - password
+    ok - host
+    ok - service
+    ok - path
+    ok - query
+    ok - fragment
+    ok - ipv4
+    ok - ipv4
+    ok - ipv6
+    ok - ipv6
+    ok - unix
+    ok - unix
+    ok - unix
+    ok - invalid uri
+    ok - invalid uri
+    # parse: end
+ok - parse
+# uri: end
diff --git a/test/app/uri.test.lua b/test/app/uri.test.lua
new file mode 100755
index 0000000000..96f2f7a5e2
--- /dev/null
+++ b/test/app/uri.test.lua
@@ -0,0 +1,46 @@
+#!/usr/bin/env tarantool
+
+local tap = require('tap')
+local uri = require('uri')
+
+local function test_parse(test)
+    -- Tests for uri.parse() Lua bindings.
+    -- Parser itself is tested by test/unit/uri unit test.
+    test:plan(17)
+
+    local u
+
+    u = uri.parse("scheme://login:password@host:service"..
+        "/path1/path2/path3?q1=v1&q2=v2#fragment")
+    test:is(u.scheme, "scheme", "scheme")
+    test:is(u.login, "login", "login")
+    test:is(u.password, "password", "password")
+    test:is(u.host, "host", "host")
+    test:is(u.service, "service", "service")
+    test:is(u.path, "/path1/path2/path3", "path")
+    test:is(u.query, "q1=v1&q2=v2", "query")
+    test:is(u.fragment, "fragment", "fragment")
+
+    u = uri.parse('127.0.0.1')
+    test:is(u.host, '127.0.0.1', 'ipv4')
+    test:is(u.ipv4, '127.0.0.1', 'ipv4')
+
+    u = uri.parse('[2a00:1148:b0ba:2016:12bf:48ff:fe78:fd10]')
+    test:is(u.host, '2a00:1148:b0ba:2016:12bf:48ff:fe78:fd10', 'ipv6')
+    test:is(u.ipv6, '2a00:1148:b0ba:2016:12bf:48ff:fe78:fd10', 'ipv6')
+
+    u = uri.parse('/tmp/unix.sock')
+    test:is(u.host, 'unix/', 'unix')
+    test:is(u.service, '/tmp/unix.sock', 'unix')
+    test:is(u.unix, '/tmp/unix.sock', 'unix')
+
+    u = uri.parse("")
+    test:isnil(u, "invalid uri", u)
+    u = uri.parse("://")
+    test:isnil(u, "invalid uri", u)
+end
+
+tap.test("uri", function(test)
+    test:plan(1)
+    test:test("parse", test_parse)
+end)
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index dc1ae0a776..32306d8db7 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -7,7 +7,7 @@ include_directories(${PROJECT_BINARY_DIR}/src)
 include_directories(${PROJECT_SOURCE_DIR}/src/lib)
 include_directories(${CMAKE_SOURCE_DIR}/third_party)
 add_executable(rlist.test rlist.c test.c ${CMAKE_SOURCE_DIR}/src/lib/salad/rlist.c)
-add_executable(uri.test uri.cc test.c ${CMAKE_SOURCE_DIR}/src/uri.cc)
+add_executable(uri.test uri.c test.c ${CMAKE_SOURCE_DIR}/src/uri.c)
 add_executable(fiob.test test.c fiob.c ${CMAKE_SOURCE_DIR}/src/fiob.c)
 add_executable(queue.test queue.c)
 add_executable(mhash.test mhash.c)
diff --git a/test/unit/uri.c b/test/unit/uri.c
new file mode 100644
index 0000000000..b978a12233
--- /dev/null
+++ b/test/unit/uri.c
@@ -0,0 +1,222 @@
+#include "test.h"
+#include <uri.h>
+#include <string.h>
+
+int
+test(const char *s, const char *scheme, const char *login, const char *password,
+     const char *host, const char *service, const char *path,
+     const char *query, const char *fragment, int host_hint)
+{
+	plan(10);
+
+	struct uri uri;
+	is(uri_parse(&uri, s), 0, "%s: parse", s);
+	/* fprintf(stdout, #key ": %p %d %.*s\n", uri.key,
+	   (int) uri.key ## _len, (int) uri.key ## _len, uri.key); */
+
+#define chk(key) do { \
+	ok((key && uri.key && strlen(key) == uri.key ## _len && \
+	   memcmp(key, uri.key, uri.key ## _len) == 0) || \
+	   (!key && !uri.key), "%s: " #key, s); } while (0);
+
+	chk(scheme);
+	chk(login);
+	chk(password);
+	chk(host);
+	chk(service);
+	chk(path);
+	chk(query);
+	chk(fragment);
+	is(uri.host_hint, host_hint, "%s: host_hint", s);
+
+#undef chk
+	return check_plan();
+}
+
+int
+test_invalid()
+{
+	plan(2);
+
+	/* Invalid */
+	struct uri u;
+	isnt(uri_parse(&u, ""), 0 , "empty is invalid");
+	isnt(uri_parse(&u, "://"), 0 , ":// is invalid");
+
+	return check_plan();
+}
+
+int
+main(void)
+{
+	plan(60);
+
+	/* General */
+	test("host", NULL, NULL, NULL, "host", NULL, NULL, NULL, NULL, 0);
+	test("host/", NULL, NULL, NULL, "host", NULL, "/", NULL, NULL, 0);
+	test("host/path1/path2/path3", NULL, NULL, NULL, "host", NULL,
+	     "/path1/path2/path3", NULL, NULL, 0);
+	test("host/path1/path2/path3?q1=v1&q2=v2#fragment", NULL, NULL,
+	     NULL, "host", NULL, "/path1/path2/path3",
+	     "q1=v1&q2=v2", "fragment", 0);
+
+	test("host:service", NULL, NULL, NULL, "host", "service", NULL, NULL,
+	     NULL, 0);
+
+	test("host:service/", NULL, NULL, NULL, "host", "service", "/", NULL,
+	     NULL, 0);
+
+	test("host:service/path1/path2/path3", NULL, NULL, NULL, "host",
+	     "service", "/path1/path2/path3", NULL, NULL, 0);
+	test("host:service/path1/path2/path3?q1=v1&q2=v2#fragment", NULL, NULL,
+	     NULL, "host", "service", "/path1/path2/path3",
+	     "q1=v1&q2=v2", "fragment", 0);
+
+	test("login@host", NULL, "login", NULL, "host", NULL, NULL, NULL,
+	     NULL, 0);
+	test("login@host/", NULL, "login", NULL, "host", NULL, "/", NULL,
+	     NULL, 0);
+	test("login@host/path1/path2/path3", NULL, "login", NULL, "host", NULL,
+	     "/path1/path2/path3", NULL, NULL, 0);
+	test("login@host/path1/path2/path3?q1=v1&q2=v2#fragment", NULL, "login",
+	     NULL, "host", NULL, "/path1/path2/path3",
+	     "q1=v1&q2=v2", "fragment", 0);
+
+	test("login:password@host", NULL, "login", "password", "host", NULL,
+	     NULL, NULL, NULL, 0);
+	test("login:password@host/", NULL, "login", "password", "host", NULL,
+	     "/", NULL, NULL, 0);
+	test("login:password@host/path1/path2/path3", NULL, "login", "password",
+	     "host", NULL, "/path1/path2/path3", NULL, NULL, 0);
+	test("login:password@host/path1/path2/path3?q1=v1&q2=v2#fragment",
+	     NULL, "login", "password", "host", NULL, "/path1/path2/path3",
+	     "q1=v1&q2=v2", "fragment", 0);
+
+	test("login:password@host:service", NULL, "login", "password", "host",
+	     "service", NULL, NULL, NULL, 0);
+	test("login:password@host:service/", NULL, "login", "password", "host",
+	     "service", "/", NULL, NULL, 0);
+	test("login:password@host:service/path1/path2/path3", NULL, "login",
+	     "password", "host", "service", "/path1/path2/path3", NULL,
+	     NULL, 0);
+	test("login:password@host:service/path1/path2/path3?q1=v1&q2=v2"
+	     "#fragment", NULL, "login", "password", "host", "service",
+	     "/path1/path2/path3", "q1=v1&q2=v2", "fragment", 0);
+
+	test("scheme://login:password@host:service", "scheme", "login",
+	     "password", "host", "service", NULL, NULL, NULL, 0);
+	test("scheme://login:password@host:service/", "scheme", "login",
+	     "password", "host", "service", "/", NULL, NULL, 0);
+	test("scheme://login:password@host:service/path1/path2/path3", "scheme",
+	     "login", "password", "host", "service", "/path1/path2/path3",
+	     NULL, NULL, 0);
+	test("scheme://login:password@host:service/path1/path2/path3?"
+	     "q1=v1&q2=v2#fragment", "scheme", "login", "password", "host",
+	     "service", "/path1/path2/path3", "q1=v1&q2=v2", "fragment", 0);
+
+	test("host/path", NULL, NULL, NULL, "host", NULL, "/path", NULL,
+	     NULL, 0);
+	test("host//", NULL, NULL, NULL, "host", NULL, "//", NULL, NULL, 0);
+	test("host//path", NULL, NULL, NULL, "host", NULL, "//path", NULL,
+	     NULL, 0);
+	test("host/;abc?q", NULL, NULL, NULL, "host", NULL, "/;abc", "q",
+	     NULL, 0);
+
+	test("scheme://login:password@host:service/@path1/:path2?"
+	     "q1=v1&q2=v2#fragment", "scheme", "login", "password", "host",
+	     "service", "/@path1/:path2", "q1=v1&q2=v2", "fragment", 0);
+	test("host/~user", NULL, NULL, NULL, "host", NULL, "/~user", NULL,
+	     NULL, 0);
+
+	/* Host */
+	test("try.tarantool.org", NULL, NULL, NULL, "try.tarantool.org", NULL,
+	     NULL, NULL, NULL, 0);
+
+	test("try.tarantool.org", NULL, NULL, NULL, "try.tarantool.org", NULL,
+	     NULL, NULL, NULL, 0);
+
+	test("www.llanfairpwllgwyngyllgogerychwyrndrobwyll-"
+	     "llantysiliogogogoch.com", NULL, NULL, NULL,
+	     "www.llanfairpwllgwyngyllgogerychwyrndrobwyll-"
+	     "llantysiliogogogoch.com", NULL, NULL, NULL, NULL, 0);
+
+	/* IPv4 / IPv6 addreses */
+	test("0.0.0.0", NULL, NULL, NULL, "0.0.0.0", NULL, NULL, NULL, NULL, 1);
+	test("127.0.0.1", NULL, NULL, NULL, "127.0.0.1", NULL, NULL, NULL,
+	     NULL, 1);
+	test("127.0.0.1:3313", NULL, NULL, NULL, "127.0.0.1", "3313", NULL,
+	     NULL, NULL, 1);
+
+	test("scheme://login:password@127.0.0.1:3313", "scheme", "login",
+	     "password", "127.0.0.1", "3313", NULL, NULL, NULL, 1);
+
+	test("[2001::11a3:09d7::1]", NULL, NULL, NULL, "2001::11a3:09d7::1",
+	     NULL, NULL, NULL, NULL, 2);
+	test("scheme://login:password@[2001::11a3:09d7::1]:3313", "scheme",
+	     "login", "password", "2001::11a3:09d7::1", "3313", NULL, NULL,
+	     NULL, 2);
+	test("scheme://[2001:0db8:11a3:09d7::1]", "scheme", NULL, NULL,
+	     "2001:0db8:11a3:09d7::1", NULL, NULL, NULL, NULL, 2);
+
+	test("[::ffff:11.2.3.4]", NULL, NULL, NULL, "::ffff:11.2.3.4",
+	     NULL, NULL, NULL, NULL, 2);
+	test("scheme://login:password@[::ffff:11.2.3.4]:3313", "scheme",
+	     "login", "password", "::ffff:11.2.3.4", "3313", NULL, NULL,
+	     NULL, 2);
+
+	/* Port */
+	test("1", NULL, NULL, NULL, NULL, "1", NULL, NULL, NULL, 0);
+	test("10", NULL, NULL, NULL, NULL, "10", NULL, NULL, NULL, 0);
+	test("331", NULL, NULL, NULL, NULL, "331", NULL, NULL, NULL,0);
+	test("3313", NULL, NULL, NULL, NULL, "3313", NULL, NULL, NULL, 0);
+
+	/* Unix */
+	test("/", NULL, NULL, NULL, "unix/", "/", NULL, NULL, NULL, 3);
+	test("/path1/path2/path3", NULL, NULL, NULL, "unix/",
+	     "/path1/path2/path3", NULL, NULL, NULL, 3);
+	test("login:password@/path1/path2/path3", NULL, "login", "password",
+	     "unix/", "/path1/path2/path3", NULL, NULL, NULL, 3);
+	test("unix/:/path1/path2/path3", NULL, NULL, NULL, "unix/",
+	     "/path1/path2/path3", NULL, NULL, NULL, 3);
+	test("unix/:/path1/path2/path3:", NULL, NULL, NULL, "unix/",
+	     "/path1/path2/path3", NULL, NULL, NULL, 3);
+	test("unix/:/path1/path2/path3:/", NULL, NULL, NULL, "unix/",
+	     "/path1/path2/path3", "/", NULL, NULL, 3);
+	test("unix/:/path1/path2/path3?q1=v1&q2=v2#fragment", NULL, NULL, NULL,
+	     "unix/", "/path1/path2/path3", NULL, "q1=v1&q2=v2", "fragment", 3);
+	test("unix/:/path1/path2/path3:/p1/p2?q1=v1&q2=v2#fragment",
+	     NULL, NULL, NULL, "unix/", "/path1/path2/path3", "/p1/p2",
+	     "q1=v1&q2=v2", "fragment", 3);
+#if 0
+	/* Broken due to grammar limitations. */
+	test("login:password@unix/:/path1/path2/path3", NULL, "login",
+	     "password", "unix/", "/path1/path2/path3", NULL, NULL, NULL, 3);
+#endif
+	test("scheme://login:password@unix/:/tmp/unix.sock:/path1/path2/path3",
+	     "scheme", "login", "password", "unix/", "/tmp/unix.sock",
+	     "/path1/path2/path3", NULL, NULL, 3);
+	test("unix/:./relative/path.sock:/test", NULL, NULL, NULL, "unix/",
+	     "./relative/path.sock", "/test", NULL, NULL, 3);
+	test("scheme://unix/:./relative/path.sock:/test", "scheme", NULL, NULL,
+	     "unix/", "./relative/path.sock", "/test", NULL, NULL, 3);
+
+	/* Web */
+	test("http://tarantool.org/dist/master/debian/pool/main/t/tarantool/"
+	     "tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz",
+	     "http", NULL, NULL, "tarantool.org", NULL,
+	     "/dist/master/debian/pool/main/t/tarantool/"
+	     "tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz",
+	     NULL, NULL, 0);
+
+	test("https://www.google.com/search?"
+	     "safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool"
+	     "&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl",
+	     "https", NULL, NULL, "www.google.com", NULL, "/search",
+	     "safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool"
+	     "&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl",
+	     NULL, 0);
+
+	test_invalid();
+
+	return check_plan();
+}
diff --git a/test/unit/uri.cc b/test/unit/uri.cc
deleted file mode 100644
index d07b410c77..0000000000
--- a/test/unit/uri.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-#include "test.h"
-#include <uri.h>
-#include <string.h>
-
-#define PLAN	40
-
-int
-main(void)
-{
-	plan(PLAN);
-
-	struct uri uri;
-
-	is(uri_parse(&uri, "/file"), 0, "/file");
-	is(strcmp(uri_to_string(&uri), "unix:///file"), 0,
-				"to_string");
-	is(strcmp(uri.schema, "unix"), 0, "unix://");
-
-
-	is(uri_parse(&uri, "unix://file"), 0, "unix://file");
-	is(strcmp(uri_to_string(&uri), "unix://file"), 0,
-							"to_string");
-	is(strcmp(uri.schema, "unix"), 0, "unix://");
-
-
-	is(uri_parse(&uri, "123"), 0, "123");
-	is(strcmp(uri.schema, "tcp"), 0, "tcp://");
-	is(strcmp(uri_to_string(&uri), "0.0.0.0:123"), 0,
-		"to_string");
-
-
-
-	is(uri_parse(&uri, "http://11.2.3.4:123"), 0,
-		"http://11.2.3.4:123");
-	is(strcmp(uri.schema, "http"), 0, "http://");
-	is(strcmp(uri_to_string(&uri), "http://11.2.3.4:123"), 0,
-		"to_string");
-
-	is(uri_parse(&uri, "http://[::fFff:11.2.3.4]:123"), 0,
-		"http://11.2.3.4:123");
-	is(strcmp(uri.schema, "http"), 0, "http://");
-	is(strcmp(uri_to_string(&uri), "http://11.2.3.4:123"), 0,
-		"to_string");
-	is(uri_parse(&uri, "http://user:pass@127.0.0.1:12345"), 0,
-		"http://user:pass@127.0.0.1:12345");
-	is(strcmp(uri.login, "user"), 0, "user");
-	is(strcmp(uri.password, "pass"), 0, "pass");
-	is(strcmp(uri.schema, "http"), 0, "http");
-
-
-	is(uri_parse(&uri, "schema://[2001:0db8:11a3:09d7::1]"),
-	   0, "schema://[2001:0db8:11a3:09d7::1]");
-	is(strcmp(uri_to_string(&uri),
-		"schema://[2001:db8:11a3:9d7::1]:0"), 0, "to_string");
-
-
-	isnt(uri_parse(&uri, "schema://[2001::11a3:09d7::1]"),
-	     0, "invalid schema://[2001::11a3:09d7::1]");
-
-
-
-
-	is(uri_parse(&uri, "128.0.0.1"), 0, "127.0.0.1");
-	is(strcmp(uri_to_string(&uri), "128.0.0.1:0"), 0,
-		"to_string");
-
-	is(uri_parse(&uri, "128.0.0.1:22"), 0, "127.0.0.1:22");
-	is(strcmp(uri_to_string(&uri), "128.0.0.1:22"), 0,
-		"to_string");
-
-	is(uri_parse(&uri, "login:password@127.0.0.1"), 0,
-	   "login:password@127.0.0.1");
-	is(strcmp(uri.login, "login"), 0, "login");
-	is(strcmp(uri.password, "password"), 0, "password");
-	is(strcmp(uri.schema, "tcp"), 0, "default schema");
-
-	is(uri_parse(&uri, "unix://login:password@/path/to"), 0,
-	   "unix://login:password@/path/to");
-	is(strcmp(uri.login, "login"), 0, "login");
-	is(strcmp(uri.password, "password"), 0, "password");
-	is(strcmp(uri.schema, "unix"), 0, "unix");
-	is(strcmp(uri_to_string(&uri), "unix:///path/to"), 0,
-		"to_string");
-
-	isnt(uri_parse(&uri, "tcp://abc.cde:90"), 0, "invalid uri");
-
-	is(uri_parse(&uri, "http://127.0.0.1:http"), 0,
-	   "valid uri");
-	is(strcmp(uri_to_string(&uri), "http://127.0.0.1:80"), 0,
-	   "service to port number");
-
-	is(uri_parse(&uri, "mail.ru:https"), 0, "valid uri");
-
-	isnt(strstr(uri_to_string(&uri), ":443"), 0,
-		"service converted");
-
-	return check_plan();
-}
diff --git a/test/unit/uri.result b/test/unit/uri.result
index 751cc2083c..7218a95036 100644
--- a/test/unit/uri.result
+++ b/test/unit/uri.result
@@ -1,41 +1,713 @@
-1..40
-ok 1 - /file
-ok 2 - to_string
-ok 3 - unix://
-ok 4 - unix://file
-ok 5 - to_string
-ok 6 - unix://
-ok 7 - 123
-ok 8 - tcp://
-ok 9 - to_string
-ok 10 - http://11.2.3.4:123
-ok 11 - http://
-ok 12 - to_string
-ok 13 - http://11.2.3.4:123
-ok 14 - http://
-ok 15 - to_string
-ok 16 - http://user:pass@127.0.0.1:12345
-ok 17 - user
-ok 18 - pass
-ok 19 - http
-ok 20 - schema://[2001:0db8:11a3:09d7::1]
-ok 21 - to_string
-ok 22 - invalid schema://[2001::11a3:09d7::1]
-ok 23 - 127.0.0.1
-ok 24 - to_string
-ok 25 - 127.0.0.1:22
-ok 26 - to_string
-ok 27 - login:password@127.0.0.1
-ok 28 - login
-ok 29 - password
-ok 30 - default schema
-ok 31 - unix://login:password@/path/to
-ok 32 - login
-ok 33 - password
-ok 34 - unix
-ok 35 - to_string
-ok 36 - invalid uri
-ok 37 - valid uri
-ok 38 - service to port number
-ok 39 - valid uri
-ok 40 - service converted
+1..60
+    1..10
+    ok 1 - host: parse
+    ok 2 - host: scheme
+    ok 3 - host: login
+    ok 4 - host: password
+    ok 5 - host: host
+    ok 6 - host: service
+    ok 7 - host: path
+    ok 8 - host: query
+    ok 9 - host: fragment
+    ok 10 - host: host_hint
+ok 1 - subtests
+    1..10
+    ok 1 - host/: parse
+    ok 2 - host/: scheme
+    ok 3 - host/: login
+    ok 4 - host/: password
+    ok 5 - host/: host
+    ok 6 - host/: service
+    ok 7 - host/: path
+    ok 8 - host/: query
+    ok 9 - host/: fragment
+    ok 10 - host/: host_hint
+ok 2 - subtests
+    1..10
+    ok 1 - host/path1/path2/path3: parse
+    ok 2 - host/path1/path2/path3: scheme
+    ok 3 - host/path1/path2/path3: login
+    ok 4 - host/path1/path2/path3: password
+    ok 5 - host/path1/path2/path3: host
+    ok 6 - host/path1/path2/path3: service
+    ok 7 - host/path1/path2/path3: path
+    ok 8 - host/path1/path2/path3: query
+    ok 9 - host/path1/path2/path3: fragment
+    ok 10 - host/path1/path2/path3: host_hint
+ok 3 - subtests
+    1..10
+    ok 1 - host/path1/path2/path3?q1=v1&q2=v2#fragment: parse
+    ok 2 - host/path1/path2/path3?q1=v1&q2=v2#fragment: scheme
+    ok 3 - host/path1/path2/path3?q1=v1&q2=v2#fragment: login
+    ok 4 - host/path1/path2/path3?q1=v1&q2=v2#fragment: password
+    ok 5 - host/path1/path2/path3?q1=v1&q2=v2#fragment: host
+    ok 6 - host/path1/path2/path3?q1=v1&q2=v2#fragment: service
+    ok 7 - host/path1/path2/path3?q1=v1&q2=v2#fragment: path
+    ok 8 - host/path1/path2/path3?q1=v1&q2=v2#fragment: query
+    ok 9 - host/path1/path2/path3?q1=v1&q2=v2#fragment: fragment
+    ok 10 - host/path1/path2/path3?q1=v1&q2=v2#fragment: host_hint
+ok 4 - subtests
+    1..10
+    ok 1 - host:service: parse
+    ok 2 - host:service: scheme
+    ok 3 - host:service: login
+    ok 4 - host:service: password
+    ok 5 - host:service: host
+    ok 6 - host:service: service
+    ok 7 - host:service: path
+    ok 8 - host:service: query
+    ok 9 - host:service: fragment
+    ok 10 - host:service: host_hint
+ok 5 - subtests
+    1..10
+    ok 1 - host:service/: parse
+    ok 2 - host:service/: scheme
+    ok 3 - host:service/: login
+    ok 4 - host:service/: password
+    ok 5 - host:service/: host
+    ok 6 - host:service/: service
+    ok 7 - host:service/: path
+    ok 8 - host:service/: query
+    ok 9 - host:service/: fragment
+    ok 10 - host:service/: host_hint
+ok 6 - subtests
+    1..10
+    ok 1 - host:service/path1/path2/path3: parse
+    ok 2 - host:service/path1/path2/path3: scheme
+    ok 3 - host:service/path1/path2/path3: login
+    ok 4 - host:service/path1/path2/path3: password
+    ok 5 - host:service/path1/path2/path3: host
+    ok 6 - host:service/path1/path2/path3: service
+    ok 7 - host:service/path1/path2/path3: path
+    ok 8 - host:service/path1/path2/path3: query
+    ok 9 - host:service/path1/path2/path3: fragment
+    ok 10 - host:service/path1/path2/path3: host_hint
+ok 7 - subtests
+    1..10
+    ok 1 - host:service/path1/path2/path3?q1=v1&q2=v2#fragment: parse
+    ok 2 - host:service/path1/path2/path3?q1=v1&q2=v2#fragment: scheme
+    ok 3 - host:service/path1/path2/path3?q1=v1&q2=v2#fragment: login
+    ok 4 - host:service/path1/path2/path3?q1=v1&q2=v2#fragment: password
+    ok 5 - host:service/path1/path2/path3?q1=v1&q2=v2#fragment: host
+    ok 6 - host:service/path1/path2/path3?q1=v1&q2=v2#fragment: service
+    ok 7 - host:service/path1/path2/path3?q1=v1&q2=v2#fragment: path
+    ok 8 - host:service/path1/path2/path3?q1=v1&q2=v2#fragment: query
+    ok 9 - host:service/path1/path2/path3?q1=v1&q2=v2#fragment: fragment
+    ok 10 - host:service/path1/path2/path3?q1=v1&q2=v2#fragment: host_hint
+ok 8 - subtests
+    1..10
+    ok 1 - login@host: parse
+    ok 2 - login@host: scheme
+    ok 3 - login@host: login
+    ok 4 - login@host: password
+    ok 5 - login@host: host
+    ok 6 - login@host: service
+    ok 7 - login@host: path
+    ok 8 - login@host: query
+    ok 9 - login@host: fragment
+    ok 10 - login@host: host_hint
+ok 9 - subtests
+    1..10
+    ok 1 - login@host/: parse
+    ok 2 - login@host/: scheme
+    ok 3 - login@host/: login
+    ok 4 - login@host/: password
+    ok 5 - login@host/: host
+    ok 6 - login@host/: service
+    ok 7 - login@host/: path
+    ok 8 - login@host/: query
+    ok 9 - login@host/: fragment
+    ok 10 - login@host/: host_hint
+ok 10 - subtests
+    1..10
+    ok 1 - login@host/path1/path2/path3: parse
+    ok 2 - login@host/path1/path2/path3: scheme
+    ok 3 - login@host/path1/path2/path3: login
+    ok 4 - login@host/path1/path2/path3: password
+    ok 5 - login@host/path1/path2/path3: host
+    ok 6 - login@host/path1/path2/path3: service
+    ok 7 - login@host/path1/path2/path3: path
+    ok 8 - login@host/path1/path2/path3: query
+    ok 9 - login@host/path1/path2/path3: fragment
+    ok 10 - login@host/path1/path2/path3: host_hint
+ok 11 - subtests
+    1..10
+    ok 1 - login@host/path1/path2/path3?q1=v1&q2=v2#fragment: parse
+    ok 2 - login@host/path1/path2/path3?q1=v1&q2=v2#fragment: scheme
+    ok 3 - login@host/path1/path2/path3?q1=v1&q2=v2#fragment: login
+    ok 4 - login@host/path1/path2/path3?q1=v1&q2=v2#fragment: password
+    ok 5 - login@host/path1/path2/path3?q1=v1&q2=v2#fragment: host
+    ok 6 - login@host/path1/path2/path3?q1=v1&q2=v2#fragment: service
+    ok 7 - login@host/path1/path2/path3?q1=v1&q2=v2#fragment: path
+    ok 8 - login@host/path1/path2/path3?q1=v1&q2=v2#fragment: query
+    ok 9 - login@host/path1/path2/path3?q1=v1&q2=v2#fragment: fragment
+    ok 10 - login@host/path1/path2/path3?q1=v1&q2=v2#fragment: host_hint
+ok 12 - subtests
+    1..10
+    ok 1 - login:password@host: parse
+    ok 2 - login:password@host: scheme
+    ok 3 - login:password@host: login
+    ok 4 - login:password@host: password
+    ok 5 - login:password@host: host
+    ok 6 - login:password@host: service
+    ok 7 - login:password@host: path
+    ok 8 - login:password@host: query
+    ok 9 - login:password@host: fragment
+    ok 10 - login:password@host: host_hint
+ok 13 - subtests
+    1..10
+    ok 1 - login:password@host/: parse
+    ok 2 - login:password@host/: scheme
+    ok 3 - login:password@host/: login
+    ok 4 - login:password@host/: password
+    ok 5 - login:password@host/: host
+    ok 6 - login:password@host/: service
+    ok 7 - login:password@host/: path
+    ok 8 - login:password@host/: query
+    ok 9 - login:password@host/: fragment
+    ok 10 - login:password@host/: host_hint
+ok 14 - subtests
+    1..10
+    ok 1 - login:password@host/path1/path2/path3: parse
+    ok 2 - login:password@host/path1/path2/path3: scheme
+    ok 3 - login:password@host/path1/path2/path3: login
+    ok 4 - login:password@host/path1/path2/path3: password
+    ok 5 - login:password@host/path1/path2/path3: host
+    ok 6 - login:password@host/path1/path2/path3: service
+    ok 7 - login:password@host/path1/path2/path3: path
+    ok 8 - login:password@host/path1/path2/path3: query
+    ok 9 - login:password@host/path1/path2/path3: fragment
+    ok 10 - login:password@host/path1/path2/path3: host_hint
+ok 15 - subtests
+    1..10
+    ok 1 - login:password@host/path1/path2/path3?q1=v1&q2=v2#fragment: parse
+    ok 2 - login:password@host/path1/path2/path3?q1=v1&q2=v2#fragment: scheme
+    ok 3 - login:password@host/path1/path2/path3?q1=v1&q2=v2#fragment: login
+    ok 4 - login:password@host/path1/path2/path3?q1=v1&q2=v2#fragment: password
+    ok 5 - login:password@host/path1/path2/path3?q1=v1&q2=v2#fragment: host
+    ok 6 - login:password@host/path1/path2/path3?q1=v1&q2=v2#fragment: service
+    ok 7 - login:password@host/path1/path2/path3?q1=v1&q2=v2#fragment: path
+    ok 8 - login:password@host/path1/path2/path3?q1=v1&q2=v2#fragment: query
+    ok 9 - login:password@host/path1/path2/path3?q1=v1&q2=v2#fragment: fragment
+    ok 10 - login:password@host/path1/path2/path3?q1=v1&q2=v2#fragment: host_hint
+ok 16 - subtests
+    1..10
+    ok 1 - login:password@host:service: parse
+    ok 2 - login:password@host:service: scheme
+    ok 3 - login:password@host:service: login
+    ok 4 - login:password@host:service: password
+    ok 5 - login:password@host:service: host
+    ok 6 - login:password@host:service: service
+    ok 7 - login:password@host:service: path
+    ok 8 - login:password@host:service: query
+    ok 9 - login:password@host:service: fragment
+    ok 10 - login:password@host:service: host_hint
+ok 17 - subtests
+    1..10
+    ok 1 - login:password@host:service/: parse
+    ok 2 - login:password@host:service/: scheme
+    ok 3 - login:password@host:service/: login
+    ok 4 - login:password@host:service/: password
+    ok 5 - login:password@host:service/: host
+    ok 6 - login:password@host:service/: service
+    ok 7 - login:password@host:service/: path
+    ok 8 - login:password@host:service/: query
+    ok 9 - login:password@host:service/: fragment
+    ok 10 - login:password@host:service/: host_hint
+ok 18 - subtests
+    1..10
+    ok 1 - login:password@host:service/path1/path2/path3: parse
+    ok 2 - login:password@host:service/path1/path2/path3: scheme
+    ok 3 - login:password@host:service/path1/path2/path3: login
+    ok 4 - login:password@host:service/path1/path2/path3: password
+    ok 5 - login:password@host:service/path1/path2/path3: host
+    ok 6 - login:password@host:service/path1/path2/path3: service
+    ok 7 - login:password@host:service/path1/path2/path3: path
+    ok 8 - login:password@host:service/path1/path2/path3: query
+    ok 9 - login:password@host:service/path1/path2/path3: fragment
+    ok 10 - login:password@host:service/path1/path2/path3: host_hint
+ok 19 - subtests
+    1..10
+    ok 1 - login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: parse
+    ok 2 - login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: scheme
+    ok 3 - login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: login
+    ok 4 - login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: password
+    ok 5 - login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: host
+    ok 6 - login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: service
+    ok 7 - login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: path
+    ok 8 - login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: query
+    ok 9 - login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: fragment
+    ok 10 - login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: host_hint
+ok 20 - subtests
+    1..10
+    ok 1 - scheme://login:password@host:service: parse
+    ok 2 - scheme://login:password@host:service: scheme
+    ok 3 - scheme://login:password@host:service: login
+    ok 4 - scheme://login:password@host:service: password
+    ok 5 - scheme://login:password@host:service: host
+    ok 6 - scheme://login:password@host:service: service
+    ok 7 - scheme://login:password@host:service: path
+    ok 8 - scheme://login:password@host:service: query
+    ok 9 - scheme://login:password@host:service: fragment
+    ok 10 - scheme://login:password@host:service: host_hint
+ok 21 - subtests
+    1..10
+    ok 1 - scheme://login:password@host:service/: parse
+    ok 2 - scheme://login:password@host:service/: scheme
+    ok 3 - scheme://login:password@host:service/: login
+    ok 4 - scheme://login:password@host:service/: password
+    ok 5 - scheme://login:password@host:service/: host
+    ok 6 - scheme://login:password@host:service/: service
+    ok 7 - scheme://login:password@host:service/: path
+    ok 8 - scheme://login:password@host:service/: query
+    ok 9 - scheme://login:password@host:service/: fragment
+    ok 10 - scheme://login:password@host:service/: host_hint
+ok 22 - subtests
+    1..10
+    ok 1 - scheme://login:password@host:service/path1/path2/path3: parse
+    ok 2 - scheme://login:password@host:service/path1/path2/path3: scheme
+    ok 3 - scheme://login:password@host:service/path1/path2/path3: login
+    ok 4 - scheme://login:password@host:service/path1/path2/path3: password
+    ok 5 - scheme://login:password@host:service/path1/path2/path3: host
+    ok 6 - scheme://login:password@host:service/path1/path2/path3: service
+    ok 7 - scheme://login:password@host:service/path1/path2/path3: path
+    ok 8 - scheme://login:password@host:service/path1/path2/path3: query
+    ok 9 - scheme://login:password@host:service/path1/path2/path3: fragment
+    ok 10 - scheme://login:password@host:service/path1/path2/path3: host_hint
+ok 23 - subtests
+    1..10
+    ok 1 - scheme://login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: parse
+    ok 2 - scheme://login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: scheme
+    ok 3 - scheme://login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: login
+    ok 4 - scheme://login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: password
+    ok 5 - scheme://login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: host
+    ok 6 - scheme://login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: service
+    ok 7 - scheme://login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: path
+    ok 8 - scheme://login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: query
+    ok 9 - scheme://login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: fragment
+    ok 10 - scheme://login:password@host:service/path1/path2/path3?q1=v1&q2=v2#fragment: host_hint
+ok 24 - subtests
+    1..10
+    ok 1 - host/path: parse
+    ok 2 - host/path: scheme
+    ok 3 - host/path: login
+    ok 4 - host/path: password
+    ok 5 - host/path: host
+    ok 6 - host/path: service
+    ok 7 - host/path: path
+    ok 8 - host/path: query
+    ok 9 - host/path: fragment
+    ok 10 - host/path: host_hint
+ok 25 - subtests
+    1..10
+    ok 1 - host//: parse
+    ok 2 - host//: scheme
+    ok 3 - host//: login
+    ok 4 - host//: password
+    ok 5 - host//: host
+    ok 6 - host//: service
+    ok 7 - host//: path
+    ok 8 - host//: query
+    ok 9 - host//: fragment
+    ok 10 - host//: host_hint
+ok 26 - subtests
+    1..10
+    ok 1 - host//path: parse
+    ok 2 - host//path: scheme
+    ok 3 - host//path: login
+    ok 4 - host//path: password
+    ok 5 - host//path: host
+    ok 6 - host//path: service
+    ok 7 - host//path: path
+    ok 8 - host//path: query
+    ok 9 - host//path: fragment
+    ok 10 - host//path: host_hint
+ok 27 - subtests
+    1..10
+    ok 1 - host/;abc?q: parse
+    ok 2 - host/;abc?q: scheme
+    ok 3 - host/;abc?q: login
+    ok 4 - host/;abc?q: password
+    ok 5 - host/;abc?q: host
+    ok 6 - host/;abc?q: service
+    ok 7 - host/;abc?q: path
+    ok 8 - host/;abc?q: query
+    ok 9 - host/;abc?q: fragment
+    ok 10 - host/;abc?q: host_hint
+ok 28 - subtests
+    1..10
+    ok 1 - scheme://login:password@host:service/@path1/:path2?q1=v1&q2=v2#fragment: parse
+    ok 2 - scheme://login:password@host:service/@path1/:path2?q1=v1&q2=v2#fragment: scheme
+    ok 3 - scheme://login:password@host:service/@path1/:path2?q1=v1&q2=v2#fragment: login
+    ok 4 - scheme://login:password@host:service/@path1/:path2?q1=v1&q2=v2#fragment: password
+    ok 5 - scheme://login:password@host:service/@path1/:path2?q1=v1&q2=v2#fragment: host
+    ok 6 - scheme://login:password@host:service/@path1/:path2?q1=v1&q2=v2#fragment: service
+    ok 7 - scheme://login:password@host:service/@path1/:path2?q1=v1&q2=v2#fragment: path
+    ok 8 - scheme://login:password@host:service/@path1/:path2?q1=v1&q2=v2#fragment: query
+    ok 9 - scheme://login:password@host:service/@path1/:path2?q1=v1&q2=v2#fragment: fragment
+    ok 10 - scheme://login:password@host:service/@path1/:path2?q1=v1&q2=v2#fragment: host_hint
+ok 29 - subtests
+    1..10
+    ok 1 - host/~user: parse
+    ok 2 - host/~user: scheme
+    ok 3 - host/~user: login
+    ok 4 - host/~user: password
+    ok 5 - host/~user: host
+    ok 6 - host/~user: service
+    ok 7 - host/~user: path
+    ok 8 - host/~user: query
+    ok 9 - host/~user: fragment
+    ok 10 - host/~user: host_hint
+ok 30 - subtests
+    1..10
+    ok 1 - try.tarantool.org: parse
+    ok 2 - try.tarantool.org: scheme
+    ok 3 - try.tarantool.org: login
+    ok 4 - try.tarantool.org: password
+    ok 5 - try.tarantool.org: host
+    ok 6 - try.tarantool.org: service
+    ok 7 - try.tarantool.org: path
+    ok 8 - try.tarantool.org: query
+    ok 9 - try.tarantool.org: fragment
+    ok 10 - try.tarantool.org: host_hint
+ok 31 - subtests
+    1..10
+    ok 1 - try.tarantool.org: parse
+    ok 2 - try.tarantool.org: scheme
+    ok 3 - try.tarantool.org: login
+    ok 4 - try.tarantool.org: password
+    ok 5 - try.tarantool.org: host
+    ok 6 - try.tarantool.org: service
+    ok 7 - try.tarantool.org: path
+    ok 8 - try.tarantool.org: query
+    ok 9 - try.tarantool.org: fragment
+    ok 10 - try.tarantool.org: host_hint
+ok 32 - subtests
+    1..10
+    ok 1 - www.llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch.com: parse
+    ok 2 - www.llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch.com: scheme
+    ok 3 - www.llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch.com: login
+    ok 4 - www.llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch.com: password
+    ok 5 - www.llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch.com: host
+    ok 6 - www.llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch.com: service
+    ok 7 - www.llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch.com: path
+    ok 8 - www.llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch.com: query
+    ok 9 - www.llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch.com: fragment
+    ok 10 - www.llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch.com: host_hint
+ok 33 - subtests
+    1..10
+    ok 1 - 0.0.0.0: parse
+    ok 2 - 0.0.0.0: scheme
+    ok 3 - 0.0.0.0: login
+    ok 4 - 0.0.0.0: password
+    ok 5 - 0.0.0.0: host
+    ok 6 - 0.0.0.0: service
+    ok 7 - 0.0.0.0: path
+    ok 8 - 0.0.0.0: query
+    ok 9 - 0.0.0.0: fragment
+    ok 10 - 0.0.0.0: host_hint
+ok 34 - subtests
+    1..10
+    ok 1 - 127.0.0.1: parse
+    ok 2 - 127.0.0.1: scheme
+    ok 3 - 127.0.0.1: login
+    ok 4 - 127.0.0.1: password
+    ok 5 - 127.0.0.1: host
+    ok 6 - 127.0.0.1: service
+    ok 7 - 127.0.0.1: path
+    ok 8 - 127.0.0.1: query
+    ok 9 - 127.0.0.1: fragment
+    ok 10 - 127.0.0.1: host_hint
+ok 35 - subtests
+    1..10
+    ok 1 - 127.0.0.1:3313: parse
+    ok 2 - 127.0.0.1:3313: scheme
+    ok 3 - 127.0.0.1:3313: login
+    ok 4 - 127.0.0.1:3313: password
+    ok 5 - 127.0.0.1:3313: host
+    ok 6 - 127.0.0.1:3313: service
+    ok 7 - 127.0.0.1:3313: path
+    ok 8 - 127.0.0.1:3313: query
+    ok 9 - 127.0.0.1:3313: fragment
+    ok 10 - 127.0.0.1:3313: host_hint
+ok 36 - subtests
+    1..10
+    ok 1 - scheme://login:password@127.0.0.1:3313: parse
+    ok 2 - scheme://login:password@127.0.0.1:3313: scheme
+    ok 3 - scheme://login:password@127.0.0.1:3313: login
+    ok 4 - scheme://login:password@127.0.0.1:3313: password
+    ok 5 - scheme://login:password@127.0.0.1:3313: host
+    ok 6 - scheme://login:password@127.0.0.1:3313: service
+    ok 7 - scheme://login:password@127.0.0.1:3313: path
+    ok 8 - scheme://login:password@127.0.0.1:3313: query
+    ok 9 - scheme://login:password@127.0.0.1:3313: fragment
+    ok 10 - scheme://login:password@127.0.0.1:3313: host_hint
+ok 37 - subtests
+    1..10
+    ok 1 - [2001::11a3:09d7::1]: parse
+    ok 2 - [2001::11a3:09d7::1]: scheme
+    ok 3 - [2001::11a3:09d7::1]: login
+    ok 4 - [2001::11a3:09d7::1]: password
+    ok 5 - [2001::11a3:09d7::1]: host
+    ok 6 - [2001::11a3:09d7::1]: service
+    ok 7 - [2001::11a3:09d7::1]: path
+    ok 8 - [2001::11a3:09d7::1]: query
+    ok 9 - [2001::11a3:09d7::1]: fragment
+    ok 10 - [2001::11a3:09d7::1]: host_hint
+ok 38 - subtests
+    1..10
+    ok 1 - scheme://login:password@[2001::11a3:09d7::1]:3313: parse
+    ok 2 - scheme://login:password@[2001::11a3:09d7::1]:3313: scheme
+    ok 3 - scheme://login:password@[2001::11a3:09d7::1]:3313: login
+    ok 4 - scheme://login:password@[2001::11a3:09d7::1]:3313: password
+    ok 5 - scheme://login:password@[2001::11a3:09d7::1]:3313: host
+    ok 6 - scheme://login:password@[2001::11a3:09d7::1]:3313: service
+    ok 7 - scheme://login:password@[2001::11a3:09d7::1]:3313: path
+    ok 8 - scheme://login:password@[2001::11a3:09d7::1]:3313: query
+    ok 9 - scheme://login:password@[2001::11a3:09d7::1]:3313: fragment
+    ok 10 - scheme://login:password@[2001::11a3:09d7::1]:3313: host_hint
+ok 39 - subtests
+    1..10
+    ok 1 - scheme://[2001:0db8:11a3:09d7::1]: parse
+    ok 2 - scheme://[2001:0db8:11a3:09d7::1]: scheme
+    ok 3 - scheme://[2001:0db8:11a3:09d7::1]: login
+    ok 4 - scheme://[2001:0db8:11a3:09d7::1]: password
+    ok 5 - scheme://[2001:0db8:11a3:09d7::1]: host
+    ok 6 - scheme://[2001:0db8:11a3:09d7::1]: service
+    ok 7 - scheme://[2001:0db8:11a3:09d7::1]: path
+    ok 8 - scheme://[2001:0db8:11a3:09d7::1]: query
+    ok 9 - scheme://[2001:0db8:11a3:09d7::1]: fragment
+    ok 10 - scheme://[2001:0db8:11a3:09d7::1]: host_hint
+ok 40 - subtests
+    1..10
+    ok 1 - [::ffff:11.2.3.4]: parse
+    ok 2 - [::ffff:11.2.3.4]: scheme
+    ok 3 - [::ffff:11.2.3.4]: login
+    ok 4 - [::ffff:11.2.3.4]: password
+    ok 5 - [::ffff:11.2.3.4]: host
+    ok 6 - [::ffff:11.2.3.4]: service
+    ok 7 - [::ffff:11.2.3.4]: path
+    ok 8 - [::ffff:11.2.3.4]: query
+    ok 9 - [::ffff:11.2.3.4]: fragment
+    ok 10 - [::ffff:11.2.3.4]: host_hint
+ok 41 - subtests
+    1..10
+    ok 1 - scheme://login:password@[::ffff:11.2.3.4]:3313: parse
+    ok 2 - scheme://login:password@[::ffff:11.2.3.4]:3313: scheme
+    ok 3 - scheme://login:password@[::ffff:11.2.3.4]:3313: login
+    ok 4 - scheme://login:password@[::ffff:11.2.3.4]:3313: password
+    ok 5 - scheme://login:password@[::ffff:11.2.3.4]:3313: host
+    ok 6 - scheme://login:password@[::ffff:11.2.3.4]:3313: service
+    ok 7 - scheme://login:password@[::ffff:11.2.3.4]:3313: path
+    ok 8 - scheme://login:password@[::ffff:11.2.3.4]:3313: query
+    ok 9 - scheme://login:password@[::ffff:11.2.3.4]:3313: fragment
+    ok 10 - scheme://login:password@[::ffff:11.2.3.4]:3313: host_hint
+ok 42 - subtests
+    1..10
+    ok 1 - 1: parse
+    ok 2 - 1: scheme
+    ok 3 - 1: login
+    ok 4 - 1: password
+    ok 5 - 1: host
+    ok 6 - 1: service
+    ok 7 - 1: path
+    ok 8 - 1: query
+    ok 9 - 1: fragment
+    ok 10 - 1: host_hint
+ok 43 - subtests
+    1..10
+    ok 1 - 10: parse
+    ok 2 - 10: scheme
+    ok 3 - 10: login
+    ok 4 - 10: password
+    ok 5 - 10: host
+    ok 6 - 10: service
+    ok 7 - 10: path
+    ok 8 - 10: query
+    ok 9 - 10: fragment
+    ok 10 - 10: host_hint
+ok 44 - subtests
+    1..10
+    ok 1 - 331: parse
+    ok 2 - 331: scheme
+    ok 3 - 331: login
+    ok 4 - 331: password
+    ok 5 - 331: host
+    ok 6 - 331: service
+    ok 7 - 331: path
+    ok 8 - 331: query
+    ok 9 - 331: fragment
+    ok 10 - 331: host_hint
+ok 45 - subtests
+    1..10
+    ok 1 - 3313: parse
+    ok 2 - 3313: scheme
+    ok 3 - 3313: login
+    ok 4 - 3313: password
+    ok 5 - 3313: host
+    ok 6 - 3313: service
+    ok 7 - 3313: path
+    ok 8 - 3313: query
+    ok 9 - 3313: fragment
+    ok 10 - 3313: host_hint
+ok 46 - subtests
+    1..10
+    ok 1 - /: parse
+    ok 2 - /: scheme
+    ok 3 - /: login
+    ok 4 - /: password
+    ok 5 - /: host
+    ok 6 - /: service
+    ok 7 - /: path
+    ok 8 - /: query
+    ok 9 - /: fragment
+    ok 10 - /: host_hint
+ok 47 - subtests
+    1..10
+    ok 1 - /path1/path2/path3: parse
+    ok 2 - /path1/path2/path3: scheme
+    ok 3 - /path1/path2/path3: login
+    ok 4 - /path1/path2/path3: password
+    ok 5 - /path1/path2/path3: host
+    ok 6 - /path1/path2/path3: service
+    ok 7 - /path1/path2/path3: path
+    ok 8 - /path1/path2/path3: query
+    ok 9 - /path1/path2/path3: fragment
+    ok 10 - /path1/path2/path3: host_hint
+ok 48 - subtests
+    1..10
+    ok 1 - login:password@/path1/path2/path3: parse
+    ok 2 - login:password@/path1/path2/path3: scheme
+    ok 3 - login:password@/path1/path2/path3: login
+    ok 4 - login:password@/path1/path2/path3: password
+    ok 5 - login:password@/path1/path2/path3: host
+    ok 6 - login:password@/path1/path2/path3: service
+    ok 7 - login:password@/path1/path2/path3: path
+    ok 8 - login:password@/path1/path2/path3: query
+    ok 9 - login:password@/path1/path2/path3: fragment
+    ok 10 - login:password@/path1/path2/path3: host_hint
+ok 49 - subtests
+    1..10
+    ok 1 - unix/:/path1/path2/path3: parse
+    ok 2 - unix/:/path1/path2/path3: scheme
+    ok 3 - unix/:/path1/path2/path3: login
+    ok 4 - unix/:/path1/path2/path3: password
+    ok 5 - unix/:/path1/path2/path3: host
+    ok 6 - unix/:/path1/path2/path3: service
+    ok 7 - unix/:/path1/path2/path3: path
+    ok 8 - unix/:/path1/path2/path3: query
+    ok 9 - unix/:/path1/path2/path3: fragment
+    ok 10 - unix/:/path1/path2/path3: host_hint
+ok 50 - subtests
+    1..10
+    ok 1 - unix/:/path1/path2/path3:: parse
+    ok 2 - unix/:/path1/path2/path3:: scheme
+    ok 3 - unix/:/path1/path2/path3:: login
+    ok 4 - unix/:/path1/path2/path3:: password
+    ok 5 - unix/:/path1/path2/path3:: host
+    ok 6 - unix/:/path1/path2/path3:: service
+    ok 7 - unix/:/path1/path2/path3:: path
+    ok 8 - unix/:/path1/path2/path3:: query
+    ok 9 - unix/:/path1/path2/path3:: fragment
+    ok 10 - unix/:/path1/path2/path3:: host_hint
+ok 51 - subtests
+    1..10
+    ok 1 - unix/:/path1/path2/path3:/: parse
+    ok 2 - unix/:/path1/path2/path3:/: scheme
+    ok 3 - unix/:/path1/path2/path3:/: login
+    ok 4 - unix/:/path1/path2/path3:/: password
+    ok 5 - unix/:/path1/path2/path3:/: host
+    ok 6 - unix/:/path1/path2/path3:/: service
+    ok 7 - unix/:/path1/path2/path3:/: path
+    ok 8 - unix/:/path1/path2/path3:/: query
+    ok 9 - unix/:/path1/path2/path3:/: fragment
+    ok 10 - unix/:/path1/path2/path3:/: host_hint
+ok 52 - subtests
+    1..10
+    ok 1 - unix/:/path1/path2/path3?q1=v1&q2=v2#fragment: parse
+    ok 2 - unix/:/path1/path2/path3?q1=v1&q2=v2#fragment: scheme
+    ok 3 - unix/:/path1/path2/path3?q1=v1&q2=v2#fragment: login
+    ok 4 - unix/:/path1/path2/path3?q1=v1&q2=v2#fragment: password
+    ok 5 - unix/:/path1/path2/path3?q1=v1&q2=v2#fragment: host
+    ok 6 - unix/:/path1/path2/path3?q1=v1&q2=v2#fragment: service
+    ok 7 - unix/:/path1/path2/path3?q1=v1&q2=v2#fragment: path
+    ok 8 - unix/:/path1/path2/path3?q1=v1&q2=v2#fragment: query
+    ok 9 - unix/:/path1/path2/path3?q1=v1&q2=v2#fragment: fragment
+    ok 10 - unix/:/path1/path2/path3?q1=v1&q2=v2#fragment: host_hint
+ok 53 - subtests
+    1..10
+    ok 1 - unix/:/path1/path2/path3:/p1/p2?q1=v1&q2=v2#fragment: parse
+    ok 2 - unix/:/path1/path2/path3:/p1/p2?q1=v1&q2=v2#fragment: scheme
+    ok 3 - unix/:/path1/path2/path3:/p1/p2?q1=v1&q2=v2#fragment: login
+    ok 4 - unix/:/path1/path2/path3:/p1/p2?q1=v1&q2=v2#fragment: password
+    ok 5 - unix/:/path1/path2/path3:/p1/p2?q1=v1&q2=v2#fragment: host
+    ok 6 - unix/:/path1/path2/path3:/p1/p2?q1=v1&q2=v2#fragment: service
+    ok 7 - unix/:/path1/path2/path3:/p1/p2?q1=v1&q2=v2#fragment: path
+    ok 8 - unix/:/path1/path2/path3:/p1/p2?q1=v1&q2=v2#fragment: query
+    ok 9 - unix/:/path1/path2/path3:/p1/p2?q1=v1&q2=v2#fragment: fragment
+    ok 10 - unix/:/path1/path2/path3:/p1/p2?q1=v1&q2=v2#fragment: host_hint
+ok 54 - subtests
+    1..10
+    ok 1 - scheme://login:password@unix/:/tmp/unix.sock:/path1/path2/path3: parse
+    ok 2 - scheme://login:password@unix/:/tmp/unix.sock:/path1/path2/path3: scheme
+    ok 3 - scheme://login:password@unix/:/tmp/unix.sock:/path1/path2/path3: login
+    ok 4 - scheme://login:password@unix/:/tmp/unix.sock:/path1/path2/path3: password
+    ok 5 - scheme://login:password@unix/:/tmp/unix.sock:/path1/path2/path3: host
+    ok 6 - scheme://login:password@unix/:/tmp/unix.sock:/path1/path2/path3: service
+    ok 7 - scheme://login:password@unix/:/tmp/unix.sock:/path1/path2/path3: path
+    ok 8 - scheme://login:password@unix/:/tmp/unix.sock:/path1/path2/path3: query
+    ok 9 - scheme://login:password@unix/:/tmp/unix.sock:/path1/path2/path3: fragment
+    ok 10 - scheme://login:password@unix/:/tmp/unix.sock:/path1/path2/path3: host_hint
+ok 55 - subtests
+    1..10
+    ok 1 - unix/:./relative/path.sock:/test: parse
+    ok 2 - unix/:./relative/path.sock:/test: scheme
+    ok 3 - unix/:./relative/path.sock:/test: login
+    ok 4 - unix/:./relative/path.sock:/test: password
+    ok 5 - unix/:./relative/path.sock:/test: host
+    ok 6 - unix/:./relative/path.sock:/test: service
+    ok 7 - unix/:./relative/path.sock:/test: path
+    ok 8 - unix/:./relative/path.sock:/test: query
+    ok 9 - unix/:./relative/path.sock:/test: fragment
+    ok 10 - unix/:./relative/path.sock:/test: host_hint
+ok 56 - subtests
+    1..10
+    ok 1 - scheme://unix/:./relative/path.sock:/test: parse
+    ok 2 - scheme://unix/:./relative/path.sock:/test: scheme
+    ok 3 - scheme://unix/:./relative/path.sock:/test: login
+    ok 4 - scheme://unix/:./relative/path.sock:/test: password
+    ok 5 - scheme://unix/:./relative/path.sock:/test: host
+    ok 6 - scheme://unix/:./relative/path.sock:/test: service
+    ok 7 - scheme://unix/:./relative/path.sock:/test: path
+    ok 8 - scheme://unix/:./relative/path.sock:/test: query
+    ok 9 - scheme://unix/:./relative/path.sock:/test: fragment
+    ok 10 - scheme://unix/:./relative/path.sock:/test: host_hint
+ok 57 - subtests
+    1..10
+    ok 1 - http://tarantool.org/dist/master/debian/pool/main/t/tarantool/tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz: parse
+    ok 2 - http://tarantool.org/dist/master/debian/pool/main/t/tarantool/tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz: scheme
+    ok 3 - http://tarantool.org/dist/master/debian/pool/main/t/tarantool/tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz: login
+    ok 4 - http://tarantool.org/dist/master/debian/pool/main/t/tarantool/tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz: password
+    ok 5 - http://tarantool.org/dist/master/debian/pool/main/t/tarantool/tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz: host
+    ok 6 - http://tarantool.org/dist/master/debian/pool/main/t/tarantool/tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz: service
+    ok 7 - http://tarantool.org/dist/master/debian/pool/main/t/tarantool/tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz: path
+    ok 8 - http://tarantool.org/dist/master/debian/pool/main/t/tarantool/tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz: query
+    ok 9 - http://tarantool.org/dist/master/debian/pool/main/t/tarantool/tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz: fragment
+    ok 10 - http://tarantool.org/dist/master/debian/pool/main/t/tarantool/tarantool_1.6.3+314+g91066ee+20140910+1434.orig.tar.gz: host_hint
+ok 58 - subtests
+    1..10
+    ok 1 - https://www.google.com/search?safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl: parse
+    ok 2 - https://www.google.com/search?safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl: scheme
+    ok 3 - https://www.google.com/search?safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl: login
+    ok 4 - https://www.google.com/search?safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl: password
+    ok 5 - https://www.google.com/search?safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl: host
+    ok 6 - https://www.google.com/search?safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl: service
+    ok 7 - https://www.google.com/search?safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl: path
+    ok 8 - https://www.google.com/search?safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl: query
+    ok 9 - https://www.google.com/search?safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl: fragment
+    ok 10 - https://www.google.com/search?safe=off&site=&tbm=isch&source=hp&biw=1918&bih=1109&q=Tarantool&oq=Tarantool&gs_l=img.3..0i24l3j0i10i24j0i24&gws_rd=ssl: host_hint
+ok 59 - subtests
+    1..2
+    ok 1 - empty is invalid
+    ok 2 - :// is invalid
+ok 60 - subtests
-- 
GitLab