Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion modules/lua/lua_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,13 @@ static int lua_ap_sendfile(lua_State *L)
apr_file_t *file;

rc = apr_file_open(&file, filename, APR_READ, APR_OS_DEFAULT, p);
if (rc == APR_SUCCESS) {
if (rc == APR_SUCCESS && file_info.size == 0) {
/* Nothing to send; an empty file bucket could be held by
* the core output filter until the end of the request. */
apr_file_close(file);
lua_pushinteger(L, 0);
}
else if (rc == APR_SUCCESS) {
apr_bucket_brigade *bb;

/* As ap_send_fd(), but with the brigade in the call pool.
Expand Down Expand Up @@ -2387,6 +2393,9 @@ static int lua_websocket_greet(lua_State *L)
r->bytes_sent = 0;
r->read_chunked = 0;
ap_rflush(r);
/* The connection cannot go back to HTTP after the upgrade,
* however the script ends. */
r->connection->keepalive = AP_CONN_CLOSE;
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03012)
"Websocket: Upgraded from HTTP to Websocket");
lua_pushboolean(L, 1);
Expand Down
Loading