404 processing

This commit is contained in:
Andy Green 2018-04-13 06:43:11 +08:00
parent 65f87efca9
commit 8d79eaf124
3 changed files with 8 additions and 8 deletions

View file

@ -559,9 +559,6 @@ lws_create_vhost(struct lws_context *context,
vh->name = info->vhost_name;
vh->error_document_404 = info->error_document_404;
if (info->error_document_404 &&
info->error_document_404[0] == '/')
vh->error_document_404 = info->error_document_404 + 1;
if (info->options & LWS_SERVER_OPTION_ONLY_RAW)
lwsl_info("%s set to only support RAW\n", vh->name);

View file

@ -49,7 +49,7 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len)
wsi, wsi->vhost->name, wsi->protocol->name,
wsi->role_ops->name,
(unsigned long)len);
assert(0);
// assert(0);
return -1;
}

View file

@ -481,7 +481,8 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
wsi->http.fop_fd = fops->LWS_FOP_OPEN(wsi->context->fops,
path, vpath, &fflags);
if (!wsi->http.fop_fd) {
lwsl_info("Unable to open '%s': errno %d\n", path, errno);
lwsl_info("%s: Unable to open '%s': errno %d\n",
__func__, path, errno);
return -1;
}
@ -2150,9 +2151,11 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
wsi->http.fop_fd = fops->LWS_FOP_OPEN(wsi->context->fops,
file, vpath, &fflags);
if (!wsi->http.fop_fd) {
lwsl_info("Unable to open: '%s': errno %d\n", file, errno);
return -1;
lwsl_info("%s: Unable to open: '%s': errno %d\n",
__func__, file, errno);
if (lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, NULL))
return -1;
return !wsi->http2_substream;
}
}
wsi->http.filelen = lws_vfs_get_length(wsi->http.fop_fd);