예제 #1
0
파일: url_list.c 프로젝트: emabo/mulk
int add_new_url_and_check(const url_list_t *base_elem, const char *url, char **relative_url)
{
	UriUriA *uri = NULL;
	url_list_t *elem;

	if ((uri = create_absolute_uri(base_elem->uri, url)) == NULL)
		goto Rejected; 

	/* check protocol */
	if (!is_uri_http(uri) && (!option_values.follow_ftp || !is_uri_ftp(uri)))
		goto Rejected; 

	/* check domains */
	if (!is_host_compatible_with_domains(uri))
		goto Rejected; 

	if (!(elem = push_unique_uri(uri, base_elem->level + 1)))
		goto Rejected; 

	if (relative_url)
		*relative_url = extract_relative_url(elem->filename, base_elem->filename);

	return 0;

Rejected:
	uri_free(uri);
	return -1;
}
예제 #2
0
파일: url_list.c 프로젝트: henrycg/mulk
void add_new_url_and_check(const char *base_url, const char *url, int level)
{
	UriUriA *uri = NULL;

	if ((uri = create_absolute_uri(base_url, url)) == NULL)
		return;

	/* check protocol */
	if (!is_uri_http(uri) && (!option_values.follow_ftp || !is_uri_ftp(uri))) {
		uri_free(uri);
		return;
	}

	/* check domains */
	if (!is_host_compatible_with_domains(uri)) {
		uri_free(uri);
		return;
	}

	push_unique_uri(uri, level);
}