winhttp 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -291
- data/lib/winhttp.rb +4 -562
- metadata +10 -86
- data/CHANGELOG.md +0 -41
- data/ext/winhttp/extconf.rb +0 -26
- data/ext/winhttp/winhttp.c +0 -1247
- data/lib/winhttp/version.rb +0 -5
data/CHANGELOG.md
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [0.1.0] - 2026-06-27
|
|
4
|
-
|
|
5
|
-
Initial release.
|
|
6
|
-
|
|
7
|
-
- **`Winhttp::Session`** wraps one asynchronous WinHTTP session
|
|
8
|
-
(`WINHTTP_FLAG_ASYNC`) with system TLS via Schannel, the OS certificate store,
|
|
9
|
-
and the user's proxy/PAC settings. Options: `user_agent:`, `proxy:`
|
|
10
|
-
(`:system`/`:none`/a String), `proxy_bypass:`, `http2:`, `decompress:`,
|
|
11
|
-
`revocation:` (`:best_effort`/`:strict`/`:none`), `redirects:`,
|
|
12
|
-
`connect_timeout:`/`send_timeout:`/`receive_timeout:`. A TLS 1.2 floor is
|
|
13
|
-
always enforced (TLS 1.3 when the OS supports it). Thread-safe and fiber-safe.
|
|
14
|
-
- **Module one-liners** `Winhttp.get`, `Winhttp.post`, `Winhttp.request`
|
|
15
|
-
delegate to a lazily-created, process-lifetime `Winhttp.default_session`.
|
|
16
|
-
- **Request verbs** `get`, `head`, `post`, `put`, `patch`, `delete`, and
|
|
17
|
-
arbitrary `request(method, url, ...)`, with `headers:`, `body:`, `timeout:`,
|
|
18
|
-
and a streaming `&chunk` block (each chunk a fresh ASCII-8BIT String ≤ 64 KiB,
|
|
19
|
-
yielded on the caller's thread/fiber).
|
|
20
|
-
- **`Winhttp::Response`**: `status`, `reason`, `headers` (lowercased, duplicates
|
|
21
|
-
joined), `raw_headers` (wire order/case/duplicates), `#[]` (case-insensitive),
|
|
22
|
-
`body` (ASCII-8BIT, or nil when streamed), `text` (charset-aware tagging),
|
|
23
|
-
`final_url`, `http2?`, `success?`. 4xx/5xx are responses, not exceptions.
|
|
24
|
-
- **Error hierarchy** `Winhttp::Error` → `OSError` (with `#code`) →
|
|
25
|
-
`TimeoutError`, `ResolveError`, `ConnectError`, `TlsError` (with `#details`),
|
|
26
|
-
`RedirectError`, `ProtocolError`, `Canceled`; plus `Closed`. A Ruby-level
|
|
27
|
-
`timeout:` deadline raises `TimeoutError` with `code == nil`.
|
|
28
|
-
- **winloop cooperation, one code path.** WinHTTP's status callbacks are bridged
|
|
29
|
-
through a gem-private completion queue and a single pump thread into
|
|
30
|
-
per-request `Thread::Queue` mailboxes; the mailbox pop blocks a plain thread
|
|
31
|
-
natively and parks a fiber under a `Fiber::Scheduler` (e.g. winloop) — with no
|
|
32
|
-
scheduler branches anywhere in winhttp and no winloop dependency.
|
|
33
|
-
- **Safe lifetime by construction**: per-request native buffers are freed only
|
|
34
|
-
on the guaranteed-last `HANDLE_CLOSING` callback; request identity is a
|
|
35
|
-
never-reused uint64 id; `Session#close` aborts in-flight requests and bounds
|
|
36
|
-
its wait for OS teardown before closing the session handle.
|
|
37
|
-
|
|
38
|
-
Windows MSVC (mswin) Ruby only. x64 (`x64-mswin64`); arm64-mswin expected to
|
|
39
|
-
work but untested.
|
|
40
|
-
|
|
41
|
-
[0.1.0]: https://github.com/main-path/winhttp/releases/tag/v0.1.0
|
data/ext/winhttp/extconf.rb
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
#
|
|
3
|
-
# extconf.rb for the winhttp extension — a thin binding to the asynchronous
|
|
4
|
-
# WinHTTP client API (sessions, requests, system TLS, proxy, status callbacks).
|
|
5
|
-
|
|
6
|
-
require "mkmf"
|
|
7
|
-
|
|
8
|
-
# Arch-neutral guard: match target_os only (passes on x64-mswin64 AND a future
|
|
9
|
-
# arm64-mswin64, whose target_os is still "mswin64"); never pin the x64 arch.
|
|
10
|
-
unless RbConfig::CONFIG["target_os"] =~ /mswin/
|
|
11
|
-
abort <<~MSG
|
|
12
|
-
winhttp requires a native Windows MSVC (mswin) Ruby — it binds the
|
|
13
|
-
asynchronous WinHTTP client API (system TLS via Schannel, the OS certificate
|
|
14
|
-
store, the user's proxy/PAC settings, HTTP/2 and gzip), and is built with
|
|
15
|
-
cl.exe. Your Ruby is "#{RbConfig::CONFIG['arch']}".
|
|
16
|
-
MSG
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# System import libs (bare "NAME.lib" tokens on mswin):
|
|
20
|
-
# winhttp - the OS HTTP client (sessions, requests, TLS, proxy, callbacks)
|
|
21
|
-
# kernel32 (events, critical sections, FormatMessage) is linked by default.
|
|
22
|
-
# No /MACHINE, no -arch: let mkmf inherit Ruby's RbConfig flags (arm64-clean).
|
|
23
|
-
# Pure C — no -EHsc, so rb_raise/longjmp is the normal, safe error mechanism.
|
|
24
|
-
$libs = [$libs, "winhttp.lib"].join(" ")
|
|
25
|
-
|
|
26
|
-
create_makefile("winhttp/winhttp")
|