33
struct curl_slist *list = NULL;
34
const char *body = "PLAIN TEXT";
37
curl_easy_setopt(curl, CURLOPT_URL,
38
"http://localhost:17123/plain.txt");
39
curl_easy_setopt(curl, CURLOPT_POST, 1);
40
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body);
41
list = curl_slist_append(list,
42
"Authorization: Digest username=\"admin\","
43
"realm=\"AuthInt Example\","
44
"nonce=\"367sj3265s5\","
48
"cnonce=\"hxk1lu63b6c7vhk\","
49
"response=\"5ab6822b9d906cc711760a7783b28dca\","
50
"opaque=\"87aaxcval4gba36\"");
51
list = curl_slist_append(list,
52
"Content-Type: application/octet-stream");
53
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
54
c = curl_easy_perform(curl);
55
curl_slist_free_all(list);
56
return(CURLE_OK == c);
62
struct curl_slist *list = NULL;
63
const char *body = "PLAIN TEXT";
66
curl_easy_setopt(curl, CURLOPT_URL,
67
"http://localhost:17123/plain.txt");
68
curl_easy_setopt(curl, CURLOPT_POST, 1);
69
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body);
70
list = curl_slist_append(list,
71
"Authorization: Digest username=\"admin\","
72
"realm=\"AuthInt Example\","
73
"nonce=\"367sj3265s5\","
77
"cnonce=\"hxk1lu63b6c7vhk\","
78
"response=\"f00f00f00f00f00f00760a7783b28dca\","
79
"opaque=\"87aaxcval4gba36\"");
80
list = curl_slist_append(list,
81
"Content-Type: application/octet-stream");
82
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
83
c = curl_easy_perform(curl);
84
curl_slist_free_all(list);
85
return(CURLE_OK == c);
92
const char *page = "index";
96
if (khttp_fcgi_test())
98
if (KCGI_OK != khttp_parse(&r, NULL, 0, &page, 1, 0))
100
if (KAUTH_DIGEST != r.rawauth.type)
102
else if (0 == r.rawauth.authorised)
104
else if (strcmp(r.rawauth.d.digest.user, "admin"))
106
else if (strcmp(r.rawauth.d.digest.realm, "AuthInt Example"))
108
else if (strcmp(r.rawauth.d.digest.uri, "/plain.txt"))
110
else if (khttpdigest_validate(&r, "12435") <= 0)
113
khttp_head(&r, kresps[KRESP_STATUS],
114
"%s", khttps[KHTTP_200]);
115
khttp_head(&r, kresps[KRESP_CONTENT_TYPE],
116
"%s", kmimetypes[KMIME_TEXT_HTML]);
125
main(int argc, char *argv[])
128
if (regress_cgi(parent0, child))
130
if (regress_cgi(parent1, child))