Skip to content

Commit 66ba595

Browse files
committed
docs: update README
1 parent 53ca611 commit 66ba595

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@ Http2Client requires the native TLS library from the original [bogdanfinn/tls-cl
3232
**Installation Instructions:**
3333

3434
1. Download the appropriate library file for your platform from the table above
35-
2. Place the native library in your application's output directory, or
36-
3. Specify the custom path using the `WithLibraryPath()` method in your code
35+
2. Place the native library in your application's output directory, or specify a custom path
36+
3. Initialize the library once at application startup using `Http2Client.Initialize()`
3737

3838
**Example for Windows:**
3939
```csharp
40+
// Initialize once at application startup
41+
Http2Client.Initialize("tls-client-windows-64-1.11.0.dll");
42+
43+
// Create clients as needed
4044
using var client = new HttpClientBuilder()
41-
.WithLibraryPath("tls-client-windows-64-1.11.0.dll")
4245
.Build();
4346
```
4447

@@ -56,9 +59,11 @@ using Http2Client.Builders;
5659
using Http2Client.Core.Enums;
5760
using Http2Client.Core.Request;
5861

62+
// Initialize native library once at application startup
63+
Http2Client.Initialize("tls-client-windows-64-1.11.0.dll");
64+
5965
// Create an Http2Client instance using the builder
6066
using var client = new HttpClientBuilder()
61-
.WithLibraryPath("tls-client-windows-64-1.11.0.dll")
6267
.WithBrowserType(BrowserType.Chrome133)
6368
.WithUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36")
6469
.WithTimeout(TimeSpan.FromSeconds(30))
@@ -118,7 +123,6 @@ using var client = new HttpClientBuilder()
118123

119124
| Method | Description |
120125
|--------|-------------|
121-
| `WithLibraryPath(string)` | Sets the path to the native TLS library. |
122126
| `WithBrowserType(BrowserType)` | Sets the browser fingerprint to mimic. |
123127
| `WithUserAgent(string)` | Sets the User-Agent header. |
124128
| `WithTimeout(TimeSpan)` | Sets the request timeout. |
@@ -142,8 +146,10 @@ using var client = new HttpClientBuilder()
142146
### Advanced Example
143147

144148
```csharp
149+
// Initialize library once at startup
150+
Http2Client.Initialize("tls-client-windows-64-1.11.0.dll");
151+
145152
using var client = new HttpClientBuilder()
146-
.WithLibraryPath("tls-client-windows-64-1.11.0.dll")
147153
.WithBrowserType(BrowserType.Firefox132)
148154
.WithUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64)")
149155
.WithProxy("http://127.0.0.1:8888", isRotating: true)
@@ -228,7 +234,6 @@ var request = new HttpRequest
228234

229235
```csharp
230236
using var client = new HttpClientBuilder()
231-
.WithLibraryPath("tls-client-windows-64-1.11.0.dll")
232237
.WithBrowserType(BrowserType.Chrome133)
233238
.Build();
234239

@@ -265,7 +270,6 @@ var response = client.Send(request);
265270

266271
```csharp
267272
using var client = new HttpClientBuilder()
268-
.WithLibraryPath("tls-client-windows-64-1.11.0.dll")
269273
.WithBrowserType(BrowserType.Chrome133)
270274
.WithProxy("http://proxy.example.com:8080")
271275
.Build();

src/Http2Client.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Nullable>enable</Nullable>
77
<Platforms>AnyCPU;x64</Platforms>
88
<PackageId>Http2Client</PackageId>
9-
<Version>1.1.3</Version>
9+
<Version>1.1.4</Version>
1010
<Authors>Rckov</Authors>
1111
<Company>Rckov</Company>
1212
<Product>Http2Client</Product>

0 commit comments

Comments
 (0)