mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 14:31:20 +03:00
update fetcher registration API to return an error code.
By using an error code return we can gracefully handle fetcher registration faliures instead of just immediately aborting. The curl handler was also cleaned up and documentation improved as a side effect.
This commit is contained in:
parent
7cf5cf7cb7
commit
53f0f432dd
@ -287,14 +287,36 @@ static void fetcher_poll(void *unused)
|
||||
/* exported interface documented in content/fetch.h */
|
||||
nserror fetcher_init(void)
|
||||
{
|
||||
fetch_curl_register();
|
||||
fetch_data_register();
|
||||
fetch_file_register();
|
||||
fetch_resource_register();
|
||||
fetch_about_register();
|
||||
fetch_javascript_register();
|
||||
nserror ret;
|
||||
|
||||
return NSERROR_OK;
|
||||
ret = fetch_curl_register();
|
||||
if (ret != NSERROR_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = fetch_data_register();
|
||||
if (ret != NSERROR_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = fetch_file_register();
|
||||
if (ret != NSERROR_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = fetch_resource_register();
|
||||
if (ret != NSERROR_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = fetch_about_register();
|
||||
if (ret != NSERROR_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = fetch_javascript_register();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* exported interface documented in content/fetchers.h */
|
||||
|
@ -23,6 +23,11 @@
|
||||
#ifndef NETSURF_CONTENT_FETCHERS_FETCH_ABOUT_H
|
||||
#define NETSURF_CONTENT_FETCHERS_FETCH_ABOUT_H
|
||||
|
||||
/**
|
||||
* Register about scheme handler.
|
||||
*
|
||||
* \return NSERROR_OK on successful registration or error code on failure.
|
||||
*/
|
||||
nserror fetch_about_register(void);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,12 @@
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
void fetch_curl_register(void);
|
||||
/**
|
||||
* Register curl scheme handler.
|
||||
*
|
||||
* \return NSERROR_OK on successful registration or error code on failure.
|
||||
*/
|
||||
nserror fetch_curl_register(void);
|
||||
|
||||
/** Global cURL multi handle. */
|
||||
extern CURLM *fetch_curl_multi;
|
||||
|
@ -16,13 +16,19 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* data: URL method handler
|
||||
/**
|
||||
* \file
|
||||
* data scheme fetch handler interface.
|
||||
*/
|
||||
|
||||
#ifndef NETSURF_CONTENT_FETCHERS_FETCH_DATA_H
|
||||
#define NETSURF_CONTENT_FETCHERS_FETCH_DATA_H
|
||||
|
||||
/**
|
||||
* Register data scheme handler.
|
||||
*
|
||||
* \return NSERROR_OK on successful registration or error code on failure.
|
||||
*/
|
||||
nserror fetch_data_register(void);
|
||||
|
||||
#endif
|
||||
|
@ -16,13 +16,19 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* file: URL method handler
|
||||
/**
|
||||
* \file
|
||||
* file scheme fetcher handler interface.
|
||||
*/
|
||||
|
||||
#ifndef NETSURF_CONTENT_FETCHERS_FETCH_FILE_H
|
||||
#define NETSURF_CONTENT_FETCHERS_FETCH_FILE_H
|
||||
|
||||
/**
|
||||
* Register file scheme handler.
|
||||
*
|
||||
* \return NSERROR_OK on successful registration or error code on failure.
|
||||
*/
|
||||
nserror fetch_file_register(void);
|
||||
|
||||
#endif
|
||||
|
@ -16,8 +16,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* resource: URL method handler.
|
||||
/**
|
||||
* \file
|
||||
* resource URL scheme handler interface.
|
||||
*
|
||||
* The resource fetcher is intended to provide a flat uniform URL
|
||||
* space for browser local resources referenced by URL. Using this
|
||||
@ -34,6 +35,8 @@
|
||||
* Register the resource scheme.
|
||||
*
|
||||
* should only be called from the fetch initialise
|
||||
*
|
||||
* \return NSERROR_OK on successful registration or error code on failure.
|
||||
*/
|
||||
nserror fetch_resource_register(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user