Beispiel #1
0
static void
gimmix_lyrics_plugin_proxy_init (nxml_t *n)
{
	char	*proxy = NULL;
	
	if (!strncasecmp(cfg_get_key_value(conf,"proxy_enable"),"true",4))
	{
		proxy = gimmix_config_get_proxy_string ();
		nxml_set_proxy (n, proxy, NULL);
		g_free (proxy);
	}
	
	return;
}
Beispiel #2
0
mrss_error_t
mrss_parse_url_with_options_and_error (char *url, mrss_t ** ret,
				       mrss_options_t * options,
				       CURLcode * code)
{
  nxml_t *doc;
  mrss_error_t err;
  char *buffer;
  size_t size;

  if (!url || !ret)
    return MRSS_ERR_DATA;

  if (nxml_new (&doc) != NXML_OK)
    return MRSS_ERR_POSIX;

  if (options)
    {
      if (options->timeout >= 0)
	nxml_set_timeout (doc, options->timeout);

      if (options->proxy)
	nxml_set_proxy (doc, options->proxy, options->proxy_authentication);

      if (options->authentication)
	nxml_set_authentication (doc, options->authentication);

      if (options->user_agent)
	nxml_set_user_agent (doc, options->user_agent);

      nxml_set_certificate (doc, options->certfile, options->password,
			    options->cacert, options->verifypeer);
    }

  if (!(buffer = __mrss_download_file (doc, url, &size, &err, code)))
    return err;

  if (nxml_parse_buffer (doc, buffer, size) != NXML_OK)
    {
      free (buffer);
      nxml_free (doc);

      return MRSS_ERR_PARSER;
    }

  if (!(err = __mrss_parser (doc, ret)))
    {
      if (!((*ret)->file = strdup (url)))
	{
	  free (buffer);

	  mrss_free (*ret);
	  nxml_free (doc);

	  return MRSS_ERR_POSIX;
	}

      (*ret)->size = size;
    }

  free (buffer);
  nxml_free (doc);

  return err;
}