> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# url_* 会话设置

> 位于 url_* 自动生成分组中的 ClickHouse 会话设置。

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  return <div className="not-prose" style={{
    display: "flex",
    flexWrap: "wrap",
    alignItems: "baseline",
    columnGap: "0.5rem",
    rowGap: "0.125rem",
    margin: "0.375rem 0",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <div style={{
    fontWeight: 600,
    opacity: 0.72
  }}>类型</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>默认值</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          无需重启即可更改
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

这些设置可在 [system.settings](/docs/zh/reference/system-tables/settings) 中查看，并由 [源代码](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) 自动生成。

<div id="url_base">
  ## url\_base
</div>

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.5"},{"label": ""},{"label": "新增设置，用于在 url 表函数和 URL 表引擎中指定解析相对 URL 时使用的 base URL。"}]}]} />

在 [url](/docs/zh/reference/functions/table-functions/url) 表函数和 [URL](/docs/zh/reference/engines/table-engines/special/url) 表引擎中，用于解析相对 URL 的 base URL。

设置后，相对 URL 将按以下方式解析：

* 路径相对 URL (例如 `data.csv`) ：按照 RFC 3986 与 base URL 的路径合并。base 路径中最后一个 `/` 之后的所有内容都会被相对 URL 替换，因此末尾是否带斜杠很重要：`https://example.com/dir/` + `data.csv` = `https://example.com/dir/data.csv`，而 `https://example.com/dir` + `data.csv` = `https://example.com/data.csv`。如果 base URL 不包含路径 (例如 `https://example.com`) ，则会插入一个 `/`：`https://example.com/data.csv`。相对 URL 中的点分段 (`./` 和 `../`) 会被归一化：`https://example.com/dir/` + `../a.csv` = `https://example.com/a.csv`。
* 主机相对 URL (例如 `/test/data.csv`) ：根据 base URL 的 scheme 和 host 进行解析。
* scheme 相对 URL (例如 `//other.com/test/data.csv`) ：使用 base URL 的 scheme 进行解析。
* 仅查询引用 (例如 `?x=1`) ：追加到 base URL 的路径后 (替换现有的查询字符串/片段) 。
* 仅片段引用 (例如 `#frag`) ：追加到 base URL 后，并保留查询字符串 (替换现有片段) 。
* 空引用：返回不带片段的 base URL。

例如，如果 `url_base` 为 `https://example.com/def/`，则：

* `data.csv` 解析为 `https://example.com/def/data.csv`
* `/test/data.csv` 解析为 `https://example.com/test/data.csv`
* `//other.com/test/data.csv` 解析为 `https://other.com/test/data.csv`

<div id="url_wildcard_max_directories_to_read">
  ## url\_wildcard\_max\_directories\_to\_read
</div>

<SettingsInfoBlock type="UInt64" default_value="100000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.7"},{"label": "100000"},{"label": "新增设置：限制在 `url` 表函数中展开通配符时可读取的目录数量。"}]}]} />

从索引页展开 URL 通配符时，最多可遍历的目录数量。
