示例#1
0
文件: main.c 项目: tomohikoseven/http
static void
respond_to
(
    struct HTTPRequest  *req,   /* HTTP request */
    FILE *out,                  /* output fd    */
    char *docroot               /* docroot path */
)
{
    dbg( "req=%p, out=%p, docroot=%p\n", req, out, docroot );

    if     ( strcmp( req->method, "GET"  ) == 0 )
    {
        do_file_response( req, out, docroot );
    }
    else if( strcmp( req->method, "HEAD" ) == 0 )
    {
        do_file_response( req, out, docroot );
    }
    else if( strcmp( req->method, "POST" ) == 0 )
    {
        method_not_allowed( req, out );
    }
    else
    {
        not_implemented( req, out );
    }
}
static void respond_to(struct HTTPRequest *req, FILE *out, char *docroot) {
  if (strcmp(req->method, "GET") == 0) {
    do_file_response(req, out, docroot);
  } else if (strcmp(req->method, "HEAD") == 0) {
    do_file_response(req, out, docroot);
  } else if (strcmp(req->method, "POST") == 0) {
    method_not_allowd(req, out);
  } else {
    not_implemented(req, out);
  }
}