Http data server changes
* Indirect redirects from directory to `index.html` * Added `HTTP_DATA_INTERNAL_REDIRECT` compile-time option * Added CLICON_RESTCONF_API_ROOT to clixon-config.yang * Added 404 return without body if neither restconf, data or streams prefix match * Fixed: HTTP/1 parse error for '/' path
This commit is contained in:
parent
84d88c8ad8
commit
f11e4bad6c
10 changed files with 197 additions and 113 deletions
|
|
@ -80,15 +80,15 @@ api_path_is_restconf(clicon_handle h)
|
|||
{
|
||||
int retval = 0;
|
||||
char *path = NULL;
|
||||
char *restconf_path = RESTCONF_API;
|
||||
char *restconf_api_path;
|
||||
|
||||
if ((path = restconf_uripath(h)) == NULL)
|
||||
goto done;
|
||||
if (strlen(path) < 1 + strlen(restconf_path)) /* "/" + restconf */
|
||||
if ((restconf_api_path = clicon_option_str(h, "CLICON_RESTCONF_API_ROOT")) == NULL)
|
||||
goto done;
|
||||
if (strlen(path) < strlen(restconf_api_path)) /* "/" + restconf */
|
||||
goto done;
|
||||
if (path[0] != '/')
|
||||
goto done;
|
||||
if (strncmp(path+1, restconf_path, strlen(restconf_path)) != 0)
|
||||
if (strncmp(path, restconf_api_path, strlen(restconf_api_path)) != 0)
|
||||
goto done;
|
||||
retval = 1;
|
||||
done:
|
||||
|
|
@ -510,14 +510,7 @@ api_root_restconf(clicon_handle h,
|
|||
goto ok;
|
||||
}
|
||||
if (strlen(pvec[0]) != 0){
|
||||
if (netconf_invalid_value_xml(&xerr, "protocol", "Invalid path, /restconf/ expected") < 0)
|
||||
goto done;
|
||||
if (api_return_err0(h, req, xerr, pretty, media_out, 0) < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
if (strcmp(pvec[1], RESTCONF_API)){
|
||||
if (netconf_invalid_value_xml(&xerr, "protocol", "Invalid path, /restconf/ expected") < 0)
|
||||
if (netconf_invalid_value_xml(&xerr, "protocol", "Invalid path, restconf api root expected") < 0)
|
||||
goto done;
|
||||
if (api_return_err0(h, req, xerr, pretty, media_out, 0) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue