Lines Matching refs:uri

466 	/* Connect to the second port again. This time, send an absolute uri. */
2210 struct evhttp_uri *uri = NULL;
2212 #define URI_PARSE(uri) \
2213 evhttp_uri_parse_with_flags((uri), parse_flags)
2216 char *ret = evhttp_uri_join(uri, url_tmp, sizeof(url_tmp)); \
2234 uri = URI_PARSE(s); \
2235 if (uri != NULL && !nonconform) { \
2237 } else if (uri == NULL && nonconform) { \
2241 if (uri) { \
2242 tt_want(evhttp_uri_join(uri, url_tmp, \
2244 evhttp_uri_free(uri); \
2284 uri = evhttp_uri_new();
2285 tt_want(0==evhttp_uri_set_host(uri, "www.example.com"));
2286 tt_want(evhttp_uri_join(uri, url_tmp, sizeof(url_tmp)) != NULL);
2288 tt_want(evhttp_uri_join(uri, url_tmp, 3) == NULL);
2290 tt_want(0==evhttp_uri_set_path(uri, "hi_mom"));
2291 tt_want(evhttp_uri_join(uri, url_tmp, sizeof(url_tmp)) == NULL);
2292 tt_want(evhttp_uri_join(uri, NULL, sizeof(url_tmp))==NULL);
2293 tt_want(evhttp_uri_join(uri, url_tmp, 0)==NULL);
2294 evhttp_uri_free(uri);
2295 uri = URI_PARSE("mailto:foo@bar");
2296 tt_want(uri != NULL);
2297 tt_want(evhttp_uri_get_host(uri) == NULL);
2298 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2299 tt_want(evhttp_uri_get_port(uri) == -1);
2300 tt_want(!strcmp(evhttp_uri_get_scheme(uri), "mailto"));
2301 tt_want(!strcmp(evhttp_uri_get_path(uri), "foo@bar"));
2302 tt_want(evhttp_uri_get_query(uri) == NULL);
2303 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2305 evhttp_uri_free(uri);
2307 uri = evhttp_uri_new();
2309 tt_want(-1 == evhttp_uri_set_scheme(uri,""));
2310 tt_want(-1 == evhttp_uri_set_scheme(uri,"33"));
2311 tt_want(-1 == evhttp_uri_set_scheme(uri,"hi!"));
2312 tt_want(-1 == evhttp_uri_set_userinfo(uri,"hello@"));
2313 tt_want(-1 == evhttp_uri_set_host(uri,"[1.2.3.4]"));
2314 tt_want(-1 == evhttp_uri_set_host(uri,"["));
2315 tt_want(-1 == evhttp_uri_set_host(uri,"www.[foo].com"));
2316 tt_want(-1 == evhttp_uri_set_port(uri,-3));
2317 tt_want(-1 == evhttp_uri_set_path(uri,"hello?world"));
2318 tt_want(-1 == evhttp_uri_set_query(uri,"hello#world"));
2319 tt_want(-1 == evhttp_uri_set_fragment(uri,"hello#world"));
2321 tt_want(0 == evhttp_uri_set_scheme(uri,"http"));
2322 tt_want(0 == evhttp_uri_set_scheme(uri,NULL));
2323 tt_want(0 == evhttp_uri_set_userinfo(uri,"username:pass"));
2324 tt_want(0 == evhttp_uri_set_userinfo(uri,NULL));
2325 tt_want(0 == evhttp_uri_set_host(uri,"www.example.com"));
2326 tt_want(0 == evhttp_uri_set_host(uri,"1.2.3.4"));
2327 tt_want(0 == evhttp_uri_set_host(uri,"[1:2:3:4::]"));
2328 tt_want(0 == evhttp_uri_set_host(uri,"[v7.wobblewobble]"));
2329 tt_want(0 == evhttp_uri_set_host(uri,NULL));
2330 tt_want(0 == evhttp_uri_set_host(uri,""));
2331 tt_want(0 == evhttp_uri_set_port(uri, -1));
2332 tt_want(0 == evhttp_uri_set_port(uri, 80));
2333 tt_want(0 == evhttp_uri_set_port(uri, 65535));
2334 tt_want(0 == evhttp_uri_set_path(uri, ""));
2335 tt_want(0 == evhttp_uri_set_path(uri, "/documents/public/index.html"));
2336 tt_want(0 == evhttp_uri_set_path(uri, NULL));
2337 tt_want(0 == evhttp_uri_set_query(uri, "key=val&key2=val2"));
2338 tt_want(0 == evhttp_uri_set_query(uri, "keyvalblarg"));
2339 tt_want(0 == evhttp_uri_set_query(uri, ""));
2340 tt_want(0 == evhttp_uri_set_query(uri, NULL));
2341 tt_want(0 == evhttp_uri_set_fragment(uri, ""));
2342 tt_want(0 == evhttp_uri_set_fragment(uri, "here?i?am"));
2343 tt_want(0 == evhttp_uri_set_fragment(uri, NULL));
2344 evhttp_uri_free(uri);
2347 uri = URI_PARSE("http://www.test.com/?q=t%33est");
2348 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2349 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2350 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2351 tt_want(strcmp(evhttp_uri_get_query(uri), "q=t%33est") == 0);
2352 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2353 tt_want(evhttp_uri_get_port(uri) == -1);
2354 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2356 evhttp_uri_free(uri);
2358 uri = URI_PARSE("http://%77ww.test.com");
2359 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2360 tt_want(strcmp(evhttp_uri_get_host(uri), "%77ww.test.com") == 0);
2361 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2362 tt_want(evhttp_uri_get_query(uri) == NULL);
2363 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2364 tt_want(evhttp_uri_get_port(uri) == -1);
2365 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2367 evhttp_uri_free(uri);
2369 uri = URI_PARSE("http://www.test.com?q=test");
2370 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2371 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2372 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2373 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2374 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2375 tt_want(evhttp_uri_get_port(uri) == -1);
2376 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2378 evhttp_uri_free(uri);
2380 uri = URI_PARSE("http://www.test.com#fragment");
2381 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2382 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2383 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2384 tt_want(evhttp_uri_get_query(uri) == NULL);
2385 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2386 tt_want(evhttp_uri_get_port(uri) == -1);
2387 tt_want_str_op(evhttp_uri_get_fragment(uri), ==, "fragment");
2389 evhttp_uri_free(uri);
2391 uri = URI_PARSE("http://8000/");
2392 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2393 tt_want(strcmp(evhttp_uri_get_host(uri), "8000") == 0);
2394 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2395 tt_want(evhttp_uri_get_query(uri) == NULL);
2396 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2397 tt_want(evhttp_uri_get_port(uri) == -1);
2398 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2400 evhttp_uri_free(uri);
2402 uri = URI_PARSE("http://:8000/");
2403 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2404 tt_want(strcmp(evhttp_uri_get_host(uri), "") == 0);
2405 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2406 tt_want(evhttp_uri_get_query(uri) == NULL);
2407 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2408 tt_want(evhttp_uri_get_port(uri) == 8000);
2409 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2411 evhttp_uri_free(uri);
2413 uri = URI_PARSE("http://www.test.com:/"); /* empty port */
2414 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2415 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2416 tt_want_str_op(evhttp_uri_get_path(uri), ==, "/");
2417 tt_want(evhttp_uri_get_query(uri) == NULL);
2418 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2419 tt_want(evhttp_uri_get_port(uri) == -1);
2420 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2422 evhttp_uri_free(uri);
2424 uri = URI_PARSE("http://www.test.com:"); /* empty port 2 */
2425 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2426 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2427 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2428 tt_want(evhttp_uri_get_query(uri) == NULL);
2429 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2430 tt_want(evhttp_uri_get_port(uri) == -1);
2431 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2433 evhttp_uri_free(uri);
2435 uri = URI_PARSE("ftp://www.test.com/?q=test");
2436 tt_want(strcmp(evhttp_uri_get_scheme(uri), "ftp") == 0);
2437 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2438 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2439 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2440 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2441 tt_want(evhttp_uri_get_port(uri) == -1);
2442 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2444 evhttp_uri_free(uri);
2446 uri = URI_PARSE("ftp://[::1]:999/?q=test");
2447 tt_want(strcmp(evhttp_uri_get_scheme(uri), "ftp") == 0);
2448 tt_want(strcmp(evhttp_uri_get_host(uri), "[::1]") == 0);
2449 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2450 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2451 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2452 tt_want(evhttp_uri_get_port(uri) == 999);
2453 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2455 evhttp_uri_free(uri);
2457 uri = URI_PARSE("ftp://[ff00::127.0.0.1]/?q=test");
2458 tt_want(strcmp(evhttp_uri_get_scheme(uri), "ftp") == 0);
2459 tt_want(strcmp(evhttp_uri_get_host(uri), "[ff00::127.0.0.1]") == 0);
2460 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2461 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2462 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2463 tt_want(evhttp_uri_get_port(uri) == -1);
2464 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2466 evhttp_uri_free(uri);
2468 uri = URI_PARSE("ftp://[v99.not_(any:time)_soon]/?q=test");
2469 tt_want(strcmp(evhttp_uri_get_scheme(uri), "ftp") == 0);
2470 tt_want(strcmp(evhttp_uri_get_host(uri), "[v99.not_(any:time)_soon]") == 0);
2471 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2472 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2473 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2474 tt_want(evhttp_uri_get_port(uri) == -1);
2475 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2477 evhttp_uri_free(uri);
2479 uri = URI_PARSE("scheme://user:pass@foo.com:42/?q=test&s=some+thing#fragment");
2480 tt_want(strcmp(evhttp_uri_get_scheme(uri), "scheme") == 0);
2481 tt_want(strcmp(evhttp_uri_get_userinfo(uri), "user:pass") == 0);
2482 tt_want(strcmp(evhttp_uri_get_host(uri), "foo.com") == 0);
2483 tt_want(evhttp_uri_get_port(uri) == 42);
2484 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2485 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test&s=some+thing") == 0);
2486 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fragment") == 0);
2488 evhttp_uri_free(uri);
2490 uri = URI_PARSE("scheme://user@foo.com/#fragment");
2491 tt_want(strcmp(evhttp_uri_get_scheme(uri), "scheme") == 0);
2492 tt_want(strcmp(evhttp_uri_get_userinfo(uri), "user") == 0);
2493 tt_want(strcmp(evhttp_uri_get_host(uri), "foo.com") == 0);
2494 tt_want(evhttp_uri_get_port(uri) == -1);
2495 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2496 tt_want(evhttp_uri_get_query(uri) == NULL);
2497 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fragment") == 0);
2499 evhttp_uri_free(uri);
2501 uri = URI_PARSE("scheme://%75ser@foo.com/#frag@ment");
2502 tt_want(strcmp(evhttp_uri_get_scheme(uri), "scheme") == 0);
2503 tt_want(strcmp(evhttp_uri_get_userinfo(uri), "%75ser") == 0);
2504 tt_want(strcmp(evhttp_uri_get_host(uri), "foo.com") == 0);
2505 tt_want(evhttp_uri_get_port(uri) == -1);
2506 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2507 tt_want(evhttp_uri_get_query(uri) == NULL);
2508 tt_want(strcmp(evhttp_uri_get_fragment(uri), "frag@ment") == 0);
2510 evhttp_uri_free(uri);
2512 uri = URI_PARSE("file:///some/path/to/the/file");
2513 tt_want(strcmp(evhttp_uri_get_scheme(uri), "file") == 0);
2514 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2515 tt_want(strcmp(evhttp_uri_get_host(uri), "") == 0);
2516 tt_want(evhttp_uri_get_port(uri) == -1);
2517 tt_want(strcmp(evhttp_uri_get_path(uri), "/some/path/to/the/file") == 0);
2518 tt_want(evhttp_uri_get_query(uri) == NULL);
2519 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2521 evhttp_uri_free(uri);
2523 uri = URI_PARSE("///some/path/to/the-file");
2524 tt_want(uri != NULL);
2525 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2526 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2527 tt_want(strcmp(evhttp_uri_get_host(uri), "") == 0);
2528 tt_want(evhttp_uri_get_port(uri) == -1);
2529 tt_want(strcmp(evhttp_uri_get_path(uri), "/some/path/to/the-file") == 0);
2530 tt_want(evhttp_uri_get_query(uri) == NULL);
2531 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2533 evhttp_uri_free(uri);
2535 uri = URI_PARSE("/s:ome/path/to/the-file?q=99#fred");
2536 tt_want(uri != NULL);
2537 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2538 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2539 tt_want(evhttp_uri_get_host(uri) == NULL);
2540 tt_want(evhttp_uri_get_port(uri) == -1);
2541 tt_want(strcmp(evhttp_uri_get_path(uri), "/s:ome/path/to/the-file") == 0);
2542 tt_want(strcmp(evhttp_uri_get_query(uri), "q=99") == 0);
2543 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fred") == 0);
2545 evhttp_uri_free(uri);
2547 uri = URI_PARSE("relative/path/with/co:lon");
2548 tt_want(uri != NULL);
2549 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2550 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2551 tt_want(evhttp_uri_get_host(uri) == NULL);
2552 tt_want(evhttp_uri_get_port(uri) == -1);
2553 tt_want(strcmp(evhttp_uri_get_path(uri), "relative/path/with/co:lon") == 0);
2554 tt_want(evhttp_uri_get_query(uri) == NULL);
2555 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2557 evhttp_uri_free(uri);
2559 uri = URI_PARSE("bob?q=99&q2=q?33#fr?ed");
2560 tt_want(uri != NULL);
2561 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2562 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2563 tt_want(evhttp_uri_get_host(uri) == NULL);
2564 tt_want(evhttp_uri_get_port(uri) == -1);
2565 tt_want(strcmp(evhttp_uri_get_path(uri), "bob") == 0);
2566 tt_want(strcmp(evhttp_uri_get_query(uri), "q=99&q2=q?33") == 0);
2567 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fr?ed") == 0);
2569 evhttp_uri_free(uri);
2571 uri = URI_PARSE("#fr?ed");
2572 tt_want(uri != NULL);
2573 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2574 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2575 tt_want(evhttp_uri_get_host(uri) == NULL);
2576 tt_want(evhttp_uri_get_port(uri) == -1);
2577 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2578 tt_want(evhttp_uri_get_query(uri) == NULL);
2579 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fr?ed") == 0);
2581 evhttp_uri_free(uri);