struct addrinfo hint, *rai, *iai;
/* scan the uri */
- tail = strchr(spec, '/');
+ tail = strchrnul(spec, '/');
service = strchr(spec, ':');
if (tail == NULL || service == NULL || tail < service) {
errno = EINVAL;
memset(&hint, 0, sizeof hint);
hint.ai_family = AF_INET;
hint.ai_socktype = SOCK_STREAM;
+ if (server) {
+ hint.ai_flags = AI_PASSIVE;
+ if (host[0] == 0 || (host[0] == '*' && host[1] == 0))
+ host = NULL;
+ }
rc = getaddrinfo(host, service, &hint, &rai);
if (rc != 0) {
errno = EINVAL;
{
int offset;
const char *api;
+ struct entry *entry;
- get_entry(uri, &offset);
+ entry = get_entry(uri, &offset);
uri += offset;
+ uri += (entry->type == Type_Unix && *uri == '@');
api = strstr(uri, as_api);
if (api)
api += sizeof as_api - 1;