}
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));
}