Skip to content

Commit

Permalink
fix regex for -url supplied domains (allow http domains as well)
Browse files Browse the repository at this point in the history
  • Loading branch information
Etienne Stalmans committed Sep 6, 2016
1 parent 4e9b116 commit 08ac92e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion autodiscover/autodiscover.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ func autodiscover(domain string, mapi bool) (*utils.AutodiscoverResp, error) {

var autodiscoverURL string
//check if this is just a domain or a redirect (starts with http[s]://)
if m, _ := regexp.Match("http[s]://", []byte(domain)); m == true {

if m, _ := regexp.Match("http[s]?://", []byte(domain)); m == true {
autodiscoverURL = domain
} else {
//create the autodiscover url
Expand All @@ -111,6 +112,7 @@ func autodiscover(domain string, mapi bool) (*utils.AutodiscoverResp, error) {

req, err := http.NewRequest("POST", autodiscoverURL, strings.NewReader(r))
req.Header.Add("Content-Type", "text/xml")

if mapi == true {
req.Header.Add("X-MapiHttpCapability", "1") //we want MAPI info
req.Header.Add("X-AnchorMailbox", SessionConfig.Email) //we want MAPI info
Expand Down

0 comments on commit 08ac92e

Please sign in to comment.