Skip to content

Respect max_http_get_redirects setting in HTTPDictionarySource - #101768

Merged
alexey-milovidov merged 29 commits into
ClickHouse:masterfrom
Onyx2406:fix/dictionary-http-redirects
Oct 4, 2026
Merged

alexey-milovidov merged 29 commits into
ClickHouse:masterfrom
Onyx2406:fix/dictionary-http-redirects

Conversation

@Onyx2406

@Onyx2406 Onyx2406 commented Apr 4, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

HTTPDictionarySource did not call withRedirects on its HTTP request builder, so HTTP dictionary sources rejected every redirect with TOO_MANY_REDIRECTS even when max_http_get_redirects was set to a non-zero value. This made it impossible to create dictionaries from HTTP(S) URLs that redirect (e.g. pre-signed object-storage URLs), while the url table function and other HTTP sources already follow redirects.

This adds .withRedirects(context->getSettingsRef()[Setting::max_http_get_redirects]) to all four request paths (loadAll, loadUpdatedAll, loadIds, loadKeys), matching the pattern already used in StorageURL. The max_http_get_redirects value is taken from the dictionary's SETTINGS clause; the default of 0 keeps the previous (redirect-rejecting) behavior, so this is not backward incompatible.

A new stateless test 04498_http_dictionary_max_redirects starts a local HTTP server that issues a 302 redirect and verifies that the dictionary refuses to follow it when max_http_get_redirects = 0 (TOO_MANY_REDIRECTS) and loads successfully when redirects are allowed.

Closes: #90521

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes):

HTTP dictionary sources (SOURCE(HTTP(...))) now respect the max_http_get_redirects setting, so dictionaries can be created from URLs that redirect. Previously such dictionaries always failed with TOO_MANY_REDIRECTS.

  • Documentation is written (no docs needed for this change)

Workflow [PR]
Sync PR [sync-upstream/pr/101768]

Version info

  • Merged into: 26.10.1.1490-master (included in 26.10 and later)

`HTTPDictionarySource` did not call `withRedirects` on its HTTP request
builder, causing all redirects to be rejected with `TOO_MANY_REDIRECTS`.
Add `.withRedirects(context->getSettingsRef()[Setting::max_http_get_redirects])`
to all four request paths (`loadAll`, `loadUpdatedAll`, `loadIds`, `loadKeys`),
matching the pattern used in `StorageURL` and other HTTP sources.

Fixes ClickHouse#90521

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a test.

Adds stateless test 04417_http_dictionary_max_redirects, which starts a
local HTTP server issuing a 302 redirect and verifies that an HTTP
dictionary source follows it only when max_http_get_redirects allows it:
it fails with TOO_MANY_REDIRECTS when the setting is 0 and loads the data
when redirects are permitted.

The dictionary takes max_http_get_redirects from its SETTINGS clause.

Closes: ClickHouse#90521
The test number 04417 was taken by other tests merged into master since
this branch was created (`04417_client_input_format_from_config`,
`04417_docs_web_ui_disclosure_details`,
`04417_numeric_indexed_vector_pointwise_multiply_all_ones`). Renumber the
HTTP dictionary redirect test to the next free prefix 04498 and update the
internal `.python` reference and dictionary names accordingly.
@alexey-milovidov

Copy link
Copy Markdown
Member

Added the requested test and merged current master.

New stateless test 04498_http_dictionary_max_redirects (.python, following the pattern of 01854_HTTP_dict_decompression) starts a local HTTP server that answers /redirect with a 302 to /data.csv and verifies that an HTTP dictionary source:

  • fails with TOO_MANY_REDIRECTS when the dictionary's SETTINGS(max_http_get_redirects = 0);
  • follows the redirect and loads the data when SETTINGS(max_http_get_redirects = 5).

The setting is taken from the dictionary's SETTINGS clause via copyContextAndApplySettingsFromDictionaryConfig.

I validated the behavior locally against a release binary (which lacks this fix): both max_http_get_redirects = 0 and = 5 return TOO_MANY_REDIRECTS, confirming the bug and that the test's positive case only passes with the fix. Separately, url() (which uses the identical withRedirects call) follows the redirect with max_http_get_redirects = 5 and rejects it with 0, confirming the mechanism.

