Skip to content

Commit

Permalink
Merge branch 'main' of github.com:spatie/dns
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Nov 25, 2021
2 parents 94d4578 + 85638e9 commit 4455a47
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to `dns` will be documented in this file

## 2.4.1 - 2021-11-18

## What's Changed

- Added support for long TXT records (see rfc4408, section 3.1.3) by @hostep in https://github.com/spatie/dns/pull/81

## New Contributors

- @hostep made their first contribution in https://github.com/spatie/dns/pull/81

**Full Changelog**: https://github.com/spatie/dns/compare/2.4.0...2.4.1

## 2.4.0 - 2021-11-17

## What's Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ You can create custom handlers. A valid handler is any class that extends from `

A custom handler class can be used by passing it to `useHandlers` on `Spatie\Dns\Dns`.

```php``
```php
$results = $this->dns
->useHandlers([new YourCustomHandler()])
->getRecords('spatie.be');
Expand Down
2 changes: 1 addition & 1 deletion src/Records/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected function prepareInt($value): int

protected function prepareText(string $value): string
{
return trim($value, '"');
return str_replace('" "', '', trim($value, '"'));
}

protected function castHost(string $value): string
Expand Down
8 changes: 8 additions & 0 deletions tests/Records/TXTTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ public function it_can_parse_string()
$this->assertSame('v=spf1 include:eu.mailgun.org include:spf.factuursturen.be include:sendgrid.net a mx ~all', $record->txt());
}

/** @test */
public function it_can_parse_long_txt_string()
{
$record = TXT::parse('spatie.be. 594 IN TXT "v=spf1 a mx ip4:100.101.102.103 ip4:104.105.106.107 ip4:108.109.110.111 ip6:1a1a:1a1a:1a1a:1a1a:1a1a:1a1a:1a1a:1a1a include:_spf.google.com include:_spf.c" "reatesend.com ~all"');

$this->assertSame('v=spf1 a mx ip4:100.101.102.103 ip4:104.105.106.107 ip4:108.109.110.111 ip6:1a1a:1a1a:1a1a:1a1a:1a1a:1a1a:1a1a:1a1a include:_spf.google.com include:_spf.createsend.com ~all', $record->txt());
}

/** @test */
public function it_can_make_from_array()
{
Expand Down

0 comments on commit 4455a47

Please sign in to comment.