1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-12-22 04:02:04 +03:00

Check and simplify HTTP error code handling (Step 1/3)

This commit is contained in:
bel
2014-12-27 23:12:50 +01:00
parent 39863f7973
commit f59d79598f
2 changed files with 129 additions and 41 deletions

View File

@@ -1149,7 +1149,7 @@ static void lsp_send_err(struct mg_connection *conn, struct lua_State *L,
va_end(ap);
if (L == NULL) {
send_http_error(conn, 500, http_500_error, "%s", buf);
send_http_error(conn, 500, NULL, "%s", buf);
} else {
lua_pushstring(L, buf);
lua_error(L);
@@ -1174,7 +1174,7 @@ static int handle_lsp_request(struct mg_connection *conn, const char *path, stru
lsp_send_err(conn, ls, "mmap(%s, %zu, %d): %s", path, (size_t) filep->size,
fileno(filep->fp), strerror(errno));
} else if ((L = (ls != NULL ? ls : lua_newstate(lua_allocator, NULL))) == NULL) {
send_http_error(conn, 500, http_500_error, "%s", "luaL_newstate failed");
send_http_error(conn, 500, NULL, "%s", "luaL_newstate failed");
} else {
/* We're not sending HTTP headers here, Lua page must do it. */
if (ls == NULL) {