fix sign() when a header to add is the first added in raw mail

This commit is contained in:
Stéphane Depierrepont aka Toorop
2015-06-03 15:41:50 +02:00
parent 7cb594e75f
commit 987f4b1d99
2 changed files with 24 additions and 12 deletions

View File

@@ -309,10 +309,8 @@ func canonicalize(email *[]byte, cano string, h []string) (headers, body []byte,
}
}
if match != nil {
headersToKeepList.PushBack(match.Value.(string))
headersToKeepList.PushBack(match.Value.(string) + "\r\n")
headersList.Remove(match)
} else {
headersToKeepList.PushBack(headerToKeep + ":\r\n")
}
}
@@ -520,7 +518,7 @@ func getHeadersList(rawHeader *[]byte) (*list.List, error) {
} else {
// New header, save current if exists
if len(currentHeader) != 0 {
headersList.PushBack(string(currentHeader))
headersList.PushBack(string(bytes.TrimRight(currentHeader, "\r\n")))
currentHeader = []byte{}
}
currentHeader = append(currentHeader, line...)