Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Subdominator/SubdomainHijack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,18 @@ public async Task<TakeoverResult> IsDomainVulnerable(string domain, bool validat
// If we didn't get NXDOMAIN'd
if (response != null)
{
responseBody = await response.Content.ReadAsStringAsync();
try
{
responseBody = await response.Content.ReadAsStringAsync();
}
catch (InvalidOperationException)
{
// Fallback when an invalid charset is specified in the
// response headers. Read as bytes and assume UTF8 to avoid
// crashing. See GH issue #11.
var bytes = await response.Content.ReadAsByteArrayAsync();
responseBody = Encoding.UTF8.GetString(bytes);
}

// Check if HTTP status matches the fingerprint
if (fingerprint.HttpStatus.HasValue && (int)response.StatusCode == fingerprint.HttpStatus.Value)
Expand Down
Loading