summaryrefslogtreecommitdiffstats
path: root/web/server/web_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'web/server/web_client.c')
-rw-r--r--web/server/web_client.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/web/server/web_client.c b/web/server/web_client.c
index 1a1d6315..92d97e8a 100644
--- a/web/server/web_client.c
+++ b/web/server/web_client.c
@@ -204,7 +204,9 @@ void web_client_request_done(struct web_client *w) {
break;
case WEB_CLIENT_MODE_POST:
+ case WEB_CLIENT_MODE_PUT:
case WEB_CLIENT_MODE_GET:
+ case WEB_CLIENT_MODE_DELETE:
mode = "DATA";
break;
@@ -1081,6 +1083,14 @@ static inline char *web_client_valid_method(struct web_client *w, char *s) {
s = &s[5];
w->mode = WEB_CLIENT_MODE_POST;
}
+ else if(!strncmp(s, "PUT ", 4)) {
+ s = &s[4];
+ w->mode = WEB_CLIENT_MODE_PUT;
+ }
+ else if(!strncmp(s, "DELETE ", 7)) {
+ s = &s[7];
+ w->mode = WEB_CLIENT_MODE_DELETE;
+ }
else if(!strncmp(s, "STREAM ", 7)) {
s = &s[7];
@@ -1280,12 +1290,9 @@ void web_client_build_http_header(struct web_client *w) {
w->response.data->date = now_realtime_sec();
// set a proper expiration date, if not already set
- if(unlikely(!w->response.data->expires)) {
- if(w->response.data->options & WB_CONTENT_NO_CACHEABLE)
- w->response.data->expires = w->response.data->date + localhost->rrd_update_every;
- else
- w->response.data->expires = w->response.data->date + 86400;
- }
+ if(unlikely(!w->response.data->expires))
+ w->response.data->expires = w->response.data->date +
+ ((w->response.data->options & WB_CONTENT_NO_CACHEABLE) ? 0 : 86400);
// prepare the HTTP response header
netdata_log_debug(D_WEB_CLIENT, "%llu: Generating HTTP header with response %d.", w->id, w->response.code);
@@ -1756,6 +1763,8 @@ void web_client_process_request(struct web_client *w) {
case WEB_CLIENT_MODE_FILECOPY:
case WEB_CLIENT_MODE_POST:
case WEB_CLIENT_MODE_GET:
+ case WEB_CLIENT_MODE_PUT:
+ case WEB_CLIENT_MODE_DELETE:
if(unlikely(
!web_client_can_access_dashboard(w) &&
!web_client_can_access_registry(w) &&
@@ -1888,6 +1897,8 @@ void web_client_process_request(struct web_client *w) {
case WEB_CLIENT_MODE_POST:
case WEB_CLIENT_MODE_GET:
+ case WEB_CLIENT_MODE_PUT:
+ case WEB_CLIENT_MODE_DELETE:
netdata_log_debug(D_WEB_CLIENT, "%llu: Done preparing the response. Sending data (%zu bytes) to client.", w->id, w->response.data->len);
break;
@@ -2051,7 +2062,7 @@ ssize_t web_client_send_deflate(struct web_client *w)
// ask for FINISH if we have all the input
int flush = Z_SYNC_FLUSH;
- if((w->mode == WEB_CLIENT_MODE_GET || w->mode == WEB_CLIENT_MODE_POST)
+ if((w->mode == WEB_CLIENT_MODE_GET || w->mode == WEB_CLIENT_MODE_POST || w->mode == WEB_CLIENT_MODE_PUT || w->mode == WEB_CLIENT_MODE_DELETE)
|| (w->mode == WEB_CLIENT_MODE_FILECOPY && !web_client_has_wait_receive(w) && w->response.data->len == w->response.rlen)) {
flush = Z_FINISH;
netdata_log_debug(D_DEFLATE, "%llu: Requesting Z_FINISH, if possible.", w->id);