(The test was numbered 04498 because 04417 was taken by other tests that landed on master since this branch was created.)

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Jul 3, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [5955a89]

Summary: ✅


AI Review

Summary

This PR makes HTTPDictionarySource honor max_http_get_redirects and fixes several redirect corner cases in ReadWriteBufferFromHTTP, including host filtering, 303 method rewriting, relative Location handling, compression detection, and 308 support. The streaming cases look well covered, but one generic POST-redirect surface is still incomplete: seekable readers can still fall back to the original POST after a 303, so redirecting HTTP sources are not yet reliable for formats that do metadata probes or range reads.

Findings

⚠️ Majors

  • [src/IO/ReadWriteBufferFromHTTP.cpp:364] The new 303 See Other rewrite only lives inside callWithRedirects, but the same buffer later reaches paths that bypass it. getHeadResponse in src/IO/ReadWriteBufferFromHTTP.cpp:215 can move current_uri to the redirect target during seekability probing, and readBigAt in src/IO/ReadWriteBufferFromHTTP.cpp:778 still uses the original method when it issues range requests. Seekable formats such as Parquet (src/Processors/Formats/Impl/Parquet/Prefetcher.cpp:65, src/Processors/Formats/Impl/Parquet/Prefetcher.cpp:109) can therefore still hit the redirected object with POST instead of GET, so POST -> 303 -> GET sources remain broken outside the streaming CSV path covered by the new test. Suggested fix: carry the rewritten method / body state into the direct callImpl users, or keep the HEAD probe from persisting a target URI unless the matching method rewrite is persisted too, and add a focused seekable-format regression.
Final Verdict

Status: ⚠️ Request changes

Minimum required actions:

  • Preserve the 303 method/body rewrite across metadata and range-read paths, not only the streaming retry loop.
  • Add a focused regression that exercises a seekable format behind POST -> 303 -> GET.

LLVM Coverage Report

Measured on commit 5955a89.

Metric Baseline Current Δ
Lines 88.10% 88.10% +0.00%
Functions 92.10% 92.10% +0.00%
Branches 79.60% 79.50% -0.10%

