Lines Matching refs:uri

566 	/* Connect to the second port again. This time, send an absolute uri. */
2530 struct evhttp_uri *uri = NULL;
2532 #define URI_PARSE(uri) \
2533 evhttp_uri_parse_with_flags((uri), parse_flags)
2536 char *ret = evhttp_uri_join(uri, url_tmp, sizeof(url_tmp)); \
2554 uri = URI_PARSE(s); \
2555 if (uri != NULL && !nonconform) { \
2557 } else if (uri == NULL && nonconform) { \
2561 if (uri) { \
2562 tt_want(evhttp_uri_join(uri, url_tmp, \
2564 evhttp_uri_free(uri); \
2604 uri = evhttp_uri_new();
2605 tt_want(0==evhttp_uri_set_host(uri, "www.example.com"));
2606 tt_want(evhttp_uri_join(uri, url_tmp, sizeof(url_tmp)) != NULL);
2608 tt_want(evhttp_uri_join(uri, url_tmp, 3) == NULL);
2610 tt_want(0==evhttp_uri_set_path(uri, "hi_mom"));
2611 tt_want(evhttp_uri_join(uri, url_tmp, sizeof(url_tmp)) == NULL);
2612 tt_want(evhttp_uri_join(uri, NULL, sizeof(url_tmp))==NULL);
2613 tt_want(evhttp_uri_join(uri, url_tmp, 0)==NULL);
2614 evhttp_uri_free(uri);
2615 uri = URI_PARSE("mailto:foo@bar");
2616 tt_want(uri != NULL);
2617 tt_want(evhttp_uri_get_host(uri) == NULL);
2618 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2619 tt_want(evhttp_uri_get_port(uri) == -1);
2620 tt_want(!strcmp(evhttp_uri_get_scheme(uri), "mailto"));
2621 tt_want(!strcmp(evhttp_uri_get_path(uri), "foo@bar"));
2622 tt_want(evhttp_uri_get_query(uri) == NULL);
2623 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2625 evhttp_uri_free(uri);
2627 uri = evhttp_uri_new();
2629 tt_want(-1 == evhttp_uri_set_scheme(uri,""));
2630 tt_want(-1 == evhttp_uri_set_scheme(uri,"33"));
2631 tt_want(-1 == evhttp_uri_set_scheme(uri,"hi!"));
2632 tt_want(-1 == evhttp_uri_set_userinfo(uri,"hello@"));
2633 tt_want(-1 == evhttp_uri_set_host(uri,"[1.2.3.4]"));
2634 tt_want(-1 == evhttp_uri_set_host(uri,"["));
2635 tt_want(-1 == evhttp_uri_set_host(uri,"www.[foo].com"));
2636 tt_want(-1 == evhttp_uri_set_port(uri,-3));
2637 tt_want(-1 == evhttp_uri_set_path(uri,"hello?world"));
2638 tt_want(-1 == evhttp_uri_set_query(uri,"hello#world"));
2639 tt_want(-1 == evhttp_uri_set_fragment(uri,"hello#world"));
2641 tt_want(0 == evhttp_uri_set_scheme(uri,"http"));
2642 tt_want(0 == evhttp_uri_set_scheme(uri,NULL));
2643 tt_want(0 == evhttp_uri_set_userinfo(uri,"username:pass"));
2644 tt_want(0 == evhttp_uri_set_userinfo(uri,NULL));
2645 tt_want(0 == evhttp_uri_set_host(uri,"www.example.com"));
2646 tt_want(0 == evhttp_uri_set_host(uri,"1.2.3.4"));
2647 tt_want(0 == evhttp_uri_set_host(uri,"[1:2:3:4::]"));
2648 tt_want(0 == evhttp_uri_set_host(uri,"[v7.wobblewobble]"));
2649 tt_want(0 == evhttp_uri_set_host(uri,NULL));
2650 tt_want(0 == evhttp_uri_set_host(uri,""));
2651 tt_want(0 == evhttp_uri_set_port(uri, -1));
2652 tt_want(0 == evhttp_uri_set_port(uri, 80));
2653 tt_want(0 == evhttp_uri_set_port(uri, 65535));
2654 tt_want(0 == evhttp_uri_set_path(uri, ""));
2655 tt_want(0 == evhttp_uri_set_path(uri, "/documents/public/index.html"));
2656 tt_want(0 == evhttp_uri_set_path(uri, NULL));
2657 tt_want(0 == evhttp_uri_set_query(uri, "key=val&key2=val2"));
2658 tt_want(0 == evhttp_uri_set_query(uri, "keyvalblarg"));
2659 tt_want(0 == evhttp_uri_set_query(uri, ""));
2660 tt_want(0 == evhttp_uri_set_query(uri, NULL));
2661 tt_want(0 == evhttp_uri_set_fragment(uri, ""));
2662 tt_want(0 == evhttp_uri_set_fragment(uri, "here?i?am"));
2663 tt_want(0 == evhttp_uri_set_fragment(uri, NULL));
2664 evhttp_uri_free(uri);
2667 uri = URI_PARSE("http://www.test.com/?q=t%33est");
2668 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2669 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2670 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2671 tt_want(strcmp(evhttp_uri_get_query(uri), "q=t%33est") == 0);
2672 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2673 tt_want(evhttp_uri_get_port(uri) == -1);
2674 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2676 evhttp_uri_free(uri);
2678 uri = URI_PARSE("http://%77ww.test.com");
2679 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2680 tt_want(strcmp(evhttp_uri_get_host(uri), "%77ww.test.com") == 0);
2681 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2682 tt_want(evhttp_uri_get_query(uri) == NULL);
2683 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2684 tt_want(evhttp_uri_get_port(uri) == -1);
2685 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2687 evhttp_uri_free(uri);
2689 uri = URI_PARSE("http://www.test.com?q=test");
2690 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2691 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2692 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2693 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2694 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2695 tt_want(evhttp_uri_get_port(uri) == -1);
2696 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2698 evhttp_uri_free(uri);
2700 uri = URI_PARSE("http://www.test.com#fragment");
2701 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2702 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2703 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2704 tt_want(evhttp_uri_get_query(uri) == NULL);
2705 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2706 tt_want(evhttp_uri_get_port(uri) == -1);
2707 tt_want_str_op(evhttp_uri_get_fragment(uri), ==, "fragment");
2709 evhttp_uri_free(uri);
2711 uri = URI_PARSE("http://8000/");
2712 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2713 tt_want(strcmp(evhttp_uri_get_host(uri), "8000") == 0);
2714 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2715 tt_want(evhttp_uri_get_query(uri) == NULL);
2716 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2717 tt_want(evhttp_uri_get_port(uri) == -1);
2718 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2720 evhttp_uri_free(uri);
2722 uri = URI_PARSE("http://:8000/");
2723 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2724 tt_want(strcmp(evhttp_uri_get_host(uri), "") == 0);
2725 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2726 tt_want(evhttp_uri_get_query(uri) == NULL);
2727 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2728 tt_want(evhttp_uri_get_port(uri) == 8000);
2729 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2731 evhttp_uri_free(uri);
2733 uri = URI_PARSE("http://www.test.com:/"); /* empty port */
2734 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2735 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2736 tt_want_str_op(evhttp_uri_get_path(uri), ==, "/");
2737 tt_want(evhttp_uri_get_query(uri) == NULL);
2738 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2739 tt_want(evhttp_uri_get_port(uri) == -1);
2740 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2742 evhttp_uri_free(uri);
2744 uri = URI_PARSE("http://www.test.com:"); /* empty port 2 */
2745 tt_want(strcmp(evhttp_uri_get_scheme(uri), "http") == 0);
2746 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2747 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2748 tt_want(evhttp_uri_get_query(uri) == NULL);
2749 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2750 tt_want(evhttp_uri_get_port(uri) == -1);
2751 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2753 evhttp_uri_free(uri);
2755 uri = URI_PARSE("ftp://www.test.com/?q=test");
2756 tt_want(strcmp(evhttp_uri_get_scheme(uri), "ftp") == 0);
2757 tt_want(strcmp(evhttp_uri_get_host(uri), "www.test.com") == 0);
2758 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2759 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2760 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2761 tt_want(evhttp_uri_get_port(uri) == -1);
2762 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2764 evhttp_uri_free(uri);
2766 uri = URI_PARSE("ftp://[::1]:999/?q=test");
2767 tt_want(strcmp(evhttp_uri_get_scheme(uri), "ftp") == 0);
2768 tt_want(strcmp(evhttp_uri_get_host(uri), "[::1]") == 0);
2769 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2770 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2771 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2772 tt_want(evhttp_uri_get_port(uri) == 999);
2773 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2775 evhttp_uri_free(uri);
2777 uri = URI_PARSE("ftp://[ff00::127.0.0.1]/?q=test");
2778 tt_want(strcmp(evhttp_uri_get_scheme(uri), "ftp") == 0);
2779 tt_want(strcmp(evhttp_uri_get_host(uri), "[ff00::127.0.0.1]") == 0);
2780 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2781 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2782 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2783 tt_want(evhttp_uri_get_port(uri) == -1);
2784 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2786 evhttp_uri_free(uri);
2788 uri = URI_PARSE("ftp://[v99.not_(any:time)_soon]/?q=test");
2789 tt_want(strcmp(evhttp_uri_get_scheme(uri), "ftp") == 0);
2790 tt_want(strcmp(evhttp_uri_get_host(uri), "[v99.not_(any:time)_soon]") == 0);
2791 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2792 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test") == 0);
2793 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2794 tt_want(evhttp_uri_get_port(uri) == -1);
2795 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2797 evhttp_uri_free(uri);
2799 uri = URI_PARSE("scheme://user:pass@foo.com:42/?q=test&s=some+thing#fragment");
2800 tt_want(strcmp(evhttp_uri_get_scheme(uri), "scheme") == 0);
2801 tt_want(strcmp(evhttp_uri_get_userinfo(uri), "user:pass") == 0);
2802 tt_want(strcmp(evhttp_uri_get_host(uri), "foo.com") == 0);
2803 tt_want(evhttp_uri_get_port(uri) == 42);
2804 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2805 tt_want(strcmp(evhttp_uri_get_query(uri), "q=test&s=some+thing") == 0);
2806 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fragment") == 0);
2808 evhttp_uri_free(uri);
2810 uri = URI_PARSE("scheme://user@foo.com/#fragment");
2811 tt_want(strcmp(evhttp_uri_get_scheme(uri), "scheme") == 0);
2812 tt_want(strcmp(evhttp_uri_get_userinfo(uri), "user") == 0);
2813 tt_want(strcmp(evhttp_uri_get_host(uri), "foo.com") == 0);
2814 tt_want(evhttp_uri_get_port(uri) == -1);
2815 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2816 tt_want(evhttp_uri_get_query(uri) == NULL);
2817 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fragment") == 0);
2819 evhttp_uri_free(uri);
2821 uri = URI_PARSE("scheme://%75ser@foo.com/#frag@ment");
2822 tt_want(strcmp(evhttp_uri_get_scheme(uri), "scheme") == 0);
2823 tt_want(strcmp(evhttp_uri_get_userinfo(uri), "%75ser") == 0);
2824 tt_want(strcmp(evhttp_uri_get_host(uri), "foo.com") == 0);
2825 tt_want(evhttp_uri_get_port(uri) == -1);
2826 tt_want(strcmp(evhttp_uri_get_path(uri), "/") == 0);
2827 tt_want(evhttp_uri_get_query(uri) == NULL);
2828 tt_want(strcmp(evhttp_uri_get_fragment(uri), "frag@ment") == 0);
2830 evhttp_uri_free(uri);
2832 uri = URI_PARSE("file:///some/path/to/the/file");
2833 tt_want(strcmp(evhttp_uri_get_scheme(uri), "file") == 0);
2834 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2835 tt_want(strcmp(evhttp_uri_get_host(uri), "") == 0);
2836 tt_want(evhttp_uri_get_port(uri) == -1);
2837 tt_want(strcmp(evhttp_uri_get_path(uri), "/some/path/to/the/file") == 0);
2838 tt_want(evhttp_uri_get_query(uri) == NULL);
2839 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2841 evhttp_uri_free(uri);
2843 uri = URI_PARSE("///some/path/to/the-file");
2844 tt_want(uri != NULL);
2845 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2846 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2847 tt_want(strcmp(evhttp_uri_get_host(uri), "") == 0);
2848 tt_want(evhttp_uri_get_port(uri) == -1);
2849 tt_want(strcmp(evhttp_uri_get_path(uri), "/some/path/to/the-file") == 0);
2850 tt_want(evhttp_uri_get_query(uri) == NULL);
2851 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2853 evhttp_uri_free(uri);
2855 uri = URI_PARSE("/s:ome/path/to/the-file?q=99#fred");
2856 tt_want(uri != NULL);
2857 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2858 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2859 tt_want(evhttp_uri_get_host(uri) == NULL);
2860 tt_want(evhttp_uri_get_port(uri) == -1);
2861 tt_want(strcmp(evhttp_uri_get_path(uri), "/s:ome/path/to/the-file") == 0);
2862 tt_want(strcmp(evhttp_uri_get_query(uri), "q=99") == 0);
2863 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fred") == 0);
2865 evhttp_uri_free(uri);
2867 uri = URI_PARSE("relative/path/with/co:lon");
2868 tt_want(uri != NULL);
2869 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2870 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2871 tt_want(evhttp_uri_get_host(uri) == NULL);
2872 tt_want(evhttp_uri_get_port(uri) == -1);
2873 tt_want(strcmp(evhttp_uri_get_path(uri), "relative/path/with/co:lon") == 0);
2874 tt_want(evhttp_uri_get_query(uri) == NULL);
2875 tt_want(evhttp_uri_get_fragment(uri) == NULL);
2877 evhttp_uri_free(uri);
2879 uri = URI_PARSE("bob?q=99&q2=q?33#fr?ed");
2880 tt_want(uri != NULL);
2881 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2882 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2883 tt_want(evhttp_uri_get_host(uri) == NULL);
2884 tt_want(evhttp_uri_get_port(uri) == -1);
2885 tt_want(strcmp(evhttp_uri_get_path(uri), "bob") == 0);
2886 tt_want(strcmp(evhttp_uri_get_query(uri), "q=99&q2=q?33") == 0);
2887 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fr?ed") == 0);
2889 evhttp_uri_free(uri);
2891 uri = URI_PARSE("#fr?ed");
2892 tt_want(uri != NULL);
2893 tt_want(evhttp_uri_get_scheme(uri) == NULL);
2894 tt_want(evhttp_uri_get_userinfo(uri) == NULL);
2895 tt_want(evhttp_uri_get_host(uri) == NULL);
2896 tt_want(evhttp_uri_get_port(uri) == -1);
2897 tt_want(strcmp(evhttp_uri_get_path(uri), "") == 0);
2898 tt_want(evhttp_uri_get_query(uri) == NULL);
2899 tt_want(strcmp(evhttp_uri_get_fragment(uri), "fr?ed") == 0);
2901 evhttp_uri_free(uri);
3673 http_simple_test_impl(void *arg, int ssl, int dirty, const char *uri)
3698 if (evhttp_make_request(evcon, req, EVHTTP_REQ_GET, uri) == -1)