html.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. /* snac - A simple, minimalistic ActivityPub instance */
  2. /* copyright (c) 2022 grunfink - MIT license */
  3. #include "xs.h"
  4. #include "xs_io.h"
  5. #include "xs_encdec.h"
  6. #include "xs_json.h"
  7. #include "xs_regex.h"
  8. #include "xs_set.h"
  9. #include "xs_openssl.h"
  10. #include "snac.h"
  11. d_char *not_really_markdown(char *content, d_char **f_content)
  12. /* formats a content using some Markdown rules */
  13. {
  14. d_char *s = NULL;
  15. int in_pre = 0;
  16. int in_blq = 0;
  17. xs *list;
  18. char *p, *v;
  19. xs *wrk = xs_str_new(NULL);
  20. {
  21. /* split by special markup */
  22. xs *sm = xs_regex_split(content,
  23. "(`[^`]+`|\\*\\*?[^\\*]+\\*?\\*|https?:/" "/[^ ]*)");
  24. int n = 0;
  25. p = sm;
  26. while (xs_list_iter(&p, &v)) {
  27. if ((n & 0x1)) {
  28. /* markup */
  29. if (xs_startswith(v, "`")) {
  30. xs *s1 = xs_crop(xs_dup(v), 1, -1);
  31. xs *s2 = xs_fmt("<code>%s</code>", s1);
  32. wrk = xs_str_cat(wrk, s2);
  33. }
  34. else
  35. if (xs_startswith(v, "**")) {
  36. xs *s1 = xs_crop(xs_dup(v), 2, -2);
  37. xs *s2 = xs_fmt("<b>%s</b>", s1);
  38. wrk = xs_str_cat(wrk, s2);
  39. }
  40. else
  41. if (xs_startswith(v, "*")) {
  42. xs *s1 = xs_crop(xs_dup(v), 1, -1);
  43. xs *s2 = xs_fmt("<i>%s</i>", s1);
  44. wrk = xs_str_cat(wrk, s2);
  45. }
  46. else
  47. if (xs_startswith(v, "http")) {
  48. xs *s1 = xs_fmt("<a href=\"%s\">%s</a>", v, v);
  49. wrk = xs_str_cat(wrk, s1);
  50. }
  51. else
  52. /* what the hell is this */
  53. wrk = xs_str_cat(wrk, v);
  54. }
  55. else
  56. /* surrounded text, copy directly */
  57. wrk = xs_str_cat(wrk, v);
  58. n++;
  59. }
  60. }
  61. /* now work by lines */
  62. p = list = xs_split(wrk, "\n");
  63. s = xs_str_new(NULL);
  64. while (xs_list_iter(&p, &v)) {
  65. xs *ss = xs_strip(xs_dup(v));
  66. if (xs_startswith(ss, "```")) {
  67. if (!in_pre)
  68. s = xs_str_cat(s, "<pre>");
  69. else
  70. s = xs_str_cat(s, "</pre>");
  71. in_pre = !in_pre;
  72. continue;
  73. }
  74. if (xs_startswith(ss, ">")) {
  75. /* delete the > and subsequent spaces */
  76. ss = xs_strip(xs_crop(ss, 1, 0));
  77. if (!in_blq) {
  78. s = xs_str_cat(s, "<blockquote>");
  79. in_blq = 1;
  80. }
  81. s = xs_str_cat(s, ss);
  82. s = xs_str_cat(s, "<br>");
  83. continue;
  84. }
  85. if (in_blq) {
  86. s = xs_str_cat(s, "</blockquote>");
  87. in_blq = 0;
  88. }
  89. s = xs_str_cat(s, ss);
  90. s = xs_str_cat(s, "<br>");
  91. }
  92. if (in_blq)
  93. s = xs_str_cat(s, "</blockquote>");
  94. if (in_pre)
  95. s = xs_str_cat(s, "</pre>");
  96. /* some beauty fixes */
  97. s = xs_replace_i(s, "</blockquote><br>", "</blockquote>");
  98. *f_content = s;
  99. return *f_content;
  100. }
  101. int login(snac *snac, char *headers)
  102. /* tries a login */
  103. {
  104. int logged_in = 0;
  105. char *auth = xs_dict_get(headers, "authorization");
  106. if (auth && xs_startswith(auth, "Basic ")) {
  107. int sz;
  108. xs *s1 = xs_crop(xs_dup(auth), 6, 0);
  109. xs *s2 = xs_base64_dec(s1, &sz);
  110. xs *l1 = xs_split_n(s2, ":", 1);
  111. if (xs_list_len(l1) == 2) {
  112. logged_in = check_password(
  113. xs_list_get(l1, 0), xs_list_get(l1, 1),
  114. xs_dict_get(snac->config, "passwd"));
  115. }
  116. }
  117. return logged_in;
  118. }
  119. d_char *html_msg_icon(snac *snac, d_char *os, char *msg)
  120. {
  121. char *actor_id;
  122. xs *actor = NULL;
  123. xs *s = xs_str_new(NULL);
  124. if ((actor_id = xs_dict_get(msg, "attributedTo")) == NULL)
  125. actor_id = xs_dict_get(msg, "actor");
  126. if (actor_id && valid_status(actor_get(snac, actor_id, &actor))) {
  127. xs *name = NULL;
  128. xs *avatar = NULL;
  129. char *v;
  130. /* get the name */
  131. if ((v = xs_dict_get(actor, "name")) == NULL) {
  132. if ((v = xs_dict_get(actor, "preferredUsername")) == NULL) {
  133. v = "user";
  134. }
  135. }
  136. name = xs_dup(v);
  137. /* get the avatar */
  138. if ((v = xs_dict_get(actor, "icon")) != NULL &&
  139. (v = xs_dict_get(v, "url")) != NULL) {
  140. avatar = xs_dup(v);
  141. }
  142. if (avatar == NULL)
  143. avatar = xs_fmt("data:image/png;base64, %s", susie);
  144. {
  145. xs *s1 = xs_fmt("<p><img class=\"snac-avatar\" src=\"%s\" alt=\"\"/>\n", avatar);
  146. s = xs_str_cat(s, s1);
  147. }
  148. {
  149. xs *s1 = xs_fmt("<a href=\"%s\" class=\"p-author h-card snac-author\">%s</a>",
  150. actor_id, name);
  151. s = xs_str_cat(s, s1);
  152. }
  153. if (strcmp(xs_dict_get(msg, "type"), "Note") == 0) {
  154. xs *s1 = xs_fmt(" <a href=\"%s\">»</a>", xs_dict_get(msg, "id"));
  155. s = xs_str_cat(s, s1);
  156. }
  157. if (!is_msg_public(snac, msg))
  158. s = xs_str_cat(s, " <span title=\"private\">&#128274;</span>");
  159. if ((v = xs_dict_get(msg, "published")) == NULL)
  160. v = "&nbsp;";
  161. {
  162. xs *s1 = xs_fmt("<br>\n<time class=\"dt-published snac-pubdate\">%s</time>\n", v);
  163. s = xs_str_cat(s, s1);
  164. }
  165. }
  166. return xs_str_cat(os, s);
  167. }
  168. d_char *html_user_header(snac *snac, d_char *s, int local)
  169. /* creates the HTML header */
  170. {
  171. char *p, *v;
  172. s = xs_str_cat(s, "<!DOCTYPE html>\n<html>\n<head>\n");
  173. s = xs_str_cat(s, "<meta name=\"viewport\" "
  174. "content=\"width=device-width, initial-scale=1\"/>\n");
  175. s = xs_str_cat(s, "<meta name=\"generator\" "
  176. "content=\"" USER_AGENT "\"/>\n");
  177. /* add server CSS */
  178. p = xs_dict_get(srv_config, "cssurls");
  179. while (xs_list_iter(&p, &v)) {
  180. xs *s1 = xs_fmt("<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\"/>\n", v);
  181. s = xs_str_cat(s, s1);
  182. }
  183. /* add the user CSS */
  184. {
  185. xs *css = NULL;
  186. int size;
  187. if (valid_status(static_get(snac, "style.css", &css, &size))) {
  188. xs *s1 = xs_fmt("<style>%s</style>\n", css);
  189. s = xs_str_cat(s, s1);
  190. }
  191. }
  192. {
  193. xs *s1 = xs_fmt("<title>%s</title>\n", xs_dict_get(snac->config, "name"));
  194. s = xs_str_cat(s, s1);
  195. }
  196. s = xs_str_cat(s, "</head>\n<body>\n");
  197. /* top nav */
  198. s = xs_str_cat(s, "<nav class=\"snac-top-nav\">");
  199. {
  200. xs *s1;
  201. if (local)
  202. s1 = xs_fmt("<a href=\"%s/admin\">%s</a></nav>\n", snac->actor, L("admin"));
  203. else
  204. s1 = xs_fmt("<a href=\"%s\">%s</a></nav>\n", snac->actor, L("public"));
  205. s = xs_str_cat(s, s1);
  206. }
  207. /* user info */
  208. {
  209. xs *bio = NULL;
  210. char *_tmpl =
  211. "<div class=\"h-card snac-top-user\">\n"
  212. "<p class=\"p-name snac-top-user-name\">%s</p>\n"
  213. "<p class=\"snac-top-user-id\">@%s@%s</p>\n"
  214. "<div class=\"p-note snac-top-user-bio\">%s</div>\n"
  215. "</div>\n";
  216. not_really_markdown(xs_dict_get(snac->config, "bio"), &bio);
  217. xs *s1 = xs_fmt(_tmpl,
  218. xs_dict_get(snac->config, "name"),
  219. xs_dict_get(snac->config, "uid"), xs_dict_get(srv_config, "host"),
  220. bio
  221. );
  222. s = xs_str_cat(s, s1);
  223. }
  224. return s;
  225. }
  226. d_char *html_top_controls(snac *snac, d_char *s)
  227. /* generates the top controls */
  228. {
  229. char *_tmpl =
  230. "<div class=\"snac-top-controls\">\n"
  231. "<div class=\"snac-note\">\n"
  232. "<form method=\"post\" action=\"%s/admin/note\">\n"
  233. "<textarea class=\"snac-textarea\" name=\"content\" "
  234. "rows=\"8\" wrap=\"virtual\" required=\"required\"></textarea>\n"
  235. "<input type=\"hidden\" name=\"in_reply_to\" value=\"\">\n"
  236. "<input type=\"submit\" class=\"button\" value=\"%s\">\n"
  237. "</form><p>\n"
  238. "</div>\n"
  239. "<div class=\"snac-top-controls-more\">\n"
  240. "<details><summary>%s</summary>\n"
  241. "<form method=\"post\" action=\"%s/admin/action\">\n"
  242. "<input type=\"text\" name=\"actor\" required=\"required\">\n"
  243. "<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n"
  244. "</form></p>\n"
  245. "<form method=\"post\" action=\"%s\">\n"
  246. "<input type=\"text\" name=\"id\" required=\"required\">\n"
  247. "<input type=\"submit\" name=\"action\" value=\"%s\"> %s\n"
  248. "</form></p>\n"
  249. "<details><summary>%s</summary>\n"
  250. "<div class=\"snac-user-setup\">\n"
  251. "<form method=\"post\" action=\"%s/admin/user-setup\">\n"
  252. "<p>%s:<br>\n"
  253. "<input type=\"text\" name=\"name\" value=\"%s\"></p>\n"
  254. "<p>%s:<br>\n"
  255. "<input type=\"text\" name=\"avatar\" value=\"%s\"></p>\n"
  256. "<p>%s:<br>\n"
  257. "<textarea name=\"bio\" cols=60 rows=4>%s</textarea></p>\n"
  258. "<p>%s:<br>\n"
  259. "<input type=\"password\" name=\"passwd1\" value=\"\"></p>\n"
  260. "<p>%s:<br>\n"
  261. "<input type=\"password\" name=\"passwd2\" value=\"\"></p>\n"
  262. "<input type=\"submit\" class=\"button\" value=\"%s\">\n"
  263. "</form>\n"
  264. "</div>\n"
  265. "</details>\n"
  266. "</details>\n"
  267. "</div>\n"
  268. "</div>\n";
  269. xs *s1 = xs_fmt(_tmpl,
  270. snac->actor,
  271. L("Post"),
  272. L("More options..."),
  273. snac->actor,
  274. L("Follow"), L("(by URL or user@host)"),
  275. snac->actor,
  276. L("Boost"), L("(by URL)"),
  277. L("User setup..."),
  278. snac->actor,
  279. L("User name"),
  280. xs_dict_get(snac->config, "name"),
  281. L("Avatar URL"),
  282. xs_dict_get(snac->config, "avatar"),
  283. L("Bio"),
  284. xs_dict_get(snac->config, "bio"),
  285. L("Password (only to change it)"),
  286. L("Repeat Password"),
  287. L("Update user info")
  288. );
  289. s = xs_str_cat(s, s1);
  290. return s;
  291. }
  292. d_char *html_entry_controls(snac *snac, d_char *os, char *msg)
  293. {
  294. char *id = xs_dict_get(msg, "id");
  295. char *actor = xs_dict_get(msg, "attributedTo");
  296. xs *s = xs_str_new(NULL);
  297. xs *md5 = xs_md5_hex(id, strlen(id));
  298. s = xs_str_cat(s, "<div class=\"snac-controls\">\n");
  299. {
  300. xs *s1 = xs_fmt(
  301. "<form method=\"post\" action=\"%s/admin/action\">\n"
  302. "<input type=\"hidden\" name=\"id\" value=\"%s\">\n"
  303. "<input type=\"hidden\" name=\"actor\" value=\"%s\">\n"
  304. "<input type=\"button\" name=\"action\" "
  305. "value=\"%s\" onclick=\""
  306. "x = document.getElementById('%s_reply'); "
  307. "if (x.style.display == 'block') "
  308. " x.style.display = 'none'; else "
  309. " x.style.display = 'block';"
  310. "\">\n",
  311. snac->actor, id, actor,
  312. L("Reply"),
  313. md5
  314. );
  315. s = xs_str_cat(s, s1);
  316. }
  317. if (strcmp(actor, snac->actor) != 0) {
  318. /* controls for other actors than this one */
  319. }
  320. s = xs_str_cat(s, "</form>\n");
  321. {
  322. xs *ct = xs_str_new("");
  323. xs *s1 = xs_fmt(
  324. "<p><div class=\"snac-note\" style=\"display: none\" id=\"%s_reply\">\n"
  325. "<form method=\"post\" action=\"%s/admin/note\" id=\"%s_reply_form\">\n"
  326. "<textarea class=\"snac-textarea\" name=\"content\" "
  327. "rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n"
  328. "<input type=\"hidden\" name=\"in_reply_to\" value=\"%s\">\n"
  329. "<input type=\"submit\" class=\"button\" value=\"%s\">\n"
  330. "</form><p></div>\n",
  331. md5,
  332. snac->actor, md5,
  333. ct,
  334. id,
  335. L("Post")
  336. );
  337. s = xs_str_cat(s, s1);
  338. }
  339. return xs_str_cat(os, s);
  340. }
  341. d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, int level)
  342. {
  343. char *id = xs_dict_get(msg, "id");
  344. char *type = xs_dict_get(msg, "type");
  345. char *meta = xs_dict_get(msg, "_snac");
  346. xs *actor_o = NULL;
  347. char *actor;
  348. /* return if already seen */
  349. if (xs_set_add(seen, id) == 0)
  350. return os;
  351. if (strcmp(type, "Follow") == 0)
  352. return os;
  353. /* bring the main actor */
  354. if ((actor = xs_dict_get(msg, "attributedTo")) == NULL)
  355. return os;
  356. if (!valid_status(actor_get(snac, actor, &actor_o)))
  357. return os;
  358. xs *s = xs_str_new(NULL);
  359. /* if this is our post, add the score */
  360. if (xs_startswith(id, snac->actor)) {
  361. int likes = xs_list_len(xs_dict_get(meta, "liked_by"));
  362. int boosts = xs_list_len(xs_dict_get(meta, "announced_by"));
  363. xs *s1 = xs_fmt(
  364. "<div class=\"snac-score\">%d &#9733; %d &#8634;</div>\n",
  365. likes, boosts);
  366. s = xs_str_cat(s, s1);
  367. }
  368. if (level == 0) {
  369. char *referrer;
  370. s = xs_str_cat(s, "<div class=\"snac-post\">\n");
  371. /* print the origin of the post, if any */
  372. if ((referrer = xs_dict_get(meta, "referrer")) != NULL) {
  373. xs *actor_r = NULL;
  374. if (valid_status(actor_get(snac, referrer, &actor_r))) {
  375. char *name;
  376. if ((name = xs_dict_get(actor_r, "name")) == NULL)
  377. name = xs_dict_get(actor_r, "preferredUsername");
  378. xs *s1 = xs_fmt(
  379. "<div class=\"snac-origin\">"
  380. "<a href=\"%s\">%s</a> %s</div>\n",
  381. xs_dict_get(actor_r, "id"),
  382. name,
  383. L("boosted")
  384. );
  385. s = xs_str_cat(s, s1);
  386. }
  387. }
  388. }
  389. else
  390. s = xs_str_cat(s, "<div class=\"snac-child\">\n");
  391. s = html_msg_icon(snac, s, msg);
  392. /* add the content */
  393. s = xs_str_cat(s, "<div class=\"e-content snac-content\">\n");
  394. {
  395. xs *c = xs_dup(xs_dict_get(msg, "content"));
  396. /* do some tweaks to the content */
  397. c = xs_replace_i(c, "\r", "");
  398. while (xs_endswith(c, "<br><br>"))
  399. c = xs_crop(c, 0, -4);
  400. c = xs_replace_i(c, "<br><br>", "<p>");
  401. if (!xs_startswith(c, "<p>")) {
  402. xs *s1 = c;
  403. c = xs_fmt("<p>%s</p>", s1);
  404. }
  405. s = xs_str_cat(s, c);
  406. }
  407. s = xs_str_cat(s, "\n");
  408. /* add the attachments */
  409. char *attach;
  410. if ((attach = xs_dict_get(msg, "attachment")) != NULL) {
  411. char *v;
  412. while (xs_list_iter(&attach, &v)) {
  413. char *t = xs_dict_get(v, "mediaType");
  414. if (t && xs_startswith(t, "image/")) {
  415. char *url = xs_dict_get(v, "url");
  416. char *name = xs_dict_get(v, "name");
  417. if (url != NULL) {
  418. xs *s1 = xs_fmt("<p><img src=\"%s\" alt=\"%s\"/></p>\n",
  419. url, xs_is_null(name) ? "" : name);
  420. s = xs_str_cat(s, s1);
  421. }
  422. }
  423. }
  424. }
  425. s = xs_str_cat(s, "</div>\n");
  426. /** controls **/
  427. if (!local)
  428. s = html_entry_controls(snac, s, msg);
  429. /** children **/
  430. char *children = xs_dict_get(meta, "children");
  431. if (xs_list_len(children)) {
  432. int left = xs_list_len(children);
  433. char *id;
  434. s = xs_str_cat(s, "<div class=\"snac-children\">\n");
  435. if (left > 3)
  436. s = xs_str_cat(s, "<details><summary>...</summary>\n");
  437. while (xs_list_iter(&children, &id)) {
  438. xs *chd = timeline_find(snac, id);
  439. if (left == 0)
  440. s = xs_str_cat(s, "</details>\n");
  441. if (chd != NULL)
  442. s = html_entry(snac, s, chd, seen, local, level + 1);
  443. else
  444. snac_debug(snac, 1, xs_fmt("cannot read from timeline child %s", id));
  445. left--;
  446. }
  447. s = xs_str_cat(s, "</div>\n");
  448. }
  449. s = xs_str_cat(s, "</div>\n");
  450. return xs_str_cat(os, s);
  451. }
  452. d_char *html_user_footer(snac *snac, d_char *s)
  453. {
  454. xs *s1 = xs_fmt(
  455. "<div class=\"snac-footer\">\n"
  456. "<a href=\"%s\">%s</a> - "
  457. "powered by <abbr title=\"Social Networks Are Crap\">snac</abbr></div>\n",
  458. srv_baseurl,
  459. L("about this site")
  460. );
  461. return xs_str_cat(s, s1);
  462. }
  463. d_char *html_timeline(snac *snac, char *list, int local)
  464. /* returns the HTML for the timeline */
  465. {
  466. d_char *s = xs_str_new(NULL);
  467. xs_set *seen = xs_set_new(4096);
  468. char *v;
  469. double t = ftime();
  470. s = html_user_header(snac, s, local);
  471. if (!local)
  472. s = html_top_controls(snac, s);
  473. s = xs_str_cat(s, "<div class=\"snac-posts\">\n");
  474. while (xs_list_iter(&list, &v)) {
  475. xs *msg = timeline_get(snac, v);
  476. s = html_entry(snac, s, msg, seen, local, 0);
  477. }
  478. s = xs_str_cat(s, "</div>\n");
  479. s = html_user_footer(snac, s);
  480. {
  481. xs *s1 = xs_fmt("<!-- %lf seconds -->\n", ftime() - t);
  482. s = xs_str_cat(s, s1);
  483. }
  484. s = xs_str_cat(s, "</body>\n</html>\n");
  485. xs_set_free(seen);
  486. return s;
  487. }
  488. int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char **ctype)
  489. {
  490. int status = 404;
  491. snac snac;
  492. char *uid, *p_path;
  493. xs *l = xs_split_n(q_path, "/", 2);
  494. uid = xs_list_get(l, 1);
  495. if (!uid || !user_open(&snac, uid)) {
  496. /* invalid user */
  497. srv_log(xs_fmt("html_get_handler bad user %s", uid));
  498. return 404;
  499. }
  500. p_path = xs_list_get(l, 2);
  501. if (p_path == NULL) {
  502. /* public timeline */
  503. xs *list = local_list(&snac, 0xfffffff);
  504. *body = html_timeline(&snac, list, 1);
  505. *b_size = strlen(*body);
  506. status = 200;
  507. }
  508. else
  509. if (strcmp(p_path, "admin") == 0) {
  510. /* private timeline */
  511. if (!login(&snac, req))
  512. status = 401;
  513. else {
  514. xs *list = timeline_list(&snac, 0xfffffff);
  515. *body = html_timeline(&snac, list, 0);
  516. *b_size = strlen(*body);
  517. status = 200;
  518. }
  519. }
  520. else
  521. if (xs_startswith(p_path, "p/") == 0) {
  522. /* a timeline with just one entry */
  523. }
  524. else
  525. if (xs_startswith(p_path, "s/") == 0) {
  526. /* a static file */
  527. }
  528. else
  529. if (xs_startswith(p_path, "h/") == 0) {
  530. /* an entry from the history */
  531. }
  532. else
  533. status = 404;
  534. user_free(&snac);
  535. if (valid_status(status)) {
  536. *ctype = "text/html; charset=utf-8";
  537. }
  538. return status;
  539. }
  540. int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
  541. char **body, int *b_size, char **ctype)
  542. {
  543. int status = 0;
  544. return status;
  545. }