Skip to content

Feature/eas query profile#3

Open
remdev wants to merge 2 commits into
mainfrom
feature/eas-query-profile
Open

Feature/eas query profile#3
remdev wants to merge 2 commits into
mainfrom
feature/eas-query-profile

Conversation

@remdev
Copy link
Copy Markdown
Owner

@remdev remdev commented May 18, 2026

No description provided.

remdev added 2 commits May 18, 2026 00:55
Enable Exchange deployments that require plain MS-ASHTTP URI parameters and Outlook-style device headers without manual ExtraHeaders wiring.
Copilot AI review requested due to automatic review settings May 18, 2026 14:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Outlook-like Exchange ActiveSync profile support by introducing configurable query encoding and first-class device profile metadata for headers and Provision payloads.

Changes:

  • Adds QueryEncoding selection with plain URI query support.
  • Adds device profile fields, headers, and Provision DeviceInformation.
  • Updates README, spec coverage, and tests for query/profile behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
README.md Documents Outlook-like profile configuration.
internal/spec/coverage.csv Adds required spec rows for query/device profile behavior.
eas/provision.go Adds Provision DeviceInformation WBXML structures.
client/request.go Adds query encoding type and ordered plain query encoding.
client/request_extra_test.go Extends plain query ordering assertions.
client/integration_test.go Adds integration tests for plain queries and device headers.
client/headers.go Adds device profile header application helper.
client/cmd_provision.go Adds device information to Provision requests.
client/client.go Adds config/client fields, defaults, validation, and query encoding selection.
client/client_profile_test.go Adds Provision device information coverage.
client/client_extra_test.go Adds unknown query encoding validation test.
Comments suppressed due to low confidence (2)

client/client.go:190

  • Defaulting the device-profile fields makes them present for every client, so ApplyDeviceProfileHeaders will emit Outlook/iOS/RU/Apple headers even when the caller did not opt into that profile. It also prevents existing ExtraHeaders values for the same X-MS-Device* keys from being merged, because mergeExtraHeaders skips keys already set by these defaults, which is a breaking change for the previously documented customization path.
	if c.DeviceModel == "" {
		c.DeviceModel = defaultDeviceModel
	}
	if c.DeviceOS == "" {
		c.DeviceOS = "iOS 17.5"
	}
	if c.DeviceOSLanguage == "" {
		c.DeviceOSLanguage = "ru"
	}
	if c.Carrier == "" {
		c.Carrier = "Apple"
	}
	if c.DeviceUserAgent == "" {
		c.DeviceUserAgent = "Outlook-iOS-Android/1.0"

README.md:107

  • This recommends setting Locale for a plain-query profile, but EncodePlain does not include the locale and the Config comment says plain queries use Accept-Language instead. As written, the README implies Locale: 0x0419 affects the plain request when it is actually ignored for QueryEncodingPlain.
Many servers key off the request query shape and Outlook-style device metadata. Use `QueryEncoding: client.QueryEncodingPlain` to send `Cmd=...&User=...&DeviceId=...&DeviceType=...`, `DeviceType: "Outlook"` when emulating Outlook, and `Locale: 0x0419` with `AcceptLanguage: "ru-RU"` for ru-RU. First-class device profile fields are sent as `X-MS-Device*` headers; keep `ExtraHeaders` for integration-specific headers that are not modeled directly. If you must avoid HTTP/2 to match an older appliance or proxy, pass `ForceHTTP11: true` with `HTTPClient: nil`; if you inject your own `HTTPClient`, tune its transport yourself (`ForceHTTP11` is ignored).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

MS-ASHTTP/client.profile.force-http11,MS-ASHTTP,§2.2.1,When HTTPClient is nil and ForceHTTP11 is true New configures a client transport cloned from DefaultTransport with TLSNextProto set to a non-nil empty map to disable HTTP/2,required
MS-ASHTTP/client.query-encoding,MS-ASHTTP,§2.2.1.1.1,Config.QueryEncoding selects base64 or plain text query encoding while defaulting to base64,required
MS-ASHTTP/client.profile.device-headers,MS-ASHTTP,§2.2.2,Config device profile fields emit X-MS-DeviceModel; X-MS-DeviceOS; X-MS-DeviceOSLanguage; X-MS-DeviceCarrier; X-MS-DevicePhoneNumber; X-MS-DeviceUserAgent when set,required
MS-ASCMD/status.165.device-information-required,MS-ASCMD,§2.2.4,Status 165 indicates the client must send DeviceInformation during Provision,required
Comment thread README.md
### Outlook-like client profile

Many servers key off `DeviceType` and `Locale` (LCID), and expect additional metadata via headers rather than MS-ASHTTP query fields. Use `DeviceType: "Outlook"` when emulating Outlook; set `Locale` to `0x0409` for en-US or `0x0419` for ru-RU. Device model, OS version, or other vendor-specific strings are not separate `Config` fields—supply them with `ExtraHeaders` so they merge after the mandatory headers without replacing `User-Agent`, `MS-ASProtocolVersion`, and other values the client sets. If you must avoid HTTP/2 to match an older appliance or proxy, pass `ForceHTTP11: true` with `HTTPClient: nil`; if you inject your own `HTTPClient`, tune its transport yourself (`ForceHTTP11` is ignored).
Many servers key off the request query shape and Outlook-style device metadata. Use `QueryEncoding: client.QueryEncodingPlain` to send `Cmd=...&User=...&DeviceId=...&DeviceType=...`, `DeviceType: "Outlook"` when emulating Outlook, and `Locale: 0x0419` with `AcceptLanguage: "ru-RU"` for ru-RU. First-class device profile fields are sent as `X-MS-Device*` headers; keep `ExtraHeaders` for integration-specific headers that are not modeled directly. If you must avoid HTTP/2 to match an older appliance or proxy, pass `ForceHTTP11: true` with `HTTPClient: nil`; if you inject your own `HTTPClient`, tune its transport yourself (`ForceHTTP11` is ignored).
Comment thread client/client.go
Comment on lines +123 to +126
queryEncoding := cfg.QueryEncoding
if queryEncoding == "" {
queryEncoding = QueryEncodingBase64
}
Comment thread client/client.go
Comment on lines +99 to +108
// Device profile fields are sent as X-MS-Device* headers and in the
// Provision DeviceInformation body.
DeviceModel string
DeviceOS string
DeviceOSLanguage string
Carrier string
PhoneNumber string
DeviceUserAgent string
DeviceFriendlyName string
DeviceIMEI string
Comment thread client/cmd_provision.go
Comment on lines +69 to +79
req.DeviceInformation = &eas.DeviceInformation{
Set: eas.DeviceInformationSet{
Model: c.DeviceModel,
IMEI: c.DeviceIMEI,
FriendlyName: c.DeviceFriendlyName,
OS: c.DeviceOS,
OSLanguage: c.DeviceOSLanguage,
PhoneNumber: c.PhoneNumber,
UserAgent: c.DeviceUserAgent,
MobileOperator: c.Carrier,
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants