/*===================================================================================== * Do use ref_alloc when using ref_resolve, them memory allocation will be done by * ref_resolve, so be allocating twice a memory leak can ocur. * ==================================================================================== */ void test_ref_resolve_1(CuTest *tc) { char *href = strdup("http://www.example.com/"), *result; uriobj_t *uri = uri_alloc(), *ref; int err = 0; uri_parse(&uri,re,href); uri_parse_auth(&uri); uri_resolve(&uri); err = ref_resolve(&ref, uri, "path/to/uri.html",re,false); if( err == 0){ result = strdup(ref->uri_path); printf("path = '%s'\n", result); free(result); } else { /* * Should be checking for DNS_ERROR flag here but * as this is just a test don't bother. * **/ printf("errstr = '%s'\n", strerror(err)); } uri_free(uri); uri_free(ref); CuAssertIntEquals(tc,err,0); }
void test_ref_resolve_2(CuTest *tc) { char *href = strdup("http://www.example.com/some/dir/to/path"), *result; uriobj_t *uri = uri_alloc(), *ref; int err = 0; uri_parse(&uri,re,href); uri_parse_auth(&uri); uri_resolve(&uri); err = ref_resolve(&ref, uri, "path/to/uri.html",re,false); if( err == 0 ){ result = strdup(ref->uri_path); printf("ref_resolve test 2 is successful\n"); printf("ref->uri_scheme = '%s'\n", ref->uri_scheme); printf("ref->uri_auth = '%s'\n", ref->uri_auth); printf("ref->uri_path = '%s'\n", ref->uri_path); printf("ip address = '%s'\n", ref->uri_ip->ip_addr); uri_free(ref); } uri_free(uri); CuAssertStrEquals(tc,"/some/dir/to/path/to/uri.html",result); }
/* * Parse incoming URI and populate *options with the host * and device information */ static int vxhs_parse_uri(const char *filename, QDict *options) { URI *uri = NULL; char *port; int ret = 0; trace_vxhs_parse_uri_filename(filename); uri = uri_parse(filename); if (!uri || !uri->server || !uri->path) { uri_free(uri); return -EINVAL; } qdict_put_str(options, VXHS_OPT_SERVER ".host", uri->server); if (uri->port) { port = g_strdup_printf("%d", uri->port); qdict_put_str(options, VXHS_OPT_SERVER ".port", port); g_free(port); } qdict_put_str(options, "vdisk-id", uri->path); trace_vxhs_parse_uri_hostinfo(uri->server, uri->port); uri_free(uri); return ret; }
char *extract_relative_url(const char *src_filename, const char *base_filename) { UriUriA *abs_src_uri, *abs_base_uri, dst; char *dst_filename = NULL; if (!src_filename || !base_filename) return NULL; abs_src_uri = filename2absolute_uri(src_filename); abs_base_uri = filename2absolute_uri(base_filename); if (!abs_src_uri || !abs_base_uri) { uri_free(abs_src_uri); uri_free(abs_base_uri); return NULL; } if (uriRemoveBaseUriA(&dst, abs_src_uri, abs_base_uri, URI_FALSE) != URI_SUCCESS) goto exit; dst_filename = uri2string(&dst); exit: uri_free(abs_src_uri); uri_free(abs_base_uri); uriFreeUriMembersA(&dst); return dst_filename; }
void test_uri_cmp() { struct lttng_uri *uri1, *uri2; const char *s_uri1 = "net://localhost"; const char *s_uri2 = "net://localhost:8989:4242"; ssize_t size1, size2; int res; size1 = uri_parse(s_uri1, &uri1); /* Sanity checks */ assert(size1 == 2); assert(uri1[0].dtype == LTTNG_DST_IPV4); assert(uri1[0].utype == LTTNG_URI_DST); assert(uri1[0].stype == 0); assert(uri1[0].port == 0); assert(strlen(uri1[0].subdir) == 0); assert(strcmp(uri1[0].dst.ipv4, "127.0.0.1") == 0); assert(uri1[1].dtype == LTTNG_DST_IPV4); assert(uri1[1].utype == LTTNG_URI_DST); assert(uri1[1].stype == 0); assert(uri1[1].port == 0); assert(strlen(uri1[1].subdir) == 0); assert(strcmp(uri1[1].dst.ipv4, "127.0.0.1") == 0); size2 = uri_parse(s_uri2, &uri2); assert(size2 == 2); assert(uri2[0].dtype == LTTNG_DST_IPV4); assert(uri2[0].utype == LTTNG_URI_DST); assert(uri2[0].stype == 0); assert(uri2[0].port == 8989); assert(strlen(uri2[0].subdir) == 0); assert(strcmp(uri2[0].dst.ipv4, "127.0.0.1") == 0); assert(uri2[1].dtype == LTTNG_DST_IPV4); assert(uri2[1].utype == LTTNG_URI_DST); assert(uri2[1].stype == 0); assert(uri2[1].port == 4242); assert(strlen(uri2[1].subdir) == 0); assert(strcmp(uri2[1].dst.ipv4, "127.0.0.1") == 0); res = uri_compare(uri1, uri1); ok(res == 0, "URI compare net://localhost == net://localhost"); res = uri_compare(uri1, uri2); ok(res != 0, "URI compare net://localhost != net://localhost:8989:4242"); uri_free(uri1); uri_free(uri2); }
static int sip_register_check_to_domain(const struct sip_message_t* req) { int r; struct uri_t* to; struct uri_t* uri; to = uri_parse(req->to.uri.host.p, req->to.uri.host.n); uri = uri_parse(req->u.c.uri.host.p, req->u.c.uri.host.n); r = (!uri || !uri->host || !to || !to->host || 0 != strcasecmp(to->host, uri->host)) ? 0 : 1; uri_free(to); uri_free(uri); return r; }
static struct proxy_node *proxy_node_new(char *proxystr) { int i; for (i = 0; ProxyBackends[i] != NULL; i++) { const struct proxy_spec *pspec; pspec = ProxyBackends[i]; if (strncasecmp(proxystr, pspec->prefix, strlen(pspec->prefix)) == 0) { struct proxy_node *proxy = NULL; struct uri uri; memset(&uri, 0x00, sizeof(struct uri)); if (parse_uri(proxystr, &uri) < 0) break; if (pspec->ops->node_new(&proxy, &uri) < 0) fatal("Cannot initialize proxy node %s", proxystr); uri_free(&uri); return proxy; } } fatal("Invalid protocol in proxy specification string: %s", proxystr); return NULL; }
/* * file=gluster[+transport]://[server[:port]]/volname/image[?socket=...] * * 'gluster' is the protocol. * * 'transport' specifies the transport type used to connect to gluster * management daemon (glusterd). Valid transport types are * tcp, unix and rdma. If a transport type isn't specified, then tcp * type is assumed. * * 'server' specifies the server where the volume file specification for * the given volume resides. This can be either hostname, ipv4 address * or ipv6 address. ipv6 address needs to be within square brackets [ ]. * If transport type is 'unix', then 'server' field should not be specifed. * The 'socket' field needs to be populated with the path to unix domain * socket. * * 'port' is the port number on which glusterd is listening. This is optional * and if not specified, QEMU will send 0 which will make gluster to use the * default port. If the transport type is unix, then 'port' should not be * specified. * * 'volname' is the name of the gluster volume which contains the VM image. * * 'image' is the path to the actual VM image that resides on gluster volume. * * Examples: * * file=gluster://1.2.3.4/testvol/a.img * file=gluster+tcp://1.2.3.4/testvol/a.img * file=gluster+tcp://1.2.3.4:24007/testvol/dir/a.img * file=gluster+tcp://[1:2:3:4:5:6:7:8]/testvol/dir/a.img * file=gluster+tcp://[1:2:3:4:5:6:7:8]:24007/testvol/dir/a.img * file=gluster+tcp://server.domain.com:24007/testvol/dir/a.img * file=gluster+unix:///testvol/dir/a.img?socket=/tmp/glusterd.socket * file=gluster+rdma://1.2.3.4:24007/testvol/a.img */ static int qemu_gluster_parseuri(GlusterConf *gconf, const char *filename) { URI *uri; QueryParams *qp = NULL; bool is_unix = false; int ret = 0; uri = uri_parse(filename); if (!uri) { return -EINVAL; } /* transport */ if (!strcmp(uri->scheme, "gluster")) { gconf->transport = g_strdup("tcp"); } else if (!strcmp(uri->scheme, "gluster+tcp")) { gconf->transport = g_strdup("tcp"); } else if (!strcmp(uri->scheme, "gluster+unix")) { gconf->transport = g_strdup("unix"); is_unix = true; } else if (!strcmp(uri->scheme, "gluster+rdma")) { gconf->transport = g_strdup("rdma"); } else { ret = -EINVAL; goto out; } ret = parse_volume_options(gconf, uri->path); if (ret < 0) { goto out; } qp = query_params_parse(uri->query); if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) { ret = -EINVAL; goto out; } if (is_unix) { if (uri->server || uri->port) { ret = -EINVAL; goto out; } if (strcmp(qp->p[0].name, "socket")) { ret = -EINVAL; goto out; } gconf->server = g_strdup(qp->p[0].value); } else { gconf->server = g_strdup(uri->server); gconf->port = uri->port; } out: if (qp) { query_params_free(qp); } uri_free(uri); return ret; }
void connection_free(connection_t* con) { comms_disconnect(con->socketfd); if(con->uri != NULL) uri_free(con->uri); if(con->name != NULL) free(con->name); free(con); }
static void test_uri_parse_long(void) { static const char uri1[] = "http://www.google.com/images?hl=en&client=firefox-a&hs=tldrls=org.mozilla:en-US:official&q=philippine+hijacked+bus+picturesum=1&ie=UTF-8&source=univ&ei=SC-_TLbjE5H2tgO70PHODA&sa=X&oi=image_result_group&ct=titleresnum=1&ved=0CCIQsAQwAAbiw=1239bih=622"; uri_t *u = uri_new(); g_assert(uri_parse(u, uri1, strlen(uri1), NULL)); uri_free(u); }
mulk_type_return_t mulk_add_new_url(const char *url) { UriUriA *new_uri = NULL; #ifdef ENABLE_RECURSION char *host = NULL; #endif if ((new_uri = create_absolute_uri(NULL, url)) == NULL) goto Rejected; #ifdef ENABLE_RECURSION if ((host = get_host(new_uri)) == NULL) goto Rejected; #endif if (!push_unique_uri(new_uri, 1)) goto Rejected; #ifdef ENABLE_RECURSION add_url_to_default_domains(host); string_free(host); #endif return MULK_RET_OK; Rejected: #ifdef ENABLE_RECURSION string_free(host); #endif uri_free(new_uri); return MULK_RET_URL_ERR; }
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; }
int filter_uri(UriUriA **uri, int level) { char *url; if (!option_values.exec_filter) return 0; if (!uri) return -1; if ((url = uri2string(*uri)) == NULL) return -1; uri_free(*uri); *uri = NULL; if (execute_filter(option_values.exec_filter, &url, level)) { string_free(url); return -1; } *uri = create_absolute_uri(NULL, url); string_free(url); if (!*uri) return -1; return 0; }
void get(const StringSlice& url, WriteTarget out) { static int inited = ne_sock_init(); if (inited != 0) { throw Exception("ne_sock_init()"); } CString cstr(url); ne_uri uri = {}; if (ne_uri_parse(cstr.data(), &uri)) { throw Exception("ne_uri_parse()"); } if (uri.port == 0) { uri.port = ne_uri_defaultport(uri.scheme); } unique_ptr<ne_uri, decltype(&ne_uri_free)> uri_free(&uri, ne_uri_free); unique_ptr<ne_session, decltype(&ne_session_destroy)> sess( ne_session_create(uri.scheme, uri.host, uri.port), ne_session_destroy); unique_ptr<ne_request, decltype(&ne_request_destroy)> req( ne_request_create(sess.get(), "GET", uri.path), ne_request_destroy); ne_userdata userdata = {out}; ne_add_response_body_reader(req.get(), accept, reader, &userdata); auto err = ne_request_dispatch(req.get()); if (err != NE_OK) { throw Exception("ne_request_dispatch()"); } auto* st = ne_get_status(req.get()); if (st->code != 200) { throw Exception(st->code); } }
papi_status_t service_connect(service_t *svc, char *service_name) { papi_status_t result = PAPI_OK; int port = 631; if (svc == NULL) return (PAPI_BAD_ARGUMENT); if (svc->connection != NULL) /* alread connected ? */ return (PAPI_OK); if (svc->uri == NULL) uri_from_string(service_name, &svc->uri); if ((service_name != NULL) && (svc->uri == NULL)) { /* * a name was supplied and it's not in URI form, we will * try to use a "default" IPP service under the assumption * that this is most likely a short-form printer name from * from a papiPrinter*() or papiJob*() call and not from a * papiServiceCreate() call. */ if ((service_name = getenv("PAPI_SERVICE_URI")) == NULL) { char *cups; if ((cups = getenv("CUPS_SERVER")) != NULL) { char buf[BUFSIZ]; snprintf(buf, sizeof (buf), "ipp://%s/printers/", cups); service_name = strdup(buf); } } if (service_name == NULL) service_name = DEFAULT_IPP_SERVICE_URI; uri_from_string(service_name, &svc->uri); } if (svc->uri == NULL) return (PAPI_NOT_POSSIBLE); if (svc->uri->port != NULL) port = strtol(svc->uri->port, NULL, 10); svc->connection = httpConnectEncrypt(svc->uri->host, port, http_encryption_type(svc->encryption)); if (svc->connection == NULL) { if (svc->uri != NULL) { uri_free(svc->uri); svc->uri = NULL; } result = PAPI_SERVICE_UNAVAILABLE; } else if (service_name != NULL) svc->name = strdup(service_name); return (result); }
void free_urls(void) { while (top) { UriUriA *uri = pop_url(); if (uri) uri_free(uri); } }
static void test_uri_normalize_all_slashes(void) { static const char uri1[] = "eXAMPLE://a//////"; uri_t *u = uri_new(); g_assert(uri_parse(u, uri1, strlen(uri1), NULL)); uri_normalize(u); g_assert_cmpstr("/", ==, u->path); uri_free(u); }
static void test_uri_parse_brackets(void) { static const char uri1[] = "http://ad.doubleclick.net/adi/N5371.Google/B4882217.2;sz=160x600;pc=[TPAS_ID];click=http://googleads.g.doubleclick.net/aclk?sa=l&ai=Bepsf-z83TfuWJIKUjQS46ejyAeqc0t8B2uvnkxeiro6LRdC9wQEQARgBIPjy_wE4AFC0-b7IAmDJ9viGyKOgGaABnoHS5QOyAQ53d3cub3NuZXdzLmNvbboBCjE2MHg2MDBfYXPIAQnaAS9odHRwOi8vd3d3Lm9zbmV3cy5jb20vdXNlci9qYWNrZWVibGV1L2NvbW1lbnRzL7gCGMgCosXLE6gDAegDrwLoA5EG6APgBfUDAgAARPUDIAAAAA&num=1&sig=AGiWqty7uE4ibhWIPcOiZlX0__AQkpGEWA&client=ca-pub-6467510223857492&adurl=;ord=410711259?"; const gchar *error_at = NULL; uri_t *u = uri_new(); int st = uri_parse(u, uri1, strlen(uri1), &error_at); if (error_at) g_test_message("uri_parse failed at -> %s", error_at); uri_free(u); g_assert(st); }
static void test_uri_parse_pipe(void) { static const char uri1[] = "http://ads.pointroll.com/PortalServe/?pid=1048344U85520100615200820&flash=10time=3|18:36|-8redir=$CTURL$r=0.8149350655730814"; const gchar *error_at = NULL; uri_t *u = uri_new(); int st = uri_parse(u, uri1, strlen(uri1), &error_at); if (error_at) g_test_message("uri_parse failed at -> %s", error_at); uri_free(u); g_assert(st); }
static int parse_uri(const char *proxystr, struct uri *uri) { const char *p, *q; /* Scheme, section 3.1. */ p = proxystr; if (!isalpha(*p)) goto fail; q = p; while (isalpha(*q) || isdigit(*q) || *q == '+' || *q == '-' || *q == '.') q++; if (*q != ':') goto fail; uri->scheme = mkstr(p, q); /* "An implementation should accept uppercase letters as equivalent to * lowercase in scheme names (e.g., allow "HTTP" as well as "http") for the * sake of robustness..." */ lowercase(uri->scheme); /* Authority, section 3.2. */ p = q + 1; if (*p == '/' && *(p + 1) == '/') { char *authority = NULL; p += 2; q = p; while (!(*q == '/' || *q == '?' || *q == '#' || *q == '\0')) q++; ; authority = mkstr(p, q); if (uri_parse_authority(authority, uri) < 0) { free(authority); goto fail; } free(authority); p = q; } /* Path, section 3.3. We include the query and fragment in the path. The * path is also not percent-decoded because we just pass it on to the origin * server. */ q = strchr(p, '\0'); uri->path = mkstr(p, q); return 1; fail: uri_free(uri); return -1; }
static void test_uri_parse_badencode(void) { static const char uri1[] = "http://b.scorecardresearch.com/b?c1=2&c2=6035223rn=1404429288&c7=http%3A%2F%2Fdetnews.com%2Farticle%2F20110121%2FMETRO01%2F101210376%2FDetroit-women-get-no-help-in-arrest-of-alleged-car-thief&c8=Detroit%20women%20get%20no%20help%20in%20arrest%20of%20alleged%2&cv=2.2&cs=js"; const gchar *error_at = NULL; uri_t *u = uri_new(); int st = uri_parse(u, uri1, strlen(uri1), &error_at); if (error_at) g_test_message("uri_parse failed at -> %s", error_at); uri_normalize(u); uri_free(u); g_assert(st); }
static void test_uri_normalize_host(void) { static const char uri1[] = "eXAMPLE://ExAmPlE.CoM/"; uri_t *u = uri_new(); g_assert(uri_parse(u, uri1, strlen(uri1), NULL)); uri_normalize(u); g_assert_cmpstr("example.com", ==, u->host); uri_free(u); }
static void test_uri_parse_unicode_escape(void) { static const char uri1[] = "http://b.scorecardresearch.com/b?C1=8&C2=6035047&C3=463.9924&C4=ad21868c&C5=173229&C6=16jfaue1ukmeoq&C7=http%3A//remotecontrol.mtv.com/2011/01/20/sammi-sweetheart-giancoloa-terrell-owens-hair/&C8=Hot%20Shots%3A%20Sammi%20%u2018Sweetheart%u2019%20Lets%20Terrell%20Owens%20Play%20With%20Her%20Hair%20%BB%20MTV%20Remote%20Control%20Blog&C9=&C10=1680x1050rn=58013009"; const gchar *error_at = NULL; uri_t *u = uri_new(); int st = uri_parse(u, uri1, strlen(uri1), &error_at); if (error_at) g_test_message("uri_parse failed at -> %s", error_at); uri_normalize(u); uri_free(u); g_assert(st); }
static void test_uri_parse_double_percent(void) { static const char uri1[] = "http://bh.contextweb.com/bh/getuid?url=http://image2.pubmatic.com/AdServer/Pug?vcode=bz0yJnR5cGU9MSZqcz0xJmNvZGU9ODI1JnRsPTQzMjAw&piggybackCookie=%%CWGUID%%,User_tokens:%%USER_TOKENS%%"; const gchar *error_at = NULL; uri_t *u = uri_new(); int st = uri_parse(u, uri1, strlen(uri1), &error_at); if (error_at) g_test_message("uri_parse failed at -> %s", error_at); uri_normalize(u); uri_free(u); g_assert(st); }
static void test_uri_percent_decode(void **state) { struct uri *uri = malloc(sizeof(struct uri)); assert_true(parse_uri(uri, "protocol://us%20er:pa%20ss@host%20name")); assert_string_equal(uri->scheme, "protocol"); assert_string_equal(uri->hostname, "host name"); assert_string_equal(uri->username, "us er"); assert_string_equal(uri->password, "pa ss"); assert_null(uri->path); assert_null(uri->query); assert_null(uri->fragment); uri_free(uri); }
static void test_port(void **state) { struct uri *uri = malloc(sizeof(struct uri)); assert_true(parse_uri(uri, "protocol://hostname:1234")); assert_string_equal(uri->scheme, "protocol"); assert_string_equal(uri->hostname, "hostname"); assert_string_equal(uri->port, "1234"); assert_null(uri->username); assert_null(uri->path); assert_null(uri->query); assert_null(uri->fragment); uri_free(uri); }
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); }
static void test_uri_compose(void) { static const char uri1[] = "eXAMPLE://ExAmPlE.CoM/foo/../boo/%25hi%0b/.t%65st/./this?query=string#frag"; uri_t *u = uri_new(); g_assert(uri_parse(u, uri1, strlen(uri1), NULL)); uri_normalize(u); char *s = uri_compose(u); g_assert_cmpstr("example://example.com/boo/%25hi%0B/.test/this?query=string#frag", ==, s); free(s); uri_free(u); }
int uri_parse(const char *uri_s, struct uri *uri) { const char *p, *q; uri_init(uri); /* Scheme, section 3.1. */ p = uri_s; if (!is_alpha_char(*p)) goto fail; q = p; while (is_alpha_char(*q) || is_digit_char(*q) || *q == '+' || *q == '-' || *q == '.') q++; if (*q != ':') goto fail; uri->scheme = mkstr(p, q); lowercase(uri->scheme); /* Authority, section 3.2. */ p = q + 1; if (*p == '/' && *(p + 1) == '/') { char *authority = NULL; p += 2; q = p; while (!(*q == '/' || *q == '?' || *q == '#' || *q == '\0')) q++; authority = mkstr(p, q); if (uri_parse_authority(uri, authority)) { free(authority); goto fail; } free(authority); p = q; } q = strchr(p, '\0'); uri->path = mkstr(p, q); return 0; fail: uri_free(uri); return -EINVAL; }
static void test_uri_parse_many(void) { uri_t *u = uri_new(); const char uri1[] = "http://example.com/path/to/something?query=string#frag"; g_assert(uri_parse(u, uri1, strlen(uri1), NULL)); g_assert_cmpstr(u->scheme, ==, "http"); g_assert_cmpstr(u->host, ==, "example.com"); g_assert_cmpstr(u->path, ==, "/path/to/something"); g_assert_cmpstr(u->query, ==, "?query=string"); g_assert_cmpstr(u->fragment, ==, "#frag"); uri_clear(u); const char uri2[] = "http://*****:*****@example.com:5555/path/to/"; g_assert(uri_parse(u, uri2, strlen(uri2), NULL)); g_assert_cmpstr(u->scheme, ==, "http"); g_assert_cmpstr(u->userinfo, ==, "jason:password"); g_assert_cmpstr(u->host, ==, "example.com"); g_assert(u->port == 5555); g_assert_cmpstr(u->path, ==, "/path/to/"); uri_clear(u); /* this should fail */ const char uri3[] = "http://baduri;f[303fds"; const char *error_at = NULL; g_assert(uri_parse(u, uri3, strlen(uri3), &error_at) == 0); g_assert(error_at != NULL); g_assert_cmpstr("[303fds", ==, error_at); uri_clear(u); const char uri4[] = "https://example.com:23999"; g_assert(uri_parse(u, uri4, strlen(uri4), &error_at)); g_assert_cmpstr(u->scheme, ==, "https"); g_assert_cmpstr(u->host, ==, "example.com"); g_assert(u->port == 23999); /* TODO: maybe make empty path == NULL? */ g_assert_cmpstr(u->path, ==, ""); g_assert(u->query == NULL); g_assert(u->fragment == NULL); g_assert(error_at == NULL); uri_clear(u); const char uri5[] = "svn+ssh://jason:[email protected]:22/thing/and/stuff"; g_assert(uri_parse(u, uri5, strlen(uri5), &error_at)); g_assert_cmpstr(u->scheme, ==, "svn+ssh"); g_assert_cmpstr(u->userinfo, ==, "jason:password"); g_assert_cmpstr(u->host, ==, "example.com"); g_assert(u->port == 22); g_assert_cmpstr(u->path, ==, "/thing/and/stuff"); g_assert(error_at == NULL); uri_clear(u); uri_free(u); }