mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-29 14:49:00 +08:00
Merge branch 'master' of ssh://github.com/valenok/mongoose
This commit is contained in:
commit
03dd8367bf
@ -529,7 +529,7 @@ static int is_file_in_memory(struct mg_connection *conn, const char *path,
|
|||||||
struct file *filep) {
|
struct file *filep) {
|
||||||
conn->request_info.ev_data = (void *) path;
|
conn->request_info.ev_data = (void *) path;
|
||||||
if ((filep->membuf = call_user(conn, MG_OPEN_FILE)) != NULL) {
|
if ((filep->membuf = call_user(conn, MG_OPEN_FILE)) != NULL) {
|
||||||
filep->size = (int) conn->request_info.ev_data;
|
filep->size = (long) conn->request_info.ev_data;
|
||||||
}
|
}
|
||||||
return filep->membuf != NULL;
|
return filep->membuf != NULL;
|
||||||
}
|
}
|
||||||
@ -925,7 +925,7 @@ static void send_http_error(struct mg_connection *conn, int status,
|
|||||||
int len;
|
int len;
|
||||||
|
|
||||||
conn->status_code = status;
|
conn->status_code = status;
|
||||||
conn->request_info.ev_data = (void *) status;
|
conn->request_info.ev_data = (void *) (long) status;
|
||||||
if (call_user(conn, MG_HTTP_ERROR) == NULL) {
|
if (call_user(conn, MG_HTTP_ERROR) == NULL) {
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
len = 0;
|
len = 0;
|
||||||
|
@ -67,7 +67,7 @@ enum mg_event {
|
|||||||
// HTTP error must be returned to the client.
|
// HTTP error must be returned to the client.
|
||||||
// If callback returns non-NULL, Mongoose stops handling error.
|
// If callback returns non-NULL, Mongoose stops handling error.
|
||||||
// ev_data contains HTTP error code:
|
// ev_data contains HTTP error code:
|
||||||
// int http_reply_status_code = (int) request_info->ev_data;
|
// int http_reply_status_code = (long) request_info->ev_data;
|
||||||
MG_HTTP_ERROR,
|
MG_HTTP_ERROR,
|
||||||
|
|
||||||
// Mongoose logs a message.
|
// Mongoose logs a message.
|
||||||
@ -87,11 +87,11 @@ enum mg_event {
|
|||||||
// will use the returned value as a pointer to the file data. This allows
|
// will use the returned value as a pointer to the file data. This allows
|
||||||
// for example to serve files from memory.
|
// for example to serve files from memory.
|
||||||
// ev_data contains file path, including document root path.
|
// ev_data contains file path, including document root path.
|
||||||
// Upon return, ev_data should return file size, which should be an int.
|
// Upon return, ev_data should return file size, which should be a long int.
|
||||||
//
|
//
|
||||||
// const char *file_name = request_info->ev_data;
|
// const char *file_name = request_info->ev_data;
|
||||||
// if (strcmp(file_name, "foo.txt") == 0) {
|
// if (strcmp(file_name, "foo.txt") == 0) {
|
||||||
// request_info->ev_data = (void *) (int) 4;
|
// request_info->ev_data = (void *) (long) 4;
|
||||||
// return "data";
|
// return "data";
|
||||||
// }
|
// }
|
||||||
// return NULL;
|
// return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user