Changed lines: Changed C/C++ lines covered: 83/91 (91.21%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Jul 3, 2026
alexey-milovidov and others added 4 commits July 10, 2026 09:50
Enabling `max_http_get_redirects` for HTTP dictionaries without threading
`RemoteHostFilter` into the request builders turned the one-time
`created_from_ddl` URL check into a bypass: a DDL-created dictionary could
point at an allow-listed URL that `302`s to a host outside
`remote_url_allow_hosts`, and `ReadWriteBufferFromHTTP` would follow it (and
replay the same `Poco::Net::HTTPBasicCredentials` to the redirect target).
`StorageURL` pairs `withRedirects` with `withHostFilter` for exactly this
reason.

Pass `context->getRemoteHostFilter` to the builders in `loadAll`,
`loadUpdatedAll`, `loadIds` and `loadKeys` for DDL-created dictionaries, so
every hop (including redirects) is validated by
`ReadWriteBufferFromHTTP::callImpl`. Config-file dictionaries keep their
previous behavior (host filter not applied), matching the existing DDL-only
initial-URL check.

Adds an integration regression `test_http_dictionary_redirect_remote_host_filter`
verifying that a `302` to a host outside `remote_url_allow_hosts` is rejected
with `UNACCEPTABLE_URL` and is never actually fetched.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The test starts a local HTTP server and discovers a routable address with
`hostname -i`, a Linux-only flag. On macOS (the `arm_darwin` fast test)
`hostname` rejects it (`hostname: illegal option -- i`) and the test crashes
before reaching the server, so it must be skipped there. Every sibling
HTTP-server Python test (`01854_HTTP_dict_decompression`,
`02205_HTTP_user_agent`, `02233_HTTP_ranged`, ...) is already listed in
`ci/defs/darwin.skip` for the same reason.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ng it on macOS

`master` (b658464) replaced `hostname -i` - a Linux-only flag that fails on
macOS with `hostname: illegal option -- i` - with a portable `socket.getaddrinfo`
lookup in the sibling HTTP-server tests and unskipped them on the Darwin fast
test. Do the same here: resolve `CLICKHOUSE_HOST` via `socket.getaddrinfo`
(defaulting to `127.0.0.1`) and drop the `ci/defs/darwin.skip` entry added in the
previous commit, so the redirect test keeps its macOS coverage.

Fast test (arm_darwin) failure:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=101768&sha=15dc4b5541035e75f1c56e606e99a404df23bdf8&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

Addressed the AI-review / clickhouse-gh[bot] blocker (the remote_url_allow_hosts bypass) and the CI failures:

Security fix — RemoteHostFilter on redirected requests. Enabling max_http_get_redirects without threading RemoteHostFilter into the request builders turned the one-time created_from_ddl URL check into a bypass: a DDL-created dictionary could point at an allow-listed URL that 302s to a host outside remote_url_allow_hosts, and ReadWriteBufferFromHTTP would follow it (replaying the same Poco::Net::HTTPBasicCredentials to the redirect target). loadAll, loadUpdatedAll, loadIds and loadKeys now pass context->getRemoteHostFilter to the builder, so ReadWriteBufferFromHTTP::callImpl validates every hop (matching StorageURL). To preserve existing semantics, the filter is applied only for DDL-created dictionaries — config-file dictionaries keep their prior behavior, consistent with the existing DDL-only initial-URL check.

Regression test. New integration test test_http_dictionary_redirect_remote_host_filter: a DDL HTTP dictionary whose allow-listed source (127.0.0.1) 302s to a non-allow-listed host (127.0.0.2) is rejected with UNACCEPTABLE_URL and the target is never fetched. Without the fix it followed the redirect and loaded the data.

Fast test (arm_darwin). 04498_http_dictionary_max_redirects crashed on macOS because it used hostname -i (a Linux-only flag). Made it portable via socket.getaddrinfo, matching what master did for the sibling HTTP tests in b6584645898.

03652_threads_count_insert (amd_debug, sequential) is a pre-existing flaky unrelated to this change — it fails on master itself and across many unrelated PRs.

@alexey-milovidov

Copy link
Copy Markdown
Member

Merged latest master (the branch was 154 commits behind and red). The two failures on the previous run were unrelated flakes, not caused by this change:

  • Integration tests (amd_msan, 7/8) → test_replicated_database/test.py::test_replicated_table_structure_alter (AssertionError, labeled retry_ok). This flaked on 12 different PRs (and master) on 2026-07-10 — a fleet-wide flake in replicated ALTER structure replication, unrelated to HTTP dictionaries.
  • Stateless tests (amd_tsan, s3 storage, sequential, 2/2) → "Server died" from a ThreadSanitizer data race in DB::BufferBase::set inside PullingAsyncPipelineExecutor. This is a pre-existing generic pipeline/buffer race seen on unrelated PRs (Add dictGetRoot function for hierarchical dictionaries #109459, Propagate predicates across equi join #108377), not related to HTTPDictionarySource.

CI is re-running on the fresh merge (9b1a3875ced).

…ct) URI

When following redirects, the final object may have a different path and
extension than the dictionary source URL (e.g. `/redirect` -> `/data.csv.gz`)
and the server may not send `Content-Encoding`. Detect the compression method
from `ReadWriteBufferFromHTTP::getCurrentURI` (redirects are already followed,
since the buffer is created with delayed initialization disabled) instead of
`configuration.url`. Add a redirect-to-gzip case to the `04498` test.
…-redirects

# Conflicts:
#	src/Dictionaries/HTTPDictionarySource.cpp
@alexey-milovidov

Copy link
Copy Markdown
Member

Addressed the remaining AI-review Major and refreshed the branch:

Compression detection after redirects (commit cceaf43, includes 6407264): HTTPDictionarySource::createWrappedBuffer now derives the compression method from ReadWriteBufferFromHTTP::getCurrentURI — the URI of the final response after redirects — instead of configuration.url. A source like /redirect -> /data.csv.gz without Content-Encoding is now decompressed correctly. The stateless test 04498_http_dictionary_max_redirects gained a redirect-to-gzip case (302 to /data.csv.gz served without Content-Encoding); verified locally against a fresh build.

Merged latest master (the branch was 9 days behind). The single conflict was in the same function: master added snappy_mode handling to createWrappedBuffer (choosing framed vs raw snappy depending on whether the method came from Content-Encoding); resolved by feeding the post-redirect path into the new chooseCompressionMethod/wrapReadBufferWithCompressionMethod code.

The previous run's only CI failure, test_server_startup_and_shutdown_logs::test_server_no_logging, was a known flake fixed by #110033 (merged 2026-07-10) — this merge pulls the fix in, so it should not reappear.

…directs

Review follow-up: `createWrappedBuffer` derived the compression method only
from the final (post-redirect) URI, which dropped the sole compression hint
for the inverse redirect pattern - a source URL with a compression suffix
(e.g. `/data.csv.gz`) redirecting to an opaque signed URL served without
`Content-Encoding`. When the final URI does not imply any method and there
is no `Content-Encoding`, `chooseCompressionMethod` now falls back to the
path of the original `configuration.url`.

Extended `04498_http_dictionary_max_redirects` with the reverse regression:
a `/source.csv.gz` source that `302`s to a suffixless `/signed-token`
serving the gzip object without `Content-Encoding` must still load.
@Onyx2406

Copy link
Copy Markdown
Contributor Author

Addressed the remaining review request (inline thread on createWrappedBuffer, the reverse redirect/compression pattern) in d75bf10:

  • createWrappedBuffer now falls back to the suffix of the original configuration.url when the final (post-redirect) URI does not imply a compression method and the response carries no Content-Encoding. So a source URL like /data.csv.gz that 302s to an opaque signed URL (e.g. /signed-token) served without Content-Encoding is decompressed correctly. The snappy_mode choice is unaffected: in the fallback case the method is still inferred from a URL path, so the user-tunable setting applies, as before.
  • Extended 04498_http_dictionary_max_redirects with the requested reverse regression: /source.csv.gz redirects to a suffixless /signed-token serving the gzip object without Content-Encoding, and the dictionary must load the decompressed rows.

Both directions are now covered by the test: /redirect -> /data.csv.gz (detect from final URI) and /source.csv.gz -> /signed-token (fall back to the source URL suffix).

`ReadWriteBufferFromHTTP::callWithRedirects` replayed the original method and the
original request body on every redirect hop. For a `303 See Other` this violates
RFC 9110, 15.4.4: the follow-up request must use `GET` and must not carry the
body of the original request.

This is what the selective-load paths of `HTTPDictionarySource` hit: `loadIds`
and `loadKeys` (used by the `cache` and `complex_key_cache` layouts) `POST` the
requested keys, so a standards-compliant `303` to a signed download URL was
replayed as a `POST` to that URL and typically answered with
`405 Method Not Allowed`.

`callWithRedirects` now rewrites the request to `GET` and suppresses the
out-stream callback after a `303` (except for a `HEAD` probe, which keeps its
method). The rewrite is sticky for the lifetime of the buffer, because
`current_uri` keeps pointing at the redirect target across retries.

`04498_http_dictionary_max_redirects` gained a selective-load regression: a
`cache` dictionary whose source answers the lookup `POST` with `303` to an
endpoint that serves the data on `GET` and rejects `POST` with `405`. Verified
end-to-end against a fresh build; with a `302` in place of the `303` the same
setup still fails with `405`, which is the expected standards-compliant
behavior and confirms the test discriminates the fix.
@alexey-milovidov

Copy link
Copy Markdown
Member

Addressed the remaining AI-review Major (selective-load POST paths and 303 See Other) and refreshed the branch.

303 See Other is now followed with a bodyless GET (commit aa8152d1ee8). ReadWriteBufferFromHTTP::callWithRedirects replayed the original method and the original request body on every hop, so a standards-compliant 303 from a keyed lookup (loadIds / loadKeys, used by the cache and complex_key_cache layouts) to a signed download URL was re-sent as a POST and typically answered with 405 Method Not Allowed. Per RFC 9110, 15.4.4, the follow-up request must use GET and must drop the body, which is what callWithRedirects does now; a HEAD probe keeps its method, and 301/302/307 keep replaying the original method and body as the standard requires. The rewrite is sticky for the lifetime of the buffer, since current_uri keeps pointing at the redirect target across retries. I fixed the redirect machinery rather than disabling redirects on the POST builders, so cache dictionaries benefit from max_http_get_redirects too.

Selective-load regression added to 04498_http_dictionary_max_redirects: a cache dictionary whose source answers the lookup POST with 303 to an endpoint that serves the rows on GET and rejects POST with 405; dictGet must return the value. Verified end-to-end against a fresh build. Control: with a 302 in place of the 303 the same setup still fails with 405 — expected behavior, and it shows the test discriminates the fix instead of passing vacuously.

Merged latest master (the branch was 8 days behind), no conflicts. The previous run's only CI failure, test_replicated_database/test.py::test_replicated_table_structure_alter (issue #110036), was a known flake fixed by #111029 (merged 2026-07-24, issue closed) — this merge pulls the fix in, so it should not reappear.

@abashkeev abashkeev added the comp-dictionary Dictionaries (in-memory key-value, periodically refreshed from sources). label Sep 4, 2026
Comment thread src/IO/ReadWriteBufferFromHTTP.cpp Resolved
alexey-milovidov and others added 3 commits September 16, 2026 22:21
…direct`

`HTTPDictionarySource` now goes through `callWithRedirects`, but the loop only
follows statuses recognized by `isRedirect`, which omitted `308`. A dictionary
behind a standards-compliant `308` response failed in `assertResponseIsOk`
instead of honoring `max_http_get_redirects`. `308` keeps the method and the
body like `307`, so it needs no special handling in the redirect loop.

Add a `308` case to `04498_http_dictionary_max_redirects`.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Pass 2026-09-16: merged master (clean, single merge base) and adopted the AI-review finding in 20be94d: isRedirect now recognizes 308 Permanent Redirect, with a 308 case added to 04498_http_dictionary_max_redirects (passes locally on the rebuilt binary). The only red was CH Inc sync: the private sync PR ClickHouse/clickhouse-private#63970 is MERGEABLE and its three red shards are unrelated sanitizer runs (05024_distributed_plan_limit_early_stop_idle_sink in TSan; 04669_creating_set_partitions_independently and 04238_alter_rename_column_merge_race timing out at 600 s in MSan with distributed cache). The sync branch regenerates from this push.

@groeneai, investigate the failures https://github.com/ClickHouse/clickhouse-private/actions/runs/34241251146/job/102120033709 (05024_distributed_plan_limit_early_stop_idle_sink) and https://github.com/ClickHouse/clickhouse-private/actions/runs/34241251146/job/102120110399 (04669_creating_set_partitions_independently) and provide a fix in a separate PR. If the fix is already in progress, link it here. 04238_alter_rename_column_merge_race is tracked in #119382.

@groeneai

Copy link
Copy Markdown
Collaborator

Both failures already have a fix in progress, and neither fix is merged, so the head your sync branch built contains neither.

1. 05024_distributed_plan_limit_early_stop_idle_sink (TSan): #117764.

The test decides PASS/FAIL by elapsed time. A satisfied LIMIT must stop the upstream distributed-plan stages, so a correct run returns in seconds while an unstopped one keeps a sleepEachRow scan alive and trips the query's own max_execution_time = 25. A merely slow host therefore reddens it: public sightings all land just over the cap (0.3% to 2.6% over, per query; 25.4 s to 27.0 s of test wall clock where a passing run on those same lanes averages 2 s to 5 s) and pass on rerun. It is not specific to this PR or to the sync branch: the same test failed on private true master on that same amd_tsan, meta in keeper, s3 storage, parallel lane on 2026-09-12 03:27Z and 2026-09-14 19:28Z, and on public true master on 2026-08-25 13:33Z (amd_tsan, parallel, 30.9 s). Over 30 days the private master rate sits at or below the public one.

#117764 replaces the clock with the propagation itself: each exchange endpoint traces what it does when the stop reaches it, and both halves are required on every stream between the LIMIT and the sleeping scan, the sink closing its input and the source sending NoMoreDataNeeded one hop upstream. max_execution_time drops to a 300 s hang backstop. It is not test-only, because it adds the two LOG_TRACE lines that oracle reads. Approved by @ davenger; every test check is green at its head, the two reds being Build profile diff (a transient CI-logs cluster read, fixed by #120121) and the private CH Inc sync.

2. 04669_creating_set_partitions_independently (MSan, 600 s): #120055.

Cost, not a defect: 0 timeouts on the file in 90 days of public CI, but MSan is already its worst lane (amd_msan, WasmEdge, parallel, 2/3, p50 124.1 s and max 288.8 s over 1501 runs), and adding distributed cache and Keeper metadata is what pushes it past the per-file gate. Four of its five abandon cases were sized by the DeduplicationAbandonController arming threshold rather than by what they assert (it decides per stream only after 5 chunks or 16 MiB, so 8 partitions with an 8192-row granule put the floor at 327,680 rows); lowering the granule and the stream count first takes the file from 3,511,600 to 722,400 rows, 16,953 ms to 11,146 ms under MSan. That is 1.52x, not enough to trust a 600 s gate when 75% of the remainder is fixed per-statement structure that no resizing reduces, so the file also gets no-msan, the shape of #117833, while 05046_creating_set_deduplication_abandoning_event and 05045_preliminary_distinct_abandoning keep asserting the same abandon path under MSan. Once it merges the MSan shards skip the file. It is green and waiting on review from @ nihalzp.

I cannot open either private job log (the private repo is not visible to this account), so both matches rest on the public signature plus the lane, test and timing data relayed to me from the private lanes. If a log shows something else (for 05024 a stop that never propagates rather than a slow host, for 04669 an error rather than the 600 s file gate), say so and I will treat that one as new work with its own PR.

alexey-milovidov and others added 3 commits September 26, 2026 02:48
…filter test

Add a negative regression for `cache` dictionaries: `loadIds` sends the keys in
a `POST` body, the allow-listed source answers with `307` to a host that is not
in `remote_url_allow_hosts`, and the redirect hop must be rejected before the
target is fetched. This guards against a future omission of `withHostFilter`
on the selective-load builders.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
{
effective_method = Poco::Net::HTTPRequest::HTTP_GET;
with_request_body = false;
rewritten_to_get_by_redirect = true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callWithRedirects now remembers a 303 See Other rewrite only here, but the same buffer can later reach code paths that bypass that state. getHeadResponse in src/IO/ReadWriteBufferFromHTTP.cpp:215 may run first on seekable formats and moves current_uri to the redirected target, while readBigAt in src/IO/ReadWriteBufferFromHTTP.cpp:778 still calls callImpl(..., method, range, false) with the original POST. So a POST -> 303 -> GET source still breaks as soon as the reader does metadata or range reads (for example Parquet via src/Processors/Formats/Impl/Parquet/Prefetcher.cpp:65 and src/Processors/Formats/Impl/Parquet/Prefetcher.cpp:109): after the HEAD probe or first random read we hit the signed object with POST instead of GET.

Please carry the effective method / body suppression through those direct callImpl paths (or avoid persisting a HEAD-discovered target without the matching rewrite) and add a focused seekable-format regression.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵 This PR is already merged (2026-10-04), so no more commits can go into it. My assessment of this comment:

  • The path is not a regression from this PR. Before the change, every redirect, 303 included, replayed the original method and body. A HEAD probe from getHeadResponse already moved current_uri, and readBigAt already used method. The PR only adds 303 -> GET handling to callWithRedirects.
  • On master the only readers that use POST are XDBC (bridge, non-seekable streaming format) and HTTPDictionarySource::loadIds/loadKeys. loadAll/loadUpdatedAll use GET. To hit POST -> 303 -> GET with a HEAD probe or readBigAt, an HTTP dictionary would need a seekable format such as Parquet, a key-based load, and a server that answers the POST with 303 to a range-capable object. That is a narrow combination.

If it needs fixing, the fix is small: set rewritten_to_get_by_redirect on a 303 seen during the HEAD probe too (the HEAD still keeps its own method), and have readBigAt use GET without the request body when the flag is set. It should go in a separate follow-up PR with a focused test, not here.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is alright.

@alexey-milovidov alexey-milovidov self-assigned this Oct 4, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 4, 2026
Merged via the queue into ClickHouse:master with commit 16c9e25 Oct 4, 2026
149 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 4, 2026
kolsha added a commit that referenced this pull request Nov 18, 2026
Carry the port of the cherry-pick as a tree onto the rebuilt `backport/26.3/129850` branch: the release branch was rewritten, so the earlier port cannot be pushed as is without bringing the old history back.

This branch has no `web` disk, no index pages listing and no `Elasticsearch`, so the change is ported instead of cherry-picked. Deviations from the original change, all approved:
- `StorageURLSource::setCredentials` is rewritten to call `checkBasicCredentials`; the check runs before the `try` in `getFirstAvailableURIAndReadBuffer`, and the initiator of `urlCluster` checks all failover options.
- The schema registry check is in `SchemaRegistry::fetchSchema` in `AvroRowInputFormat.cpp`.
- `checkAndNormalizeHeaders` is called instead of `checkHeaders`.
- `HTTPDictionarySource` keeps the `created_from_ddl` field of `Configuration` from #101768, which the original change relies on.
- The changes of the `web` disk, `test_disk_over_web_server`, `Elasticsearch` and `web_index` are dropped, they do not exist on this branch.
- `test_storage_url` gets 11 ported test cases, and `configs/conf.xml` a placeholder `http_forbid_headers`.
kolsha added a commit that referenced this pull request Nov 18, 2026
Carry the conflict resolution of the cherry-pick as a tree onto the rebuilt `backport/26.9/129850` branch: the release branch was rewritten, so the earlier resolution cannot be pushed as is without bringing the old history back.

Deviations from the original change, all approved:
- `HTTPDictionarySource` keeps the `created_from_ddl` field of `Configuration` from #101768, which the original change relies on.
- The `Elasticsearch` hunk and the `test_storage_elasticsearch` changes are dropped, the engine does not exist on this branch.
- `checkAndNormalizeHeaders` is called instead of `checkHeaders`.
- `test_storage_url` gets the helper `server_part_of_error` for the error assertions.
- The redirect fixture of `index_pages_server.py` puts userinfo into `Location` as on master (from #126184), so that `test_url_redirect_userinfo_is_not_sent_with_forbidden_authorization` exercises the redirect with credentials. The masking of the URL in the error of `rejectOriginChangingRedirect` from #126184 is not ported: it is not part of this change, and the branch keeps its existing behavior.
kolsha added a commit that referenced this pull request Nov 18, 2026
Carry the conflict resolution of the cherry-pick as a tree onto the rebuilt `backport/26.8/129850` branch: the release branch was rewritten, so the earlier resolution cannot be pushed as is without bringing the old history back.

Deviations from the original change, all approved:
- `HTTPDictionarySource` keeps the `created_from_ddl` field of `Configuration` from #101768, which the original change relies on.
- The `Elasticsearch` hunk and the `test_storage_elasticsearch` changes are dropped, the engine does not exist on this branch.
- `checkAndNormalizeHeaders` is called instead of `checkHeaders`.
- `test_storage_url` gets the helper `server_part_of_error` for the error assertions.
- The tests use the setting name `allow_experimental_url_wildcard_from_index_pages`, as it is named on this branch.
- The redirect fixture of `index_pages_server.py` puts userinfo into `Location` as on master (from #126184), so that `test_url_redirect_userinfo_is_not_sent_with_forbidden_authorization` exercises the redirect with credentials. The masking of the URL in the error of `rejectOriginChangingRedirect` from #126184 is not ported: it is not part of this change, and the branch keeps its existing behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-dictionary Dictionaries (in-memory key-value, periodically refreshed from sources). pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTPDictionarySource should respect max_http_get_redirects setting

5 participants