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

5 files changed

Lines changed: 28 additions & 5 deletions

File tree

‎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
/// The path to resolve to.
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
/// The configuration to use.
7373
/// The new configuration.
7474
public static IConfiguration WithRequesters(this IConfiguration configuration) =>
75-
configuration.WithRequesters(new HttpClientHandler { UseCookies = false, AllowAutoRedirect = false });
75+
configuration.WithRequesters(new HttpClientHandler());
76+
77+
///
78+
/// Adds the requesters from the AngleSharp.Io package.
79+
///
80+
/// The configuration to use.
81+
///
82+
/// The HTTP client handler to use for sending requests.
83+
///
84+
/// The new configuration.
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
///
7893
/// Adds the requesters from the AngleSharp.Io package.
7994
///
8095
/// The configuration to use.
8196
///
82-
/// The HTTP handler stack to use for sending requests.
97+
/// The HTTP message handler to use for sending requests.
8398
///
8499
/// The new configuration.
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.IoProduct>
5-
<Version>0.13.0Version>
5+
<Version>0.13.1Version>
66
PropertyGroup>
77
Project>

0 commit comments

Comments
 (0)