Pull request: 2835 fix mobileconfig

Merge in DNS/adguard-home from 2835-fix-mobileconfig to master

Updates #2835.

Squashed commit of the following:

commit 83a6fd08d4429db9e532c2788689ca542d5ddb9b
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Mar 17 13:37:14 2021 +0300

    all: imp changes' log

commit 3dabf0251b8b539509a097ac100d1b2948596668
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Mar 17 13:31:36 2021 +0300

    all: imp naming, log changes

commit c87032fdc7c61618768843a06fcf7c3db1cea593
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Mar 17 13:22:19 2021 +0300

    home: fix mobileconfig response
This commit is contained in:
Eugene Burkov 2021-03-17 13:51:26 +03:00
parent 67164f89f3
commit 3701c3f4bb
2 changed files with 17 additions and 0 deletions

View File

@ -31,10 +31,15 @@ and this project adheres to
- Go 1.14 support. - Go 1.14 support.
### Fixed
- Invalid filenames in the `mobileconfig` API responses ([#2835]).
[#2385]: https://github.com/AdguardTeam/AdGuardHome/issues/2385 [#2385]: https://github.com/AdguardTeam/AdGuardHome/issues/2385
[#2412]: https://github.com/AdguardTeam/AdGuardHome/issues/2412 [#2412]: https://github.com/AdguardTeam/AdGuardHome/issues/2412
[#2498]: https://github.com/AdguardTeam/AdGuardHome/issues/2498 [#2498]: https://github.com/AdguardTeam/AdGuardHome/issues/2498
[#2533]: https://github.com/AdguardTeam/AdGuardHome/issues/2533 [#2533]: https://github.com/AdguardTeam/AdGuardHome/issues/2533
[#2835]: https://github.com/AdguardTeam/AdGuardHome/issues/2835

View File

@ -152,6 +152,18 @@ func handleMobileConfig(w http.ResponseWriter, r *http.Request, dnsp string) {
w.Header().Set("Content-Type", "application/xml") w.Header().Set("Content-Type", "application/xml")
const (
dohContDisp = `attachment; filename=doh.mobileconfig`
dotContDisp = `attachment; filename=dot.mobileconfig`
)
contDisp := dohContDisp
if dnsp == dnsProtoTLS {
contDisp = dotContDisp
}
w.Header().Set("Content-Disposition", contDisp)
_, _ = w.Write(mobileconfig) _, _ = w.Write(mobileconfig)
} }