Skip to content

Commit 0a99776

Browse files
committed
Trim comments and descriptions
1 parent 1f4cff8 commit 0a99776

4 files changed

Lines changed: 19 additions & 31 deletions

File tree

providers/http/docs/connections/http.rst

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Password (optional)
4747
Host (optional)
4848
Specify the entire url or the base of the url for the service.
4949

50-
If "Use DNS SRV Lookup" is enabled below, specify the DNS SRV record name instead
51-
(e.g. ``_http._tcp.example.com``) the actual host and port are resolved from DNS at
50+
If "Use DNS SRV Lookup" is enabled, specify the DNS SRV record name instead
51+
(e.g. ``_http._tcp.example.com``) - Note the actual host and port are resolved from DNS at
5252
request time and any value set in the Port field is ignored.
5353

5454
Port (optional)
@@ -58,13 +58,10 @@ Schema (optional)
5858
Specify the service type etc: http/https.
5959

6060
Use DNS SRV Lookup (optional)
61-
When enabled, the Host field above is treated as a DNS SRV record name that is resolved
62-
to the actual target host and port at request time, instead of connecting to Host/Port
63-
directly. Requires the ``apache-airflow-providers-http[srv]`` extra (``dnspython``).
61+
Treat the Host field as a DNS SRV record name and resolve the target host/port at request time.
6462

6563
SRV Cache TTL (seconds) (optional)
66-
How long to cache a resolved SRV target before re-resolving. Defaults to 60 seconds.
67-
Only used when SRV lookup is enabled.
64+
Specify the time to cache a resolved SRV target before re-resolving. (default 60 seconds)
6865

6966
Extra (optional)
7067
Specify headers and default requests parameters in json format.

providers/http/provider.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,16 @@ connection-types:
130130
srv_lookup:
131131
label: Use DNS SRV Lookup
132132
description: >-
133-
When enabled, the Host field is treated as a DNS SRV record name (e.g.
134-
_http._tcp.example.com) that is resolved to the actual target host and port at
135-
request time. Requires the apache-airflow-providers-http[srv] extra.
133+
Whether to treat the Host field as a DNS SRV record name and resolve the target
134+
host/port at request time.
136135
schema:
137136
type:
138137
- boolean
139138
- "null"
140139
default: false
141140
srv_cache_ttl:
142141
label: SRV Cache TTL (seconds)
143-
description: How long to cache a resolved SRV target before re-resolving.
142+
description: Time to cache a resolved SRV target before re-resolving.
144143
schema:
145144
type:
146145
- number

providers/http/src/airflow/providers/http/get_provider_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ def get_provider_info():
6969
"conn-fields": {
7070
"srv_lookup": {
7171
"label": "Use DNS SRV Lookup",
72-
"description": "When enabled, the Host field is treated as a DNS SRV record name (e.g. _http._tcp.example.com) that is resolved to the actual target host and port at request time. Requires the apache-airflow-providers-http[srv] extra.",
72+
"description": "Whether to treat the Host field as a DNS SRV record name and resolve the target host/port at request time.",
7373
"schema": {"type": ["boolean", "null"], "default": False},
7474
},
7575
"srv_cache_ttl": {
7676
"label": "SRV Cache TTL (seconds)",
77-
"description": "How long to cache a resolved SRV target before re-resolving.",
77+
"description": "Time to cache a resolved SRV target before re-resolving.",
7878
"schema": {"type": ["number", "null"], "minimum": 0, "default": 60},
7979
},
8080
},

providers/http/src/airflow/providers/http/hooks/http.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,14 @@ def _url_from_endpoint(base_url: str | None, endpoint: str | None) -> str:
5757

5858

5959
def _select_srv_target(answers: Iterable[Any]) -> tuple[str, int]:
60-
"""
61-
Select a target host and port from a set of resolved DNS SRV records.
62-
63-
Among the records with the lowest (i.e. highest-priority) priority value, one is chosen
64-
uniformly at random, following the failover guidance in RFC 2782. Shared between the sync
65-
and async SRV resolution paths, which only differ in how they call the DNS resolver.
66-
"""
60+
"""Select a target host and port from resolved DNS SRV records."""
6761
candidates_by_priority: dict[int, list[Any]] = {}
6862
for record in answers:
6963
candidates_by_priority.setdefault(record.priority, []).append(record)
64+
# Failover mechanism: RFC 2782
7065
candidates = candidates_by_priority[min(candidates_by_priority)]
7166
chosen = random.choice(candidates)
72-
# SRV targets are FQDNs with a trailing dot; strip it for use as a hostname / Host header.
67+
7368
target_host = str(chosen.target).rstrip(".")
7469
return target_host, chosen.port
7570

@@ -158,14 +153,10 @@ class HttpHook(BaseHook):
158153
:param tcp_keep_alive_interval: The TCP Keep Alive interval parameter (corresponds to
159154
``socket.TCP_KEEPINTVL``)
160155
161-
The connection's Extra field also supports resolving the target host via a DNS SRV record
162-
instead of a fixed host/port, by setting:
156+
Extra also supports resolving ``host`` via a DNS SRV record:
163157
164-
* ``srv_lookup`` (bool): When true, ``host`` is treated as a DNS SRV record name (e.g.
165-
``_http._tcp.example.com``) that is resolved to the actual target host and port at
166-
request time. Requires the ``apache-airflow-providers-http[srv]`` extra (``dnspython``).
167-
* ``srv_cache_ttl`` (float): How long, in seconds, to cache a resolved SRV target before
168-
re-resolving. Defaults to 60 seconds.
158+
* ``srv_lookup`` (bool): treat ``host`` as an SRV record name, e.g. ``_http._tcp.example.com``.
159+
* ``srv_cache_ttl`` (float): SRV cache TTL in seconds (default 60).
169160
"""
170161

171162
conn_name_attr = "http_conn_id"
@@ -644,9 +635,10 @@ class HttpAsyncHook(BaseHook):
644635
:param retry_limit: Maximum number of times to retry this job if it fails (default is 3)
645636
:param retry_delay: Delay between retry attempts (default is 1.0)
646637
647-
Supports the same ``srv_lookup`` / ``srv_cache_ttl`` Extra field options as ``HttpHook``
648-
(see there for details) for resolving the target host via a DNS SRV record. Resolution is
649-
performed with the non-blocking ``dns.asyncresolver``.
638+
Extra also supports resolving ``host`` via a DNS SRV record:
639+
640+
* ``srv_lookup`` (bool): treat ``host`` as an SRV record name, e.g. ``_http._tcp.example.com``.
641+
* ``srv_cache_ttl`` (float): SRV cache TTL in seconds (default 60).
650642
"""
651643

652644
conn_name_attr = "http_conn_id"

0 commit comments

Comments
 (0)