aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-08-06 19:27:02 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-08-06 19:27:02 +0200
commit7575e07b9f10fc115b62022a9cc96098f072afac (patch)
tree8ebe1400131e84e7582f2da2c4602db09c212324
parentf9226dde7b37064c235123d523a5c5a1a9b09f5d (diff)
downloadmblaze-7575e07b9f10fc115b62022a9cc96098f072afac.tar.gz
blaze822: keep a pointer to the original header, if we have it anyway
-rw-r--r--blaze822.c10
-rw-r--r--blaze822.h2
-rw-r--r--blaze822_priv.h1
3 files changed, 12 insertions, 1 deletions
diff --git a/blaze822.c b/blaze822.c
index 84d56b4..5a98915 100644
--- a/blaze822.c
+++ b/blaze822.c
@@ -349,7 +349,7 @@ blaze822(char *file)
mesg->msg = buf;
mesg->end = end;
- mesg->body = mesg->bodyend = mesg->bodychunk = 0;
+ mesg->body = mesg->bodyend = mesg->bodychunk = mesg->orig_header = 0;
return mesg;
}
@@ -391,6 +391,7 @@ blaze822_mem(char *src, size_t len)
mesg->msg = buf;
mesg->end = end;
mesg->bodychunk = 0; // src is not ours
+ mesg->orig_header = src;
return mesg;
}
@@ -558,6 +559,7 @@ blaze822_mmap(char *file)
mesg->msg = mesg->bodychunk = buf;
mesg->end = end;
mesg->bodyend = buf + len;
+ mesg->orig_header = 0;
return mesg;
@@ -578,6 +580,12 @@ blaze822_body(struct message *mesg)
return mesg->body;
}
+char *
+blaze822_orig_header(struct message *mesg)
+{
+ return mesg->orig_header;
+}
+
size_t
blaze822_bodylen(struct message *mesg)
{
diff --git a/blaze822.h b/blaze822.h
index 0f8329b..2ffc031 100644
--- a/blaze822.h
+++ b/blaze822.h
@@ -24,6 +24,8 @@ char *blaze822_body(struct message *mesg);
size_t blaze822_bodylen(struct message *mesg);
size_t blaze822_headerlen(struct message *mesg);
+char *blaze822_orig_header(struct message *mesg);
+
// rfc2047.c
int blaze822_decode_rfc2047(char *, char *, size_t, char *);
diff --git a/blaze822_priv.h b/blaze822_priv.h
index bf895d3..c871ca7 100644
--- a/blaze822_priv.h
+++ b/blaze822_priv.h
@@ -4,6 +4,7 @@ struct message {
char *body;
char *bodyend;
char *bodychunk;
+ char *orig_header;
};
// WSP = SP / HTAB