static ngx_int_t
ngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u)
{
#if (NGX_HAVE_UNIX_DOMAIN)
    u_char              *path, *uri, *last;
    size_t               len;
    struct sockaddr_un  *saun;
    len = u->url.len;
    path = u->url.data;
    path += 5;
    len -= 5;
    if (u->uri_part) {
        last = path + len;
        uri = ngx_strlchr(path, last, ':');
        if (uri) {
            len = uri - path;
            uri++;
            u->uri.len = last - uri;
            u->uri.data = uri;
        }
    }
    if (len == 0) {
        u->err = "no path in the unix domain socket";
        return NGX_ERROR;
    }
    u->host.len = len++;
    u->host.data = path;
    if (len > sizeof(saun->sun_path)) {
        u->err = "too long path in the unix domain socket";
        return NGX_ERROR;
    }
    u->socklen = sizeof(struct sockaddr_un);
    saun = (struct sockaddr_un *) &u->sockaddr;
    saun->sun_family = AF_UNIX;
    (void) ngx_cpystrn((u_char *) saun->sun_path, path, len);
    u->addrs = ngx_pcalloc(pool, sizeof(ngx_peer_addr_t));
    if (u->addrs == NULL) {
        return NGX_ERROR;
    }
    saun = ngx_pcalloc(pool, sizeof(struct sockaddr_un));
    if (saun == NULL) {
        return NGX_ERROR;
    }
    u->family = AF_UNIX;
    u->naddrs = 1;
    saun->sun_family = AF_UNIX;
    (void) ngx_cpystrn((u_char *) saun->sun_path, path, len);
    u->addrs[0].sockaddr = (struct sockaddr *) saun;
    u->addrs[0].socklen = sizeof(struct sockaddr_un);
    u->addrs[0].name.len = len + 4;
    u->addrs[0].name.data = u->url.data;
    return NGX_OK;
#else
    u->err = "the unix domain sockets are not supported on this platform";
    return NGX_ERROR;
#endif
}
['static char *\nngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)\n{\n    ngx_http_fastcgi_loc_conf_t *flcf = conf;\n    ngx_url_t                   u;\n    ngx_str_t                  *value, *url;\n    ngx_uint_t                  n;\n    ngx_http_core_loc_conf_t   *clcf;\n    ngx_http_script_compile_t   sc;\n    if (flcf->upstream.upstream || flcf->fastcgi_lengths) {\n        return "is duplicate";\n    }\n    clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);\n    clcf->handler = ngx_http_fastcgi_handler;\n    value = cf->args->elts;\n    url = &value[1];\n    n = ngx_http_script_variables_count(url);\n    if (n) {\n        ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));\n        sc.cf = cf;\n        sc.source = url;\n        sc.lengths = &flcf->fastcgi_lengths;\n        sc.values = &flcf->fastcgi_values;\n        sc.variables = n;\n        sc.complete_lengths = 1;\n        sc.complete_values = 1;\n        if (ngx_http_script_compile(&sc) != NGX_OK) {\n            return NGX_CONF_ERROR;\n        }\n        return NGX_CONF_OK;\n    }\n    ngx_memzero(&u, sizeof(ngx_url_t));\n    u.url = value[1];\n    u.no_resolve = 1;\n    flcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0);\n    if (flcf->upstream.upstream == NULL) {\n        return NGX_CONF_ERROR;\n    }\n    if (clcf->name.data[clcf->name.len - 1] == \'/\') {\n        clcf->auto_redirect = 1;\n    }\n    return NGX_CONF_OK;\n}', 'ngx_http_upstream_srv_conf_t *\nngx_http_upstream_add(ngx_conf_t *cf, ngx_url_t *u, ngx_uint_t flags)\n{\n    ngx_uint_t                      i;\n    ngx_http_upstream_server_t     *us;\n    ngx_http_upstream_srv_conf_t   *uscf, **uscfp;\n    ngx_http_upstream_main_conf_t  *umcf;\n    if (!(flags & NGX_HTTP_UPSTREAM_CREATE)) {\n        if (ngx_parse_url(cf->pool, u) != NGX_OK) {\n            if (u->err) {\n                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,\n                                   "%s in upstream \\"%V\\"", u->err, &u->url);\n            }\n            return NULL;\n        }\n    }\n    umcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_upstream_module);\n    uscfp = umcf->upstreams.elts;\n    for (i = 0; i < umcf->upstreams.nelts; i++) {\n        if (uscfp[i]->host.len != u->host.len\n            || ngx_strncasecmp(uscfp[i]->host.data, u->host.data, u->host.len)\n               != 0)\n        {\n            continue;\n        }\n        if ((flags & NGX_HTTP_UPSTREAM_CREATE)\n             && (uscfp[i]->flags & NGX_HTTP_UPSTREAM_CREATE))\n        {\n            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,\n                               "duplicate upstream \\"%V\\"", &u->host);\n            return NULL;\n        }\n        if ((uscfp[i]->flags & NGX_HTTP_UPSTREAM_CREATE) && u->port) {\n            ngx_conf_log_error(NGX_LOG_WARN, cf, 0,\n                               "upstream \\"%V\\" may not have port %d",\n                               &u->host, u->port);\n            return NULL;\n        }\n        if ((flags & NGX_HTTP_UPSTREAM_CREATE) && uscfp[i]->port) {\n            ngx_log_error(NGX_LOG_WARN, cf->log, 0,\n                          "upstream \\"%V\\" may not have port %d in %s:%ui",\n                          &u->host, uscfp[i]->port,\n                          uscfp[i]->file_name, uscfp[i]->line);\n            return NULL;\n        }\n        if (uscfp[i]->port != u->port) {\n            continue;\n        }\n        if (uscfp[i]->default_port && u->default_port\n            && uscfp[i]->default_port != u->default_port)\n        {\n            continue;\n        }\n        return uscfp[i];\n    }\n    uscf = ngx_pcalloc(cf->pool, sizeof(ngx_http_upstream_srv_conf_t));\n    if (uscf == NULL) {\n        return NULL;\n    }\n    uscf->flags = flags;\n    uscf->host = u->host;\n    uscf->file_name = cf->conf_file->file.name.data;\n    uscf->line = cf->conf_file->line;\n    uscf->port = u->port;\n    uscf->default_port = u->default_port;\n    if (u->naddrs == 1) {\n        uscf->servers = ngx_array_create(cf->pool, 1,\n                                         sizeof(ngx_http_upstream_server_t));\n        if (uscf->servers == NULL) {\n            return NGX_CONF_ERROR;\n        }\n        us = ngx_array_push(uscf->servers);\n        if (us == NULL) {\n            return NGX_CONF_ERROR;\n        }\n        ngx_memzero(us, sizeof(ngx_http_upstream_server_t));\n        us->addrs = u->addrs;\n        us->naddrs = u->naddrs;\n    }\n    uscfp = ngx_array_push(&umcf->upstreams);\n    if (uscfp == NULL) {\n        return NULL;\n    }\n    *uscfp = uscf;\n    return uscf;\n}', 'ngx_int_t\nngx_parse_url(ngx_pool_t *pool, ngx_url_t *u)\n{\n    u_char  *p;\n    p = u->url.data;\n    if (ngx_strncasecmp(p, (u_char *) "unix:", 5) == 0) {\n        return ngx_parse_unix_domain_url(pool, u);\n    }\n    if ((p[0] == \':\' || p[0] == \'/\') && !u->listen) {\n        u->err = "invalid host";\n        return NGX_ERROR;\n    }\n    if (p[0] == \'[\') {\n        return ngx_parse_inet6_url(pool, u);\n    }\n    return ngx_parse_inet_url(pool, u);\n}', 'static ngx_int_t\nngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u)\n{\n#if (NGX_HAVE_UNIX_DOMAIN)\n    u_char              *path, *uri, *last;\n    size_t               len;\n    struct sockaddr_un  *saun;\n    len = u->url.len;\n    path = u->url.data;\n    path += 5;\n    len -= 5;\n    if (u->uri_part) {\n        last = path + len;\n        uri = ngx_strlchr(path, last, \':\');\n        if (uri) {\n            len = uri - path;\n            uri++;\n            u->uri.len = last - uri;\n            u->uri.data = uri;\n        }\n    }\n    if (len == 0) {\n        u->err = "no path in the unix domain socket";\n        return NGX_ERROR;\n    }\n    u->host.len = len++;\n    u->host.data = path;\n    if (len > sizeof(saun->sun_path)) {\n        u->err = "too long path in the unix domain socket";\n        return NGX_ERROR;\n    }\n    u->socklen = sizeof(struct sockaddr_un);\n    saun = (struct sockaddr_un *) &u->sockaddr;\n    saun->sun_family = AF_UNIX;\n    (void) ngx_cpystrn((u_char *) saun->sun_path, path, len);\n    u->addrs = ngx_pcalloc(pool, sizeof(ngx_peer_addr_t));\n    if (u->addrs == NULL) {\n        return NGX_ERROR;\n    }\n    saun = ngx_pcalloc(pool, sizeof(struct sockaddr_un));\n    if (saun == NULL) {\n        return NGX_ERROR;\n    }\n    u->family = AF_UNIX;\n    u->naddrs = 1;\n    saun->sun_family = AF_UNIX;\n    (void) ngx_cpystrn((u_char *) saun->sun_path, path, len);\n    u->addrs[0].sockaddr = (struct sockaddr *) saun;\n    u->addrs[0].socklen = sizeof(struct sockaddr_un);\n    u->addrs[0].name.len = len + 4;\n    u->addrs[0].name.data = u->url.data;\n    return NGX_OK;\n#else\n    u->err = "the unix domain sockets are not supported on this platform";\n    return NGX_ERROR;\n#endif\n}']