Skip to content

Commit c26cbce

Browse files
authored
Merge pull request #23 from AngleSharp/devel
Release 0.13.1
2 parents b426803 + 5f6c77c commit c26cbce

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 0.13.1
2+
3+
Released on Tuesday, September 24 2019.
4+
5+
- Ignore non-existing cookie file when reading
6+
- Write cookies after every add operation
7+
18
# 0.13.0
29

310
Released on Friday, September 6 2019.

src/AngleSharp.Io/Cookie/AdvancedCookieProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public void AddCookie(WebCookie cookie)
169169
{
170170
_cookies.Remove(FindCookie(cookie.Domain, cookie.Path, cookie.Key));
171171
InsertCookie(cookie);
172+
WriteCookies();
172173
}
173174
}
174175

@@ -251,7 +252,6 @@ private void InsertCookie(WebCookie cookie)
251252
}
252253

253254
_cookies.Add(cookie);
254-
WriteCookies();
255255
}
256256

257257
private void WriteCookies()

src/AngleSharp.Io/Cookie/LocalFileHandler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public class LocalFileHandler : ICookieFileHandler
1717
/// <param name="filePath">The path to resolve to.</param>
1818
public LocalFileHandler(String filePath) => _filePath = filePath;
1919

20-
String ICookieFileHandler.ReadFile() => File.ReadAllText(_filePath);
20+
String ICookieFileHandler.ReadFile() => File.Exists(_filePath) ?
21+
File.ReadAllText(_filePath) : String.Empty;
2122

2223
void ICookieFileHandler.WriteFile(String content)
2324
{

src/AngleSharp.Io/IoConfigurationExtensions.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,29 @@ public static IConfiguration WithStandardDownload(this IConfiguration configurat
7272
/// <param name="configuration">The configuration to use.</param>
7373
/// <returns>The new configuration.</returns>
7474
public static IConfiguration WithRequesters(this IConfiguration configuration) =>
75-
configuration.WithRequesters(new HttpClientHandler { UseCookies = false, AllowAutoRedirect = false });
75+
configuration.WithRequesters(new HttpClientHandler());
76+
77+
/// <summary>
78+
/// Adds the requesters from the AngleSharp.Io package.
79+
/// </summary>
80+
/// <param name="configuration">The configuration to use.</param>
81+
/// <param name="httpClientHandler">
82+
/// The HTTP client handler to use for sending requests.
83+
/// </param>
84+
/// <returns>The new configuration.</returns>
85+
public static IConfiguration WithRequesters(this IConfiguration configuration, HttpClientHandler httpClientHandler)
86+
{
87+
httpClientHandler.UseCookies = false;
88+
httpClientHandler.AllowAutoRedirect = false;
89+
return configuration.WithRequesters((HttpMessageHandler)httpClientHandler);
90+
}
7691

7792
/// <summary>
7893
/// Adds the requesters from the AngleSharp.Io package.
7994
/// </summary>
8095
/// <param name="configuration">The configuration to use.</param>
8196
/// <param name="httpMessageHandler">
82-
/// The HTTP handler stack to use for sending requests.
97+
/// The HTTP message handler to use for sending requests.
8398
/// </param>
8499
/// <returns>The new configuration.</returns>
85100
public static IConfiguration WithRequesters(this IConfiguration configuration, HttpMessageHandler httpMessageHandler)

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<PropertyGroup>
33
<Description>Providers additional requesters and IO helpers for AngleSharp.</Description>
44
<Product>AngleSharp.Io</Product>
5-
<Version>0.13.0</Version>
5+
<Version>0.13.1</Version>
66
</PropertyGroup>
77
</Project>

0 commit comments

Comments
 (0)