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=\"bc9ef2fa9891939c3fbb0a5892410c75\","
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=\"517a8a2617faed1847835f3ec271ca38\","
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);
91
struct curl_slist *list = NULL;
92
const char *body = "PLAIN TEXT";
95
curl_easy_setopt(curl, CURLOPT_URL,
96
"http://localhost:17123/plain.txt");
97
curl_easy_setopt(curl, CURLOPT_POST, 1);
98
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body);
99
list = curl_slist_append(list,
100
"Authorization: Digest username=\"admin\","
101
"realm=\"AuthInt Example\","
102
"nonce=\"367sj3265s5\","
103
"uri=\"/plain.txt\","
106
"cnonce=\"hxk1lu63b6c7vhk\","
107
"response=\"5ab6822b9d906cc711760a7783b28dca\","
108
"opaque=\"87aaxcval4gba36\"");
109
list = curl_slist_append(list,
110
"Content-Type: application/octet-stream");
111
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
112
c = curl_easy_perform(curl);
113
curl_slist_free_all(list);
114
return(CURLE_OK == c);
121
const char *page = "index";
125
if (khttp_fcgi_test())
127
if (KCGI_OK != khttp_parse(&r, NULL, 0, &page, 1, 0))
129
if (KAUTH_DIGEST != r.rawauth.type)
131
else if (0 == r.rawauth.authorised)
133
else if (strcmp(r.rawauth.d.digest.user, "admin"))
135
else if (strcmp(r.rawauth.d.digest.realm, "AuthInt Example"))
137
else if (strcmp(r.rawauth.d.digest.uri, "/plain.txt"))
139
else if (khttpdigest_validate(&r, "12435") <= 0)
142
khttp_head(&r, kresps[KRESP_STATUS],
143
"%s", khttps[KHTTP_200]);
144
khttp_head(&r, kresps[KRESP_CONTENT_TYPE],
145
"%s", kmimetypes[KMIME_TEXT_HTML]);
154
main(int argc, char *argv[])
157
if ( ! regress_cgi(parent1, child))
159
if ( ! regress_cgi(parent2, child))
161
if ( ! regress_cgi(parent3, child))