Lines Matching refs:uri

569 	/* Connect to the second port again. This time, send an absolute uri. */
2533 struct evhttp_uri *uri = NULL;
2535 #define URI_PARSE(uri) \
2536 evhttp_uri_parse_with_flags((uri), parse_flags)
2539 char *ret = evhttp_uri_join(uri, url_tmp, sizeof(url_tmp)); \
2557 uri = URI_PARSE(s); \
2558 if (uri != NULL && !nonconform) { \
2560 } else if (uri == NULL && nonconform) { \
2564 if (uri) { \
2565 tt_want(evhttp_uri_join(uri, url_tmp, \
2567 evhttp_uri_free(uri); \
2607 uri = evhttp_uri_new();
2608 tt_want(0==evhttp_uri_set_host(uri, "www.example.com"));
2609 tt_want(evhttp_uri_join(uri, url_tmp, sizeof(url_tmp)) != NULL);
2611 tt_want(evhttp_uri_join(uri, url_tmp, 3) == NULL);
2613 tt_want(0==evhttp_uri_set_path(uri, "hi_mom"));
2614 tt_want(evhttp_uri_join(uri, url_tmp, sizeof(url_tmp)) == NULL);
2615 tt_want(evhttp_uri_join(uri, NULL, sizeof(url_tmp))==NULL);
2616 tt_want(evhttp_uri_join(uri, url_tmp, 0)==NULL);
2617 evhttp_uri_free(uri);
2618 uri = URI_PARSE("mailto:foo@bar");
2619 tt_want(uri != NULL);
2620 tt_want(evhttp_uri_get_host(uri) == NULL);
2621 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2622 tt_want(evhttp_uri_get_port(uri) == -1);
2623 tt_want(!strcmp(evhttp_uri_get_scheme(uri), "mailto"));
2624 tt_want(!strcmp(evhttp_uri_get_path(uri), "foo@bar"));
2625 tt_want(evhttp_uri_get_query(uri) == NULL);
2626 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2628 evhttp_uri_free(uri);
2630 uri = evhttp_uri_new();
2632 tt_want(-1 == evhttp_uri_set_scheme(uri,""));
2633 tt_want(-1 == evhttp_uri_set_scheme(uri,"33"));
2634 tt_want(-1 == evhttp_uri_set_scheme(uri,"hi!"));
2635 tt_want(-1 == evhttp_uri_set_userinfo(uri,"hello@"));
2636 tt_want(-1 == evhttp_uri_set_host(uri,"[1.2.3.4]"));
2637 tt_want(-1 == evhttp_uri_set_host(uri,"["));
2638 tt_want(-1 == evhttp_uri_set_host(uri,"www.[foo].com"));
2639 tt_want(-1 == evhttp_uri_set_port(uri,-3));
2640 tt_want(-1 == evhttp_uri_set_path(uri,"hello?world"));
2641 tt_want(-1 == evhttp_uri_set_query(uri,"hello#world"));
2642 tt_want(-1 == evhttp_uri_set_fragment(uri,"hello#world"));
2644 tt_want(0 == evhttp_uri_set_scheme(uri,"http"));
2645 tt_want(0 == evhttp_uri_set_scheme(uri,NULL));
2646 tt_want(0 == evhttp_uri_set_userinfo(uri,"username:pass"));
2647 tt_want(0 == evhttp_uri_set_userinfo(uri,NULL));
2648 tt_want(0 == evhttp_uri_set_host(uri,"www.example.com"));
2649 tt_want(0 == evhttp_uri_set_host(uri,"1.2.3.4"));
2650 tt_want(0 == evhttp_uri_set_host(uri,"[1:2:3:4::]"));
2651 tt_want(0 == evhttp_uri_set_host(uri,"[v7.wobblewobble]"));
2652 tt_want(0 == evhttp_uri_set_host(uri,NULL));
2653 tt_want(0 == evhttp_uri_set_host(uri,""));
2654 tt_want(0 == evhttp_uri_set_port(uri, -1));
2655 tt_want(0 == evhttp_uri_set_port(uri, 80));
2656 tt_want(0 == evhttp_uri_set_port(uri, 65535));
2657 tt_want(0 == evhttp_uri_set_path(uri, ""));
2658 tt_want(0 == evhttp_uri_set_path(uri, "/documents/public/index.html"));
2659 tt_want(0 == evhttp_uri_set_path(uri, NULL));
2660 tt_want(0 == evhttp_uri_set_query(uri, "key=val&key2=val2"));
2661 tt_want(0 == evhttp_uri_set_query(uri, "keyvalblarg"));
2662 tt_want(0 == evhttp_uri_set_query(uri, ""));
2663 tt_want(0 == evhttp_uri_set_query(uri, NULL));
2664 tt_want(0 == evhttp_uri_set_fragment(uri, ""));
2665 tt_want(0 == evhttp_uri_set_fragment(uri, "here?i?am"));
2666 tt_want(0 == evhttp_uri_set_fragment(uri, NULL));
2667 evhttp_uri_free(uri);
2670 uri = URI_PARSE("http://www.test.com/?q=t%33est");
2671 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2672 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2673 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2674 tt_want(strcmp(evhttp_uri_get_query(uri), "q=t%33est") == 0);
2675 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2676 tt_want(evhttp_uri_get_port(uri) == -1);
2677 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2679 evhttp_uri_free(uri);
2681 uri = URI_PARSE("http://%77ww.test.com");
2682 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2683 tt_want(strcmp(evhttp_uri_get_host(uri), "%77ww.test.com") == 0);
2684 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2685 tt_want(evhttp_uri_get_query(uri) == NULL);
2686 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2687 tt_want(evhttp_uri_get_port(uri) == -1);
2688 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2690 evhttp_uri_free(uri);
2692 uri = URI_PARSE("http://www.test.com?q=test");
2693 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2694 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2695 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2696 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2697 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2698 tt_want(evhttp_uri_get_port(uri) == -1);
2699 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2701 evhttp_uri_free(uri);
2703 uri = URI_PARSE("http://www.test.com#fragment");
2704 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2705 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2706 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2707 tt_want(evhttp_uri_get_query(uri) == NULL);
2708 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2709 tt_want(evhttp_uri_get_port(uri) == -1);
2710 tt_want_str_op(evhttp_uri_get_fragment(uri), ==, "fragment");
2712 evhttp_uri_free(uri);
2714 uri = URI_PARSE("http://8000/");
2715 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2716 tt_want(strcmp(evhttp_uri_get_host(uri), "8000") == 0);
2717 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2718 tt_want(evhttp_uri_get_query(uri) == NULL);
2719 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2720 tt_want(evhttp_uri_get_port(uri) == -1);
2721 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2723 evhttp_uri_free(uri);
2725 uri = URI_PARSE("http://:8000/");
2726 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2727 tt_want(strcmp(evhttp_uri_get_host(uri), "") == 0);
2728 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2729 tt_want(evhttp_uri_get_query(uri) == NULL);
2730 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2731 tt_want(evhttp_uri_get_port(uri) == 8000);
2732 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2734 evhttp_uri_free(uri);
2736 uri = URI_PARSE("http://www.test.com:/"); /* empty port */
2737 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2738 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2739 tt_want_str_op(evhttp_uri_get_path(uri), ==, "/");
2740 tt_want(evhttp_uri_get_query(uri) == NULL);
2741 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2742 tt_want(evhttp_uri_get_port(uri) == -1);
2743 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2745 evhttp_uri_free(uri);
2747 uri = URI_PARSE("http://www.test.com:"); /* empty port 2 */
2748 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2749 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2750 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2751 tt_want(evhttp_uri_get_query(uri) == NULL);
2752 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2753 tt_want(evhttp_uri_get_port(uri) == -1);
2754 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2756 evhttp_uri_free(uri);
2758 uri = URI_PARSE("ftp://www.test.com/?q=test");
2759 tt_want(strcmp(evhttp_uri_get_scheme(uri), "ftp") == 0);
2760 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2761 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2762 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2763 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2764 tt_want(evhttp_uri_get_port(uri) == -1);
2765 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2767 evhttp_uri_free(uri);
2769 uri = URI_PARSE("ftp://[::1]:999/?q=test");
2770 tt_want(strcmp(evhttp_uri_get_scheme(uri), "ftp") == 0);
2771 tt_want(strcmp(evhttp_uri_get_host(uri), "[::1]") == 0);
2772 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2773 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2774 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2775 tt_want(evhttp_uri_get_port(uri) == 999);
2776 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2778 evhttp_uri_free(uri);
2780 uri = URI_PARSE("ftp://[ff00::127.0.0.1]/?q=test");
2781 tt_want(strcmp(evhttp_uri_get_scheme(uri), "ftp") == 0);
2782 tt_want(strcmp(evhttp_uri_get_host(uri), "[ff00::127.0.0.1]") == 0);
2783 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2784 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2785 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2786 tt_want(evhttp_uri_get_port(uri) == -1);
2787 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2789 evhttp_uri_free(uri);
2791 uri = URI_PARSE("ftp://[v99.not_(any:time)_soon]/?q=test");
2792 tt_want(strcmp(evhttp_uri_get_scheme(uri), "ftp") == 0);
2793 tt_want(strcmp(evhttp_uri_get_host(uri), "[v99.not_(any:time)_soon]") == 0);
2794 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2795 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2796 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2797 tt_want(evhttp_uri_get_port(uri) == -1);
2798 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2800 evhttp_uri_free(uri);
2802 uri = URI_PARSE("scheme://user:pass@foo.com:42/?q=test&s=some+thing#fragment");
2803 tt_want(strcmp(evhttp_uri_get_scheme(uri), "scheme") == 0);
2804 tt_want(strcmp(evhttp_uri_get_userinfo(uri), "user:pass") == 0);
2805 tt_want(strcmp(evhttp_uri_get_host(uri), "foo.com") == 0);
2806 tt_want(evhttp_uri_get_port(uri) == 42);
2807 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2808 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test&s=some+thing") == 0);
2809 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fragment") == 0);
2811 evhttp_uri_free(uri);
2813 uri = URI_PARSE("scheme://user@foo.com/#fragment");
2814 tt_want(strcmp(evhttp_uri_get_scheme(uri), "scheme") == 0);
2815 tt_want(strcmp(evhttp_uri_get_userinfo(uri), "user") == 0);
2816 tt_want(strcmp(evhttp_uri_get_host(uri), "foo.com") == 0);
2817 tt_want(evhttp_uri_get_port(uri) == -1);
2818 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2819 tt_want(evhttp_uri_get_query(uri) == NULL);
2820 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fragment") == 0);
2822 evhttp_uri_free(uri);
2824 uri = URI_PARSE("scheme://%75ser@foo.com/#frag@ment");
2825 tt_want(strcmp(evhttp_uri_get_scheme(uri), "scheme") == 0);
2826 tt_want(strcmp(evhttp_uri_get_userinfo(uri), "%75ser") == 0);
2827 tt_want(strcmp(evhttp_uri_get_host(uri), "foo.com") == 0);
2828 tt_want(evhttp_uri_get_port(uri) == -1);
2829 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2830 tt_want(evhttp_uri_get_query(uri) == NULL);
2831 tt_want(strcmp(evhttp_uri_get_fragment(uri), "frag@ment") == 0);
2833 evhttp_uri_free(uri);
2835 uri = URI_PARSE("file:///some/path/to/the/file");
2836 tt_want(strcmp(evhttp_uri_get_scheme(uri), "file") == 0);
2837 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2838 tt_want(strcmp(evhttp_uri_get_host(uri), "") == 0);
2839 tt_want(evhttp_uri_get_port(uri) == -1);
2840 tt_want(strcmp(evhttp_uri_get_path(uri), "/some/path/to/the/file") == 0);
2841 tt_want(evhttp_uri_get_query(uri) == NULL);
2842 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2844 evhttp_uri_free(uri);
2846 uri = URI_PARSE("///some/path/to/the-file");
2847 tt_want(uri != NULL);
2848 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2849 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2850 tt_want(strcmp(evhttp_uri_get_host(uri), "") == 0);
2851 tt_want(evhttp_uri_get_port(uri) == -1);
2852 tt_want(strcmp(evhttp_uri_get_path(uri), "/some/path/to/the-file") == 0);
2853 tt_want(evhttp_uri_get_query(uri) == NULL);
2854 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2856 evhttp_uri_free(uri);
2858 uri = URI_PARSE("/s:ome/path/to/the-file?q=99#fred");
2859 tt_want(uri != NULL);
2860 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2861 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2862 tt_want(evhttp_uri_get_host(uri) == NULL);
2863 tt_want(evhttp_uri_get_port(uri) == -1);
2864 tt_want(strcmp(evhttp_uri_get_path(uri), "/s:ome/path/to/the-file") == 0);
2865 tt_want(strcmp(evhttp_uri_get_query(uri), "q=99") == 0);
2866 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fred") == 0);
2868 evhttp_uri_free(uri);
2870 uri = URI_PARSE("relative/path/with/co:lon");
2871 tt_want(uri != NULL);
2872 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2873 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2874 tt_want(evhttp_uri_get_host(uri) == NULL);
2875 tt_want(evhttp_uri_get_port(uri) == -1);
2876 tt_want(strcmp(evhttp_uri_get_path(uri), "relative/path/with/co:lon") == 0);
2877 tt_want(evhttp_uri_get_query(uri) == NULL);
2878 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2880 evhttp_uri_free(uri);
2882 uri = URI_PARSE("bob?q=99&q2=q?33#fr?ed");
2883 tt_want(uri != NULL);
2884 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2885 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2886 tt_want(evhttp_uri_get_host(uri) == NULL);
2887 tt_want(evhttp_uri_get_port(uri) == -1);
2888 tt_want(strcmp(evhttp_uri_get_path(uri), "bob") == 0);
2889 tt_want(strcmp(evhttp_uri_get_query(uri), "q=99&q2=q?33") == 0);
2890 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fr?ed") == 0);
2892 evhttp_uri_free(uri);
2894 uri = URI_PARSE("#fr?ed");
2895 tt_want(uri != NULL);
2896 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2897 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2898 tt_want(evhttp_uri_get_host(uri) == NULL);
2899 tt_want(evhttp_uri_get_port(uri) == -1);
2900 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2901 tt_want(evhttp_uri_get_query(uri) == NULL);
2902 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fr?ed") == 0);
2904 evhttp_uri_free(uri);
3676 http_simple_test_impl(void *arg, int ssl, int dirty, const char *uri)
3701 if (evhttp_make_request(evcon, req, EVHTTP_REQ_GET, uri) == -1)