* Extended the Restconf implementation with a limited www-data
* This is an experimental implementation
* Added `www-data` feature and two new config options to clixon-config.yang:
* `CLICON_WWW_DATA_PATH`
* `CLICON_WWW_DATA_ROOT`
* The limited implemtation is as follows:
* path: Local files within `CLICON_WWW_DATA_ROOT`
* operation GET, HEAD, or OPTIONS
* query parameters not supported
* indata should be NULL (no write operations)
* Limited media: text/html, JavaScript, image, and css
* Authentication as restconf
Generic changes:
* Uniform path selection across fcgi, native http/1 + http/2
This commit is contained in:
parent
e1bec5f6dd
commit
76213057b6
16 changed files with 572 additions and 41 deletions
|
|
@ -66,6 +66,7 @@
|
|||
#include "restconf_err.h"
|
||||
#include "clixon_http1_parse.h"
|
||||
#include "restconf_http1.h"
|
||||
#include "clixon_www_data.h"
|
||||
|
||||
/* Size of xml read buffer */
|
||||
#define BUFLEN 1024
|
||||
|
|
@ -411,13 +412,27 @@ restconf_http1_path_root(clicon_handle h,
|
|||
if (ret == 0) /* upgrade */
|
||||
goto upgrade;
|
||||
#endif
|
||||
/* call generic function */
|
||||
/* Matching algorithm:
|
||||
* 1. try well-known
|
||||
* 2. try /restconf
|
||||
* 3. try /data
|
||||
* 4. call restconf anyway (because it handles errors a la restconf)
|
||||
* This is for the situation where data is / and /restconf is more specific
|
||||
*/
|
||||
if (strcmp(sd->sd_path, RESTCONF_WELL_KNOWN) == 0){
|
||||
if (api_well_known(h, sd) < 0)
|
||||
goto done;
|
||||
}
|
||||
else if (api_root_restconf(h, sd, sd->sd_qvec) < 0)
|
||||
goto done;
|
||||
else if (api_path_is_restconf(h)){
|
||||
if (api_root_restconf(h, sd, sd->sd_qvec) < 0)
|
||||
goto done;
|
||||
}
|
||||
else if (api_path_is_data(h, NULL)){
|
||||
if (api_www_data(h, sd, sd->sd_qvec) < 0)
|
||||
goto done;
|
||||
}
|
||||
else if (api_root_restconf(h, sd, sd->sd_qvec) < 0) /* error handling */
|
||||
goto done;
|
||||
fail:
|
||||
if (restconf_param_del_all(h) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue