> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-detect-table-modification.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# http_* 会话设置

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

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["版本", "默认值", "注释"];
  const border = "1px solid rgba(128, 128, 128, 0.3)";
  const cell = {
    border,
    padding: "0.25rem 0.5rem",
    textAlign: "start",
    verticalAlign: "top"
  };
  return <details className="not-prose" style={{
    border,
    borderRadius: "0.5rem",
    margin: "0.5rem 0",
    padding: "0.5rem 0.75rem",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <summary style={{
    cursor: "pointer",
    fontWeight: 600,
    opacity: 0.72
  }}>
        版本历史
      </summary>
      <table style={{
    borderCollapse: "collapse",
    width: "100%",
    margin: "0.5rem 0 0"
  }}>
        <thead>
          <tr>
            {headers.map(header => <th key={header} style={{
    ...cell,
    fontWeight: 600,
    opacity: 0.72
  }}>
                {header}
              </th>)}
          </tr>
        </thead>
        <tbody>
          {rows.map((row, row_index) => <tr key={row.id ?? row_index}>
              {(row.items ?? []).map((item, item_index) => <td key={item_index} style={{
    ...cell,
    overflowWrap: "anywhere"
  }}>
                  {item?.label}
                </td>)}
            </tr>)}
        </tbody>
      </table>
    </details>;
};

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](/zh/reference/system-tables/settings) 中查看，并由 [源代码](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) 自动生成。

<div id="http_allow_database_as_path">
  ## http\_allow\_database\_as\_path
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.8"},{"label": "0"},{"label": "新增设置：识别 HTTP 请求 URL 路径中的数据库名称。"}]}]} />

启用后，HTTP 接口会识别 URL 路径中的 `/database/` 组件，并将其用作当前数据库。

这是一个按用户生效的设置，用于控制是否解析已路由的路径式请求。路由本身由服务器级配置设置 `http_allow_path_requests` 全局控制 (默认关闭) 。必须启用该设置，HTTP 接口才能将路径式请求 (例如 `/my_db/my_table.csv`) 路由到查询处理程序。由于路由决策在请求完成身份验证之前作出，因此不能依赖按用户生效的设置。`http_allow_path_requests` 关闭时，未知路径会返回普通的 `404`。路由后，会根据已通过身份验证用户的有效设置再次检查此设置，因此可针对特定用户、角色或 profile 选择性启用。

<div id="http_allow_filters_as_path">
  ## http\_allow\_filters\_as\_path
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.8"},{"label": "0"},{"label": "新增设置，用于识别 HTTP 请求 URL 路径中 Hive 风格的 `name=value` 过滤器。"}]}]} />

启用后，HTTP 接口会识别路径中的 `/name=value/` 组件 (Hive 分区风格) ，并将其转换为以 AND 组合的过滤器。还会识别运算符 `>`、`<`、`>=`、`<=`、`!=`、`<>`。

与 [`http_allow_database_as_path`](/zh/reference/settings/session-settings/http#http_allow_database_as_path) 一样，这是按用户设置；路径式请求的路由由服务器级配置设置 `http_allow_path_requests` 全局控制 (路由发生在身份验证之前) 。

<div id="http_allow_filters_as_unrecognized_url_parameters">
  ## http\_allow\_filters\_as\_unrecognized\_url\_parameters
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.8"},{"label": "0"},{"label": "新增设置：将 HTTP 请求中无法识别的 URL 参数视为过滤表达式。"}]}]} />

启用后，任何未被识别为已知参数、设置或以 `param_*` 为前缀的 URL 参数，都会被视为过滤器，并使用 AND 组合。支持以下两种形式：

* 普通的 `name=value` 会转换为等值比较 `` `name` = 'value' `` (标识符使用反引号，值会作为字符串字面量加引号) 。
* 使用比较运算符 (`!=`、`>`、`<`、`>=`、`<=`、`<>`) 时，会将其视为比较表达式：运算符可以跨参数拆分 (`?a!=2`、`?a>=2`) ，也可以在 URL 中没有可用于拆分的 `=` 时以内联形式编写 (`?a<>2`、`?f(x)>3`) ；此时，重新组合的 `name[=value]` 会被解析为完整的 SQL 表达式。

<div id="http_allow_table_as_file">
  ## http\_allow\_table\_as\_file
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.8"},{"label": "0"},{"label": "新增设置：识别 HTTP 请求 URL 路径中的表名，支持可选的格式\/压缩扩展名。"}]}]} />

启用后，HTTP 接口会将 URL 路径的最后一个组件识别为表名，其形式可以是 `table`、`table.format` 或 `table.format.compression`。该路径会被解释为 `SELECT * FROM table`。

与 [`http_allow_database_as_path`](/zh/reference/settings/session-settings/http#http_allow_database_as_path) 一样，这是一个按用户生效的设置；路径式请求的路由在全局范围内受服务器级配置设置 `http_allow_path_requests` 控制 (路由发生在身份验证之前) 。

<div id="http_connection_timeout">
  ## http\_connection\_timeout
</div>

<SettingsInfoBlock type="Seconds" default_value="1" />

HTTP 连接超时时间 (以秒为单位) 。

可能的值：

* 任意正整数。
* 0 - 禁用 (超时时间为无限) 。

<div id="http_make_head_request">
  ## http\_make\_head\_request
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

`http_make_head_request` 设置允许在通过 HTTP 读取数据时执行 `HEAD` 请求，以获取待读取文件的信息，例如文件大小。该设置默认启用，因此如果服务器不支持 `HEAD` 请求，可能需要将其禁用。

<div id="http_native_compression_disable_checksumming_on_decompress">
  ## http\_native\_compression\_disable\_checksumming\_on\_decompress
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

启用或禁用在解压来自客户端的 HTTP POST 数据时进行校验和检查。仅适用于 ClickHouse 原生压缩格式 (不用于 `gzip` 或 `deflate`) 。

如需了解更多信息，请参阅 [HTTP 接口说明](/zh/concepts/features/interfaces/http)。

可能的值：

* 0 — 禁用。
* 1 — 启用。

<div id="http_receive_timeout">
  ## http\_receive\_timeout
</div>

<SettingsInfoBlock type="Seconds" default_value="30" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.6"},{"label": "30"},{"label": "请参见 http_send_timeout。"}]}]} />

HTTP 接收超时时间 (秒) 。

可能的取值：

* 任意正整数 (秒) 。`0` **不是**无限超时，且可能导致连接建立失败 (POSIX 套接字超时要求正时间间隔) 。

<div id="http_send_timeout">
  ## http\_send\_timeout
</div>

<SettingsInfoBlock type="Seconds" default_value="30" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.6"},{"label": "30"},{"label": "3 分钟似乎长得离谱。请注意，这是单次网络写入调用的超时时间，而不是整个上传操作的超时时间。"}]}]} />

HTTP 发送超时时间 (以秒为单位) 。

可能的值：

* 任何正整数 (秒) 。`0` **不是**无限超时时间，且可能导致连接建立失败 (POSIX 套接字超时时间要求使用正时间间隔) 。

<Note>
  仅适用于 default profile。更改生效需要重启 server。
</Note>

<div id="http_skip_not_found_url_for_globs">
  ## http\_skip\_not\_found\_url\_for\_globs
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

跳过返回 HTTP\_NOT\_FOUND 错误的通配符 URL

<div id="http_wait_end_of_query">
  ## http\_wait\_end\_of\_query
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

启用服务器端 HTTP 响应缓冲。

<div id="http_write_exception_in_output_format">
  ## http\_write\_exception\_in\_output\_format
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.11"},{"label": "0"},{"label": "为保持各格式之间的一致性而更改"}]}, {"id": "row-2","items": [{"label": "23.9"},{"label": "1"},{"label": "在 HTTP streaming 中发生异常时输出有效的 JSON/XML。"}]}]} />

将异常按输出格式写出，以生成有效的输出。适用于 JSON 和 XML 格式。

<div id="http_zlib_compression_level">
  ## http\_zlib\_compression\_level
</div>

<SettingsInfoBlock type="Int64" default_value="3" />

如果 [enable\_http\_compression = 1](/zh/reference/settings/session-settings/enable#enable_http_compression)，则设置 HTTP 请求响应中的数据压缩级别。

可能的值：1 到 12 的数值。高于 `9` 的级别需要使用包含 `libdeflate` 的默认构建版本；不包含 `libdeflate` 的构建版本支持 1 到 9 级。
