Compare commits
	
		
			2 Commits
		
	
	
		
			v4.3
			...
			21b7ab585a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						21b7ab585a
	
				 | 
					
					
						|||
| 
						
						
							
						
						7587e15749
	
				 | 
					
					
						
							
								
								
									
										18
									
								
								src/client.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/client.c
									
									
									
									
									
								
							@@ -175,6 +175,20 @@ int client_request_handler(sock *client, unsigned long client_num, unsigned int
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (conf->type == CONFIG_TYPE_LOCAL) {
 | 
					    if (conf->type == CONFIG_TYPE_LOCAL) {
 | 
				
			||||||
 | 
					        if (strcmp(req.method, "TRACE") == 0) {
 | 
				
			||||||
 | 
					            res.status = http_get_status(200);
 | 
				
			||||||
 | 
					            http_add_header_field(&res.hdr, "Content-Type", "message/http");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            content_length = snprintf(msg_buf, sizeof(msg_buf) - content_length, "%s %s HTTP/%s\r\n",
 | 
				
			||||||
 | 
					                                      req.method, req.uri, req.version);
 | 
				
			||||||
 | 
					            for (int i = 0; i < req.hdr.field_num; i++) {
 | 
				
			||||||
 | 
					                content_length += snprintf(msg_buf + content_length, sizeof(msg_buf) - content_length, "%s: %s\r\n",
 | 
				
			||||||
 | 
					                                           req.hdr.fields[i][0], req.hdr.fields[i][1]);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            goto respond;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (strncmp(uri.req_path, "/.well-known/", 13) != 0 && strstr(uri.path, "/.") != NULL) {
 | 
					        if (strncmp(uri.req_path, "/.well-known/", 13) != 0 && strstr(uri.path, "/.") != NULL) {
 | 
				
			||||||
            res.status = http_get_status(403);
 | 
					            res.status = http_get_status(403);
 | 
				
			||||||
            sprintf(err_msg, "Parts of this URI are hidden.");
 | 
					            sprintf(err_msg, "Parts of this URI are hidden.");
 | 
				
			||||||
@@ -198,7 +212,6 @@ int client_request_handler(sock *client, unsigned long client_num, unsigned int
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (uri.is_static) {
 | 
					        if (uri.is_static) {
 | 
				
			||||||
            res.status = http_get_status(200);
 | 
					            res.status = http_get_status(200);
 | 
				
			||||||
            http_add_header_field(&res.hdr, "Allow", "GET, HEAD");
 | 
					 | 
				
			||||||
            http_add_header_field(&res.hdr, "Accept-Ranges", "bytes");
 | 
					            http_add_header_field(&res.hdr, "Accept-Ranges", "bytes");
 | 
				
			||||||
            if (strcmp(req.method, "GET") != 0 && strcmp(req.method, "HEAD") != 0) {
 | 
					            if (strcmp(req.method, "GET") != 0 && strcmp(req.method, "HEAD") != 0) {
 | 
				
			||||||
                res.status = http_get_status(405);
 | 
					                res.status = http_get_status(405);
 | 
				
			||||||
@@ -375,6 +388,9 @@ int client_request_handler(sock *client, unsigned long client_num, unsigned int
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    respond:
 | 
					    respond:
 | 
				
			||||||
    if (!use_rev_proxy) {
 | 
					    if (!use_rev_proxy) {
 | 
				
			||||||
 | 
					        if (conf->type == CONFIG_TYPE_LOCAL && uri.is_static && res.status->code == 405) {
 | 
				
			||||||
 | 
					            http_add_header_field(&res.hdr, "Allow", "GET, HEAD, TRACE");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if (http_get_header_field(&res.hdr, "Accept-Ranges") == NULL) {
 | 
					        if (http_get_header_field(&res.hdr, "Accept-Ranges") == NULL) {
 | 
				
			||||||
            http_add_header_field(&res.hdr, "Accept-Ranges", "none");
 | 
					            http_add_header_field(&res.hdr, "Accept-Ranges", "none");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user