A project log for micro HTTP server in C

Connect your browser to your smart devices, using a minimalist HTTP compliant server written in POSIX/C

yann-guidon-ygdesYann Guidon / YGDES 05/04/2020 at 01:020 Comments

The new version is here ! HTTaP_src.20200504.tgz

I start to remove the s(n)printf calls that look like more trouble than they're worth. Convenience vs safety, right ? I still have to convert some places to the new system that gives me more control, and less sources of potential errors (or injections).

I also implement the new /?ping definition to help the client manage its own timers.

I still have the plans in sight, to demonstrate the "flexible" program (to dynamically switch from polled to blocking mode) but this required some tweaking here and there... At least now I have a new API to expose to the user, if/when there is a suitable #define : the default is below.

// define our own HTTaP parser :
#define HTTAP_PARSE my_HTTaP_parser

int my_HTTaP_parser(
    char *request, // pointer to the request (receive buffer)
    int recv_len,  // byte count of the request
    int ReqType,   // 1 for GET, 2 for POST
    char *b,       // pointer to the send buffer
    int *len) {    // length of the send buffer

  return 0;

You can now define your own keywords without touching the other files :-)