|  | @@ -1954,6 +1954,9 @@ mg_get_valid_options(void)
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +/* Do not open file (used in is_file_in_memory) */
 | 
	
		
			
				|  |  | +#define MG_FOPEN_MODE_NONE (0)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  /* Open file for read only access */
 | 
	
		
			
				|  |  |  #define MG_FOPEN_MODE_READ (1)
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1978,6 +1981,10 @@ open_file_in_memory(const struct mg_connection *conn,
 | 
	
		
			
				|  |  |  		return 0;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +	if ((mode != MG_FOPEN_MODE_NONE) && (mode != MG_FOPEN_MODE_READ)) {
 | 
	
		
			
				|  |  | +		return 0;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	if (conn->ctx->callbacks.open_file) {
 | 
	
		
			
				|  |  |  		buf = conn->ctx->callbacks.open_file(conn, path, &size);
 | 
	
		
			
				|  |  |  		if (buf != NULL) {
 | 
	
	
		
			
				|  | @@ -2012,7 +2019,7 @@ open_file_in_memory(const struct mg_connection *conn,
 | 
	
		
			
				|  |  |  static int
 | 
	
		
			
				|  |  |  is_file_in_memory(const struct mg_connection *conn, const char *path)
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  | -	return open_file_in_memory(conn, path, NULL, 0);
 | 
	
		
			
				|  |  | +	return open_file_in_memory(conn, path, NULL, MG_FOPEN_MODE_NONE);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |