0

I made a handler html.c in folder of handlers

#include "gwan.h" // G-WAN exported functions

#include <stdio.h>

int main(int argc, char *argv[ ])
{
    char header[ ] =
                //"Content-Type:text/html; charset=UTF-8\r\n"
                "Access-Control-Allow-Origin: *\r\n"
                "Cache-Control:private, max-age=600000000\r\n"
                "Expires: Thu, 31 Dec 2037 23:55:55 GMT\r\n"
                ;
    http_header(HEAD_ADD, header, sizeof(header) - 1, argv);

    char *req = (char*)get_env(argv, REQUEST); // query: "start=200000"
    printf("req: %s\n", req);

    return 200;
}

Please help. What's wrong of my code, since gwan won't generate the additional headers accordingly.
EDIT: I did try the cache.c example. It won't generate the "Expires" headers too.

Gil
  • 3,279
  • 1
  • 15
  • 25
k.k. lou
  • 1,805
  • 2
  • 13
  • 16

1 Answers1

0

There's a subtil issue caused by a system API replacement in recent releases that excludes one Content-Type handler if a handlers/main.c_ handler is present.

System API rewrites (mostly LIBC) are necessary when their behavior has changed and impact G-WAN.

A new release is on it's way thats fixes this and CGI (Perl, Python).

I'll check the cache.c example.

Gil
  • 3,279
  • 1
  • 15
  • 25