}
char *end_of_this_line = strstr(ptr, "\r\n");
+ // remove whitespace at the end of the line
+ int replaced_something;
+ do {
+ replaced_something = 0;
+ char *trailing_space = strstr(ptr, " \r\n"); // line ends in a space?
+ if (!trailing_space) { // no?
+ trailing_space = strstr(ptr, "\t\r\n"); // how about a tab?
+ }
+ if (trailing_space) {
+ StrBufReplaceToken(headers, (long)(trailing_space-cheaders), 3, HKEY("\r\n"));
+ ++replaced_something;
+ }
+ } while (replaced_something);
+
// Convert header field names to all lower case
for (char *c = start_of_this_line; c<colon; ++c) {
cheaders[c-cheaders] = tolower(cheaders[c-cheaders]);
ptr = end_of_this_line + 2; // Advance to the beginning of the next line
}
+ fprintf(stderr, "\033[7m%s\033[0m", (char *)ChrPtr(headers));
}
"From: Fred Bloggs <bloggs@dev.citadel.org>\r\n"
"X-irrelevant-header: wow mom 303\r\n"
"To: Bread Floggs <bf@example.com>\r\n"
- "Subject: The ultimate test message!\r\n"
+ "Subject: The ultimate test message! \r\n"
"Message-ID: <73294856-8726543-473298@dev.citadel.org>\r\n"
"\r\n"
"Hi.\r\n"
"Bhille Disassemble. Highly recommend.\r\n"
"\r\n"
"--Fred\r\n"
+
+
));
// create signature