Exemple #1
0
static void InternetCanonicalizeUrl_test(void)
{
    char src[] = "http://www.winehq.org/%27/ /./>/#>  ";
    char dst[64];
    DWORD dstlen;

    dstlen = sizeof(dst);
    InternetCanonicalizeUrlA(src, dst, &dstlen, 0);
    ok(strcmp(dst, "http://www.winehq.org/%27/%20/%3E/#>") == 0, "Got \"%s\"\n", dst);

    /* despite what MSDN says, ICU_BROWSER_MODE seems to be ignored */
    dstlen = sizeof(dst);
    InternetCanonicalizeUrlA(src, dst, &dstlen, ICU_BROWSER_MODE);
    ok(strcmp(dst, "http://www.winehq.org/%27/%20/%3E/#>") == 0, "Got \"%s\"\n", dst);

    /* ICU_ESCAPE is supposed to be ignored */
    dstlen = sizeof(dst);
    InternetCanonicalizeUrlA(src, dst, &dstlen, ICU_ESCAPE);
    ok(strcmp(dst, "http://www.winehq.org/%27/%20/%3E/#>") == 0, "Got \"%s\"\n", dst);

    dstlen = sizeof(dst);
    InternetCanonicalizeUrlA(src, dst, &dstlen, ICU_DECODE);
    ok(strcmp(dst, "http://www.winehq.org/'/%20/%3E/#>") == 0, "Got \"%s\"\n", dst);

    dstlen = sizeof(dst);
    InternetCanonicalizeUrlA(src, dst, &dstlen, ICU_ENCODE_PERCENT);
    ok(strcmp(dst, "http://www.winehq.org/%2527/%20/%3E/#>") == 0, "Got \"%s\"\n", dst);

    dstlen = sizeof(dst);
    InternetCanonicalizeUrlA(src, dst, &dstlen, ICU_ENCODE_SPACES_ONLY);
    ok(strcmp(dst, "http://www.winehq.org/%27/%20/>/#>") == 0, "Got \"%s\"\n", dst);

    dstlen = sizeof(dst);
    InternetCanonicalizeUrlA(src, dst, &dstlen, ICU_NO_ENCODE);
    ok(strcmp(dst, "http://www.winehq.org/%27/ />/#>") == 0, "Got \"%s\"\n", dst);

    dstlen = sizeof(dst);
    InternetCanonicalizeUrlA(src, dst, &dstlen, ICU_NO_META);
    ok(strcmp(dst, "http://www.winehq.org/%27/%20/./%3E/#>") == 0, "Got \"%s\"\n", dst);
}
Exemple #2
0
int callback_uri(http_parser *parser, const char *pos, size_t len)

{

	http_message *message = (http_message *) TlsGetValue(dwTlsIndex);

	char uri_buf[MAX_URI_SIZE];

	DWORD uri_buflen = MAX_URI_SIZE;

	

	strncpy_s(uri_buf, MAX_URI_SIZE, pos, len);

	InternetCanonicalizeUrlA(uri_buf, message->request_uri, &uri_buflen, ICU_DECODE | ICU_NO_ENCODE);



	return 0;

}