mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-07 16:01:30 +00:00
Send extra options with OPTIONS
CL: Send extra options with OPTIONS. Integrate https://github.com/cesanta/mongoose/pull/657 PUBLISHED_FROM=6ee609a92febd8d908f7713f94fb73657443a09a
This commit is contained in:
1 parent
c2a10601b9
commit
c431904b56
3 files changed
+21
-16
No files matched your search
+8
-6
@@ -759,9 +759,9 @@ void mg_http_handler(struct mg_connection *nc, int ev,
|
||||
if (io->len > 0 &&
|
||||
(req_len = mg_parse_http(io->buf, io->len, hm, is_req)) > 0) {
|
||||
/*
|
||||
* For HTTP messages without Content-Length, always send HTTP message
|
||||
* before MG_EV_CLOSE message.
|
||||
*/
|
||||
* For HTTP messages without Content-Length, always send HTTP message
|
||||
* before MG_EV_CLOSE message.
|
||||
*/
|
||||
int ev2 = is_req ? MG_EV_HTTP_REQUEST : MG_EV_HTTP_REPLY;
|
||||
hm->message.len = io->len;
|
||||
hm->body.len = io->buf + io->len - hm->body.p;
|
||||
@@ -2556,9 +2556,11 @@ void mg_http_send_digest_auth_request(struct mg_connection *c,
|
||||
domain, (unsigned long) mg_time());
|
||||
}
|
||||
|
||||
static void mg_http_send_options(struct mg_connection *nc) {
|
||||
static void mg_http_send_options(struct mg_connection *nc,
|
||||
struct mg_serve_http_opts *opts) {
|
||||
mg_send_response_line(nc, 200, opts->extra_headers);
|
||||
mg_printf(nc, "%s",
|
||||
"HTTP/1.1 200 OK\r\nAllow: GET, POST, HEAD, CONNECT, OPTIONS"
|
||||
"Allow: GET, POST, HEAD, CONNECT, OPTIONS"
|
||||
#if MG_ENABLE_HTTP_WEBDAV
|
||||
", MKCOL, PUT, DELETE, PROPFIND, MOVE\r\nDAV: 1,2"
|
||||
#endif
|
||||
@@ -2665,7 +2667,7 @@ MG_INTERNAL void mg_send_http_file(struct mg_connection *nc, char *path,
|
||||
#endif
|
||||
#endif /* MG_ENABLE_HTTP_WEBDAV */
|
||||
} else if (!mg_vcmp(&hm->method, "OPTIONS")) {
|
||||
mg_http_send_options(nc);
|
||||
mg_http_send_options(nc, opts);
|
||||
} else if (is_directory && index_file == NULL) {
|
||||
#if MG_ENABLE_DIRECTORY_LISTING
|
||||
if (strcmp(opts->enable_directory_listing, "yes") == 0) {
|
||||
|
||||
Reference in new issue
Block a user