FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Monkey: RFC1867 implementation for single file upload by SayantanBhattacharyya · Pull Request #234 · monkey/monkey · GitHub

/ monkey Public
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (4) .h  (2) .in  (1) .txt  (1) All 4 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
5 changes: 3 additions & 2 deletions CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,18 @@ endif()
# Default values for conf/monkey.conf
set(MK_CONF_LISTEN "2001")
set(MK_CONF_WORKERS "0")
set(MK_CONF_TIMEOUT "15")
set(MK_CONF_TIMEOUT "300")
set(MK_CONF_PIDFILE "monkey.pid")
set(MK_CONF_USERDIR "public_html")
set(MK_CONF_UPLOADDIR "/mnt/scratchpad")
set(MK_CONF_INDEXFILE "index.html index.htm index.php")
set(MK_CONF_HIDEVERSION "Off")
set(MK_CONF_RESUME "On")
set(MK_CONF_USER "www-data")
set(MK_CONF_KA "On")
set(MK_CONF_KA_TIMEOUT "5")
set(MK_CONF_KA_MAXREQ "1000")
set(MK_CONF_REQ_SIZE "32")
set(MK_CONF_REQ_SIZE "40960")
set(MK_CONF_SYMLINK "Off")
set(MK_CONF_DEFAULT_MIME "text/plain")
set(MK_CONF_FDT "On")
Expand Down
6 changes: 6 additions & 0 deletions conf/monkey.conf.in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@

UserDir @MK_CONF_USERDIR@

# UploadDir:
# ----------
# Directory location for uploaded files.

UploadDir @MK_CONF_UPLOADDIR@

# Indexfile:
# ----------
# Number of the initial file of aperture when calling a directory.
Expand Down
29 changes: 29 additions & 0 deletions include/monkey/mk_http_internal.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,30 @@
#define MK_HEADER_IOV 32
#define MK_HEADER_ETAG_SIZE 32

/*
* RFC 1867 bookkeeping data - form based file upload specific
*/
struct upload_file_info
{
int file_size;
char *filename;
};

struct form_upload_info
{
char *buffer_file;
char *startboundary;
int isMemMapped;
int headerlen;
int contentlen;
char *main_hdr;
int main_hdr_body_size;
int attr_count;
char *attr_data;
int file_count; /* Currently we support 1, no support for multipart/mixed */
struct upload_file_info *fileinfo_list;
};

struct response_headers
{
int status;
Expand Down Expand Up @@ -170,6 +194,11 @@ struct mk_http_request
struct host *host_conf; /* root vhost config */
struct host_alias *host_alias; /* specific vhost matched */

/*
* RFC 1867 bookkeeping data - form based file upload specific
*/
struct form_upload_info *form_upload_info;

/*
* Reference used outside of Monkey Core, e.g: Plugins. It can be used
* to store some relevant information associated to a request.
Expand Down
2 changes: 2 additions & 0 deletions include/monkey/mk_http_parser.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -346,4 +346,6 @@ static inline int mk_http_parser_more(struct mk_http_parser *p, int len)
int mk_http_parser(struct mk_http_request *req, struct mk_http_parser *p,
char *buffer, int len);

int mk_http_header_pre_parse_rfc1867(struct mk_http_session *cs, struct mk_http_request *sr);

#endif /* MK_HTTP_H */
9 changes: 9 additions & 0 deletions mk_server/mk_config.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ void mk_config_free_all()
mk_mem_free(mk_config->user_dir);
}

if (mk_config->upload_dir) {
mk_mem_free(mk_config->upload_dir);
}

/* free config->index_files */
if (mk_config->index_files) {
mk_string_split_free(mk_config->index_files);
Expand Down Expand Up @@ -373,6 +377,10 @@ static void mk_config_read_files(char *path_conf, char *file_conf)
mk_config->user_dir = mk_rconf_section_get_key(section,
"UserDir", MK_RCONF_STR);

/* File upload directory */
mk_config->upload_dir = mk_rconf_section_get_key(section,
"UploadDir", MK_RCONF_STR);

/* Index files */
mk_config->index_files = mk_rconf_section_get_key(section,
"Indexfile", MK_RCONF_LIST);
Expand Down Expand Up @@ -562,6 +570,7 @@ void mk_config_set_init_values(void)
mk_config->open_flags = O_RDONLY | O_NONBLOCK;
mk_config->index_files = NULL;
mk_config->user_dir = NULL;
mk_config->upload_dir = NULL;

/* TCP REUSEPORT: available on Linux >= 3.9 */
if (mk_config->scheduler_mode == -1) {
Expand Down
Loading

Back | FazBrowse Home | New Git URL