static void do_test (SoupSession *session, SoupURI *base_uri, int n) { SoupURI *uri; SoupMessage *msg; TestRequest *req; debug_printf (1, "%2d. %s %s\n", n + 1, tests[n].requests[0].method, tests[n].requests[0].path); uri = soup_uri_new_with_base (base_uri, tests[n].requests[0].path); msg = soup_message_new_from_uri (tests[n].requests[0].method, uri); soup_uri_free (uri); if (msg->method == SOUP_METHOD_POST) { soup_message_set_request (msg, "text/plain", SOUP_MEMORY_STATIC, "post body", strlen ("post body")); } req = &tests[n].requests[0]; g_signal_connect (msg, "got_headers", G_CALLBACK (got_headers), &req); g_signal_connect (msg, "restarted", G_CALLBACK (restarted), &req); soup_session_send_message (session, msg); g_object_unref (msg); debug_printf (2, "\n"); }
JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1soup_1uri_1free) (JNIEnv *env, jclass that, jintLong arg0) { WebKitGTK_NATIVE_ENTER(env, that, _1soup_1uri_1free_FUNC); soup_uri_free((SoupURI *)arg0); WebKitGTK_NATIVE_EXIT(env, that, _1soup_1uri_1free_FUNC); }
int main (int argc, char **argv) { test_init (argc, argv, NULL); #ifdef HAVE_APACHE apache_init (); #endif server = soup_test_server_new (TRUE); soup_server_add_handler (server, NULL, server_callback, "http", NULL); base_uri = soup_uri_new ("http://127.0.0.1/"); soup_uri_set_port (base_uri, soup_server_get_port (server)); do_content_length_framing_test (); do_persistent_connection_timeout_test (); do_max_conns_test (); do_non_persistent_connection_test (); do_non_idempotent_connection_test (); #ifdef HAVE_APACHE do_connection_state_test (); do_connection_event_test (); #endif soup_uri_free (base_uri); soup_test_server_quit_unref (server); test_cleanup (); return errors != 0; }
static void redirect_handler (SoupMessage *msg, gpointer user_data) { if (SOUP_STATUS_IS_REDIRECTION (msg->status_code)) { CallbackInfo *info = user_data; SoupURI *new_uri; const gchar *new_loc; new_loc = soup_message_headers_get (msg->response_headers, "Location"); if (!new_loc) return; info->reset=1; new_uri = soup_uri_new_with_base (soup_message_get_uri (msg), new_loc); if (!new_uri) { soup_message_set_status_full (msg, SOUP_STATUS_MALFORMED, "Invalid Redirect URL"); return; } soup_message_set_uri (msg, new_uri); soup_session_requeue_message (info->ss, msg); soup_uri_free (new_uri); } }
CString WebKitTestServer::getURIForPath(const char* path) { SoupURI* uri = soup_uri_new_with_base(m_baseURI, path); GUniquePtr<gchar> uriString(soup_uri_to_string(uri, FALSE)); soup_uri_free(uri); return uriString.get(); }
static void impl_start (RBPodcastSearch *bsearch, const char *text, int max_results) { SoupURI *uri; SoupMessage *message; char *limit; RBPodcastSearchMiroGuide *search = RB_PODCAST_SEARCH_MIROGUIDE (bsearch); search->session = soup_session_async_new_with_options (SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_DEFAULT, NULL); uri = soup_uri_new (MIROGUIDE_SEARCH_URI); limit = g_strdup_printf ("%d", max_results); soup_uri_set_query_from_fields (uri, "filter", "audio", "filter_value", "1", "filter", "name", "filter_value", text, "sort", "popular", /* hmm */ "limit", limit, "datatype", "json", NULL); g_free (limit); message = soup_message_new_from_uri (SOUP_METHOD_GET, uri); soup_uri_free (uri); soup_session_queue_message (search->session, message, (SoupSessionCallback) search_response_cb, search); }
static void t5_http_req_callback (SoupSession *session, SoupMessage *msg, gpointer data) { guint status_code; gchar *method; SoupURI *uri; const gchar *header; g_object_get (G_OBJECT (msg), "method", &method, "status-code", &status_code, "uri", &uri, NULL); GST_WARNING ("%s %s status code: %d, expected %d", method, soup_uri_get_path (uri), status_code, SOUP_STATUS_CANCELLED); BOOST_CHECK (status_code == SOUP_STATUS_CANCELLED); /* TODO: Check why soup_cookies_from_response does not work */ header = soup_message_headers_get_list (msg->response_headers, "Set-Cookie"); BOOST_CHECK (header != NULL); cookie = soup_cookie_parse (header, NULL); BOOST_CHECK (cookie != NULL); t5_send_get_request_2(); soup_uri_free (uri); g_free (method); }
static const gchar * cal_backend_http_ensure_uri (ECalBackendHttp *backend) { ESource *source; ESourceSecurity *security_extension; ESourceWebdav *webdav_extension; SoupURI *soup_uri; gboolean secure_connection; const gchar *extension_name; gchar *uri_string; if (backend->priv->uri != NULL) return backend->priv->uri; source = e_backend_get_source (E_BACKEND (backend)); extension_name = E_SOURCE_EXTENSION_SECURITY; security_extension = e_source_get_extension (source, extension_name); extension_name = E_SOURCE_EXTENSION_WEBDAV_BACKEND; webdav_extension = e_source_get_extension (source, extension_name); secure_connection = e_source_security_get_secure (security_extension); soup_uri = e_source_webdav_dup_soup_uri (webdav_extension); uri_string = soup_uri_to_string (soup_uri, FALSE); soup_uri_free (soup_uri); backend->priv->uri = webcal_to_http_method ( uri_string, secure_connection); g_free (uri_string); return backend->priv->uri; }
static void do_dot_dot_test (void) { SoupSession *session; SoupMessage *msg; SoupURI *uri; debug_printf (1, "\n'..' smuggling test\n"); session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL); uri = soup_uri_new_with_base (base_uri, "/..%2ftest"); msg = soup_message_new_from_uri ("GET", uri); soup_uri_free (uri); soup_session_send_message (session, msg); if (msg->status_code != SOUP_STATUS_BAD_REQUEST) { debug_printf (1, " FAILED: %d %s (expected Bad Request)\n", msg->status_code, msg->reason_phrase); errors++; } g_object_unref (msg); soup_test_session_abort_unref (session); }
int main (int argc, char **argv) { GMainLoop *loop; SoupServer *server; guint port; SoupURI *base_uri; test_init (argc, argv, NULL); server = soup_test_server_new (TRUE); soup_server_add_handler (server, NULL, server_callback, NULL, NULL); port = soup_server_get_port (server); loop = g_main_loop_new (NULL, TRUE); base_uri = soup_uri_new ("http://127.0.0.1"); soup_uri_set_port (base_uri, port); do_chunk_tests (base_uri); soup_uri_free (base_uri); g_main_loop_unref (loop); soup_test_server_quit_unref (server); test_cleanup (); return errors != 0; }
/* * FIXME: make this bullet proof wrt uri scheme. */ static char * url (GSList const *args, void *user_data) { char *resolved_path; char *ret; #ifdef CCSS_WITH_SOUP char *given_path; SoupURI *uri; g_return_val_if_fail (args, NULL); given_path = g_strdup_printf ("file:///%s", (char const *) args->data); uri = soup_uri_new (given_path); g_free (given_path), given_path = NULL; resolved_path = gtk_rc_find_pixmap_in_path (gtk_settings_get_default (), NULL, uri->path); soup_uri_set_path (uri, resolved_path); g_free (resolved_path), resolved_path = NULL; ret = soup_uri_to_string (uri, false); soup_uri_free (uri), uri = NULL; #else char const *given_path; g_return_val_if_fail (args, NULL); given_path = (char const *) args->data; resolved_path = gtk_rc_find_pixmap_in_path (gtk_settings_get_default (), NULL, given_path); ret = g_strdup_printf ("file:///%s", resolved_path); g_free (resolved_path), resolved_path = NULL; #endif return ret; }
static void add_image (GrlTmdbSource *self, GrlMedia *media, GrlKeyID detail_key, const char *image_path) { SoupURI *uri; GrlRelatedKeys *related_keys; char *str; int i, l; str = g_strconcat ("original", image_path, NULL); uri = soup_uri_new_with_base (self->priv->image_base_uri, str); g_free (str); str = soup_uri_to_string (uri, FALSE); l = grl_data_length (GRL_DATA (media), detail_key); for (i = 0; i < l; ++i) { related_keys = grl_data_get_related_keys (GRL_DATA (media), detail_key, i); if (g_strcmp0 (grl_related_keys_get_string (related_keys, detail_key), str) == 0) break; } if (i == l) { grl_data_add_string (GRL_DATA (media), detail_key, str); } g_free (str); soup_uri_free (uri); }
int main(int argc, char** argv) { SoupServer* server; SoupURI* soup_uri; gtk_test_init(&argc, &argv, NULL); /* Hopefully make test independent of the path it's called from. */ testutils_relative_chdir("Source/WebKit/gtk/tests/resources/test.html", argv[0]); server = soup_server_new(SOUP_SERVER_PORT, 0, NULL); soup_server_run_async(server); soup_server_add_handler(server, NULL, server_callback, NULL, NULL); soup_uri = soup_uri_new("http://127.0.0.1/"); soup_uri_set_port(soup_uri, soup_server_get_port(server)); base_uri = soup_uri_to_string(soup_uri, FALSE); soup_uri_free(soup_uri); g_test_bug_base("https://bugs.webkit.org/"); g_test_add_func("/webkit/webview/icon-uri", test_webkit_web_view_icon_uri); g_test_add_func("/webkit/webview/adjustments", test_webkit_web_view_adjustments); g_test_add_func("/webkit/webview/destroy", test_webkit_web_view_destroy); g_test_add_func("/webkit/webview/grab_focus", test_webkit_web_view_grab_focus); g_test_add_func("/webkit/webview/window-features", test_webkit_web_view_window_features); g_test_add_func("/webkit/webview/webview-in-offscreen-window-does-not-crash", test_webkit_web_view_in_offscreen_window_does_not_crash); g_test_add_func("/webkit/webview/webview-does-not-steal-focus", test_webkit_web_view_does_not_steal_focus); g_test_add_data_func("/webkit/webview/fullscreen", GINT_TO_POINTER(FALSE), test_webkit_web_view_fullscreen); g_test_add_data_func("/webkit/webview/fullscreen-blocked", GINT_TO_POINTER(TRUE), test_webkit_web_view_fullscreen); g_test_add_func("/webkit/webview/file-chooser", test_webkit_web_view_file_chooser); return g_test_run (); }
int main (int argc, char **argv) { GMainLoop *loop; SoupServer *server; guint port; SoupURI *base_uri; test_init (argc, argv, no_test_entry); server = soup_test_server_new (TRUE); soup_server_add_handler (server, NULL, server_callback, NULL, NULL); port = soup_server_get_port (server); loop = g_main_loop_new (NULL, TRUE); if (run_tests) { base_uri = soup_uri_new ("http://127.0.0.1"); soup_uri_set_port (base_uri, port); do_redirect_tests (base_uri); soup_uri_free (base_uri); } else { printf ("Listening on port %d\n", port); g_main_loop_run (loop); } g_main_loop_unref (loop); if (run_tests) test_cleanup (); return errors != 0; }
char * ephy_sync_utils_make_audience (const char *url) { SoupURI *uri; const char *scheme; const char *host; char *audience; char *port; g_return_val_if_fail (url != NULL, NULL); uri = soup_uri_new (url); scheme = soup_uri_get_scheme (uri); host = soup_uri_get_host (uri); port = g_strdup_printf (":%u", soup_uri_get_port (uri)); /* Even if the url doesn't contain the port, soup_uri_get_port() will return * the default port for the url's scheme so we need to check if the port was * really present in the url. */ if (g_strstr_len (url, -1, port) != NULL) audience = g_strdup_printf ("%s://%s%s", scheme, host, port); else audience = g_strdup_printf ("%s://%s", scheme, host); g_free (port); soup_uri_free (uri); return audience; }
static void do_aliases_test_for_session (SoupSession *session, const char *redirect_protocol) { SoupMessage *msg; SoupURI *uri; const char *redirected_protocol; uri = soup_uri_new_with_base (base_uri, "/alias-redirect"); msg = soup_message_new_from_uri ("GET", uri); if (redirect_protocol) soup_message_headers_append (msg->request_headers, "X-Redirect-Protocol", redirect_protocol); soup_uri_free (uri); soup_session_send_message (session, msg); redirected_protocol = soup_message_headers_get_one (msg->response_headers, "X-Redirected-Protocol"); if (g_strcmp0 (redirect_protocol, redirected_protocol)) { debug_printf (1, " redirect went to %s, should have gone to %s!\n", redirected_protocol ? redirected_protocol : "(none)", redirect_protocol ? redirect_protocol : "(none)"); errors++; } else if (redirect_protocol && !SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) { debug_printf (1, " msg failed? (%d %s)\n", msg->status_code, msg->reason_phrase); errors++; } else if (!redirect_protocol && SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) { debug_printf (1, " msg succeeded? (%d %s)\n", msg->status_code, msg->reason_phrase); errors++; } g_object_unref (msg); }
static void test_package_installation_failure_aborts(void) { soup_session = soup_session_new(); ExpectHttpServer *expect_http = expect_http_start(); ExpectHttpRequest request = { "POST", "/recipes/123/tasks/456/status", "status=Aborted&message=While+installing+package+" "beaker%2Ddistribution%2Dinstall%2Dfail%3A+" "Child+process+exited+with+code+1", 204 }; expect_http_add_request(expect_http, &request); Task task = { "456", NULL, soup_uri_new("http://localhost:8000/recipes/123/tasks/456/"), "/distribution/install", "/mnt/tests/distribution/install", TASK_FETCH_INSTALL_PACKAGE, { .package_name = "beaker-distribution-install-fail" }, NULL, NULL, FALSE, FALSE, NULL, TRUE, "make run", 0, }; restraint_task_run(&task); expect_http_finish(expect_http); soup_uri_free(task.task_uri); }
void network_set_proxy (gchar *host, guint port, gchar *user, gchar *password) { /* FIXME: make arguments const and use the SoupURI in network_get_proxy_* ? */ g_free (proxyname); g_free (proxyusername); g_free (proxypassword); proxyname = host; proxyport = port; proxyusername = user; proxypassword = password; /* The sessions will be NULL if we were called from conf_init() as that's called * before net_init() */ if (session) { SoupURI *newproxy = network_get_proxy_uri (); g_object_set (G_OBJECT (session), SOUP_SESSION_PROXY_URI, newproxy, NULL); if (newproxy) soup_uri_free (newproxy); } debug4 (DEBUG_NET, "proxy set to http://%s:%s@%s:%d", user, password, host, port); network_monitor_proxy_changed (); }
static void t4_http_req_callback (SoupSession *session, SoupMessage *msg, gpointer data) { SoupKnownStatusCode *expected = (SoupKnownStatusCode *) data; guint status_code; gchar *method; SoupURI *uri; const gchar *cookie_str; g_object_get (G_OBJECT (msg), "method", &method, "status-code", &status_code, "uri", &uri, NULL); GST_DEBUG ("%s %s status code: %d, expected %d", method, soup_uri_get_path (uri), status_code, *expected); BOOST_CHECK (status_code == *expected); /* TODO: Check why soup_cookies_from_response does not work */ cookie_str = soup_message_headers_get_list (msg->response_headers, "Set-Cookie"); BOOST_CHECK (cookie_str != NULL); if (++counted == urls_registered) g_main_loop_quit (loop); soup_uri_free (uri); g_free (method); }
static gboolean run_check (gpointer user_data) { NMConnectivity *self = NM_CONNECTIVITY (user_data); NMConnectivityPrivate *priv; SoupURI *soup_uri; SoupMessage *msg; g_return_val_if_fail (NM_IS_CONNECTIVITY (self), FALSE); priv = NM_CONNECTIVITY_GET_PRIVATE (self); /* check given url async */ soup_uri = soup_uri_new (priv->uri); if (soup_uri && SOUP_URI_VALID_FOR_HTTP (soup_uri)) { msg = soup_message_new_from_uri ("GET", soup_uri); soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT); soup_session_queue_message (priv->soup_session, msg, nm_connectivity_check_cb, self); priv->running = TRUE; g_object_notify (G_OBJECT (self), NM_CONNECTIVITY_RUNNING); nm_log_dbg (LOGD_CORE, "Connectivity check with uri '%s' started.", priv->uri); } else nm_log_err (LOGD_CORE, "Invalid uri '%s' for connectivity check.", priv->uri); if (soup_uri) soup_uri_free (soup_uri); return TRUE; /* keep firing */ }
/** * seahorse_hkp_is_valid_uri * @uri: The uri to check * * Returns: Whether the passed uri is valid for an HKP key source */ gboolean seahorse_hkp_is_valid_uri (const gchar *uri) { SoupURI *soup; gboolean ret = FALSE; gchar *t; g_return_val_if_fail (uri && uri[0], FALSE); /* Replace 'hkp' with 'http' at the beginning of the URI */ if (strncasecmp (uri, "hkp:", 4) == 0) { t = g_strdup_printf("http:%s", uri + 4); soup = soup_uri_new (t); g_free (t); /* Not 'hkp', but maybe 'http' */ } else { soup = soup_uri_new (uri); } if (soup) { /* Must be http or https, have a host. No querystring, user, path, passwd etc... */ if ((soup->scheme == SOUP_URI_SCHEME_HTTP || soup->scheme == SOUP_URI_SCHEME_HTTPS) && !soup->user && !soup->password && !soup->query && !soup->fragment && soup->host && g_str_equal (soup->path ? soup->path : "/", "/")) ret = TRUE; soup_uri_free (soup); } return ret; }
static void force_io_streams_init (void) { SoupServer *server; SoupSession *session; guint port; SoupURI *base_uri; SoupMessage *msg; /* Poke libsoup enough to cause SoupBodyInputStream and * SoupBodyOutputStream to get defined, so we can find them * via g_type_from_name() later. */ server = soup_test_server_new (TRUE); port = soup_server_get_port (server); base_uri = soup_uri_new ("http://127.0.0.1"); soup_uri_set_port (base_uri, port); session = soup_test_session_new (SOUP_TYPE_SESSION, NULL); msg = soup_message_new_from_uri ("POST", base_uri); soup_session_send_message (session, msg); g_object_unref (msg); soup_test_session_abort_unref (session); soup_uri_free (base_uri); soup_test_server_quit_unref (server); }
// Called each time the message is going to be sent again except the first time. // It's used mostly to let webkit know about redirects. static void restartedCallback(SoupMessage* msg, gpointer data) { ResourceHandle* handle = static_cast<ResourceHandle*>(data); if (!handle) return; ResourceHandleInternal* d = handle->getInternal(); if (d->m_cancelled) return; char* uri = soup_uri_to_string(soup_message_get_uri(msg), false); String location = String(uri); g_free(uri); KURL newURL = KURL(handle->request().url(), location); // FIXME: This is needed because some servers use broken URIs in // their Location header, when redirecting, such as URIs with // white spaces instead of %20; this should be fixed in soup, in // the future, and this work-around removed. // See http://bugzilla.gnome.org/show_bug.cgi?id=575378. SoupURI* soup_uri = soup_uri_new(newURL.string().utf8().data()); soup_message_set_uri(msg, soup_uri); soup_uri_free(soup_uri); ResourceRequest request = handle->request(); ResourceResponse response; request.setURL(newURL); fillResponseFromMessage(msg, &response); if (d->client()) d->client()->willSendRequest(handle, request, response); }
static void queue_message_restarted (SoupMessage *msg, gpointer user_data) { SoupMessageQueueItem *item = user_data; if (item->proxy_addr) { g_object_unref (item->proxy_addr); item->proxy_addr = NULL; } if (item->proxy_uri) { soup_uri_free (item->proxy_uri); item->proxy_uri = NULL; } if (item->conn && (!soup_message_is_keepalive (msg) || SOUP_STATUS_IS_REDIRECTION (msg->status_code))) { if (soup_connection_get_state (item->conn) == SOUP_CONNECTION_IN_USE) soup_connection_set_state (item->conn, SOUP_CONNECTION_IDLE); g_object_unref (item->conn); item->conn = NULL; } g_cancellable_reset (item->cancellable); item->state = SOUP_MESSAGE_STARTING; }
int main (int argc, char **argv) { SoupAuthDomain *auth_domain; test_init (argc, argv, NULL); server = soup_test_server_new (TRUE); soup_server_add_handler (server, NULL, server_callback, NULL, NULL); base_uri = soup_uri_new ("http://127.0.0.1/"); soup_uri_set_port (base_uri, soup_server_get_port (server)); auth_domain = soup_auth_domain_basic_new ( SOUP_AUTH_DOMAIN_REALM, "misc-test", SOUP_AUTH_DOMAIN_ADD_PATH, "/auth", SOUP_AUTH_DOMAIN_BASIC_AUTH_CALLBACK, auth_callback, NULL); soup_server_add_auth_domain (server, auth_domain); g_object_unref (auth_domain); do_host_test (); do_callback_unref_test (); do_msg_reuse_test (); do_star_test (); do_early_abort_test (); do_content_length_framing_test (); do_accept_language_test (); do_persistent_connection_timeout_test (); soup_uri_free (base_uri); soup_test_server_quit_unref (server); test_cleanup (); return errors != 0; }
int main(int argc, char **argv) { gtk_test_init(&argc, &argv, NULL); /* This hopefully makes the test independent of the path it's called from. */ testutils_relative_chdir("Source/WebKit/gtk/tests/resources/test.html", argv[0]); SoupServer *server = soup_server_new(SOUP_SERVER_PORT, 0, NULL); soup_server_run_async(server); soup_server_add_handler(server, NULL, serverCallback, NULL, NULL); SoupURI *soupURI = soup_uri_new("http://127.0.0.1/"); soup_uri_set_port(soupURI, soup_server_get_port(server)); baseURI = soup_uri_to_string(soupURI, FALSE); soup_uri_free(soupURI); g_test_bug_base("https://bugs.webkit.org/"); g_test_add_func("/webkit/favicondatabase/set-path", testWebKitFaviconDatabaseSetPath); // These two tests will trigger an ASSERTION on debug builds due // to http://webkit.org/b/67582. Remove the guards once the bug is fixed. #ifdef NDEBUG g_test_add_func("/webkit/favicondatabase/get-favicon", testWebKitFaviconDatabaseGetFavicon); g_test_add_func("/webkit/favicondatabase/get-favicon-uri", testWebKitFaviconDatabaseGetFaviconURI); #endif g_test_add_func("/webkit/favicondatabase/remove-all", testWebKitFaviconDatabaseRemoveAll); g_test_add_func("/webkit/favicondatabase/close-db", testWebKitFaviconDatabaseCloseDatabase); return g_test_run(); }
static void do_connection_state_test_for_session (SoupSession *session) { SoupConnectionState state; SoupURI *proxy_uri; g_signal_connect (session, "connection-created", G_CALLBACK (connection_created), &state); debug_printf (1, " http\n"); do_one_connection_state_test (session, HTTP_SERVER); debug_printf (1, " https\n"); do_one_connection_state_test (session, HTTPS_SERVER); proxy_uri = soup_uri_new (HTTP_PROXY); g_object_set (G_OBJECT (session), SOUP_SESSION_PROXY_URI, proxy_uri, NULL); soup_uri_free (proxy_uri); debug_printf (1, " http with proxy\n"); do_one_connection_state_test (session, HTTP_SERVER); debug_printf (1, " https with proxy\n"); do_one_connection_state_test (session, HTTPS_SERVER); }
gchar * find_domain(const gchar *s, int toplevel) { SoupURI *uri; gchar *ret, *p; if (s == NULL) return (NULL); uri = soup_uri_new(s); if (uri == NULL || !SOUP_URI_VALID_FOR_HTTP(uri)) { return (NULL); } if (toplevel && !isdigit(uri->host[strlen(uri->host) - 1])) { p = tld_get_suffix(uri->host); } else p = uri->host; ret = g_strdup_printf(".%s", p); soup_uri_free(uri); return (ret); }
char * flickr_proxy_build_login_url (FlickrProxy *proxy, const char *frob, const char *perms) { SoupURI *uri; GHashTable *params; char *sig, *s; g_return_val_if_fail (FLICKR_IS_PROXY (proxy), NULL); uri = soup_uri_new ("http://flickr.com/services/auth/"); params = g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_insert (params, "api_key", proxy->priv->api_key); g_hash_table_insert (params, "perms", (gpointer)perms); if (frob) g_hash_table_insert (params, "frob", (gpointer)frob); sig = flickr_proxy_sign (proxy, params); g_hash_table_insert (params, "api_sig", sig); soup_uri_set_query_from_form (uri, params); s = soup_uri_to_string (uri, FALSE); g_free (sig); g_hash_table_destroy (params); soup_uri_free (uri); return s; }
static void impl_start (RBPodcastSearch *bsearch, const char *text, int max_results) { SoupURI *uri; SoupMessage *message; char *limit; RBPodcastSearchITunes *search = RB_PODCAST_SEARCH_ITUNES (bsearch); search->session = soup_session_new_with_options (SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_DEFAULT, NULL); uri = soup_uri_new (ITUNES_SEARCH_URI); limit = g_strdup_printf ("%d", max_results); soup_uri_set_query_from_fields (uri, "term", text, "media", "podcast", "entity", "podcast", "limit", limit, "version", "2", "output", "json", NULL); g_free (limit); message = soup_message_new_from_uri (SOUP_METHOD_GET, uri); soup_uri_free (uri); soup_session_queue_message (search->session, message, (SoupSessionCallback) search_response_cb, search); }