All pastes #400534 Raw Edit

Stuff

public c v1 · immutable
·published 2007-03-18 19:16 UTC
rendered paste body
#include <stdio.h>#include <string.h>#define SIZE 8192/* * kill the first reference to the x-mac-ce content-type * * */int main(int argc, char *argv[]) {        char *buf;        int again = 1;        if ((buf = (char*)malloc(SIZE)) == NULL) {                return -1;        }        while (!feof(stdin)) {                if (fgets(buf, SIZE, stdin) == NULL)                        break;                if (again && (strncasecmp(buf, "Content-Type", strlen("Content-Type")) == 0)                        && (strcasestr(buf, "charset") != NULL)                        && (strcasestr(buf, "x-mac-ce") != NULL)) {                        /* filter out the header */                        fputs("Content-Type: text/plain\r\n"                                "X-Content-Type-Converted: x-mac-ce nuked by pstros.basa.flaska.net\r\n", stdout);                        again = 0;                } else {                        fputs(buf, stdout);                }        }        return 0;}