mirror of https://github.com/google/oss-fuzz.git
31 lines
1.0 KiB
C
31 lines
1.0 KiB
C
/* Copyright 2022 Google LLC
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
#include "mongoose.h"
|
|
|
|
static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|
struct mg_http_serve_opts opts = {.root_dir = "."};
|
|
if (ev == MG_EV_HTTP_MSG) {
|
|
// Only serve static files
|
|
mg_http_serve_dir(c, ev_data, &opts);
|
|
}
|
|
}
|
|
|
|
HFND_FUZZING_ENTRY_FUNCTION(int argc, char **argv) {
|
|
struct mg_mgr mgr;
|
|
mg_mgr_init(&mgr);
|
|
mg_http_listen(&mgr, "http://0.0.0.0:8666", fn, &mgr);
|
|
for (;;) mg_mgr_poll(&mgr, 1000);
|
|
mg_mgr_free(&mgr);
|
|
return 0;
|
|
}
|