{"action":"created","issue":{"url":"https://api.github.com/repos/mailgun/flanker/issues/95","labels_url":"https://api.github.com/repos/mailgun/flanker/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/mailgun/flanker/issues/95/comments","events_url":"https://api.github.com/repos/mailgun/flanker/issues/95/events","html_url":"https://github.com/mailgun/flanker/pull/95","id":86781237,"number":95,"title":"work harder to avoid re-serializing headers","user":{"login":"jeremyschlatter","id":5741620,"avatar_url":"https://avatars.githubusercontent.com/u/5741620?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremyschlatter","html_url":"https://github.com/jeremyschlatter","followers_url":"https://api.github.com/users/jeremyschlatter/followers","following_url":"https://api.github.com/users/jeremyschlatter/following{/other_user}","gists_url":"https://api.github.com/users/jeremyschlatter/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremyschlatter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremyschlatter/subscriptions","organizations_url":"https://api.github.com/users/jeremyschlatter/orgs","repos_url":"https://api.github.com/users/jeremyschlatter/repos","events_url":"https://api.github.com/users/jeremyschlatter/events{/privacy}","received_events_url":"https://api.github.com/users/jeremyschlatter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-10T00:26:01Z","updated_at":"2015-06-10T00:52:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mailgun/flanker/pulls/95","html_url":"https://github.com/mailgun/flanker/pull/95","diff_url":"https://github.com/mailgun/flanker/pull/95.diff","patch_url":"https://github.com/mailgun/flanker/pull/95.patch"},"body":"**Purpose**\n\nWe want to avoid re-serializing parsed messages, for two reasons:\n\n1. It's slow. We already have the original text, so if we can output it\n   as-is we save a bunch of work.\n2. It canonicalizes headers. This can break DKIM signatures, which hurts\n   deliverability.\n\n**Implementation**\n\nThis commit does three things:\n\n1. `message.headers[\"some-header\"] = \"some value\"` now causes a prepend\n   if \"some-header\" is not present in the message yet. Prepends are\n   better than arbitrary insertions, because they do not force us to\n   re-serialize the rest of the message.\n2. `message.headers.add(\"some-header, \"some value\")` now causes a\n   prepend, for the same reason as 1. This previously added the header\n   at the end of the list instead. I am assuming this behavior change is OK.\n3. `message.body = message.body` no longer causes the message to be\n   marked as changed.\n\nRelated commit: 9c89b875dc0eafc01c7f9725d5db5aff8f798f70"},"comment":{"url":"https://api.github.com/repos/mailgun/flanker/issues/comments/110548370","html_url":"https://github.com/mailgun/flanker/pull/95#issuecomment-110548370","issue_url":"https://api.github.com/repos/mailgun/flanker/issues/95","id":110548370,"user":{"login":"russjones","id":5017502,"avatar_url":"https://avatars.githubusercontent.com/u/5017502?v=3","gravatar_id":"","url":"https://api.github.com/users/russjones","html_url":"https://github.com/russjones","followers_url":"https://api.github.com/users/russjones/followers","following_url":"https://api.github.com/users/russjones/following{/other_user}","gists_url":"https://api.github.com/users/russjones/gists{/gist_id}","starred_url":"https://api.github.com/users/russjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/russjones/subscriptions","organizations_url":"https://api.github.com/users/russjones/orgs","repos_url":"https://api.github.com/users/russjones/repos","events_url":"https://api.github.com/users/russjones/events{/privacy}","received_events_url":"https://api.github.com/users/russjones/received_events","type":"User","site_admin":false},"created_at":"2015-06-10T00:52:25Z","updated_at":"2015-06-10T00:52:25Z","body":"lgtm."}}