| 5 | ////////////////////////////////////////////////////////////////////////// |
| 6 | |
| 7 | static bool set_cookies(tpl_t* tpl) |
| 8 | { |
| 9 | printf("Please enter cookie name: "); fflush(stdout); |
| 10 | char line[256]; |
| 11 | int n = acl_vstream_gets_nonl(ACL_VSTREAM_IN, line, sizeof(line)); |
| 12 | if (n == ACL_VSTREAM_EOF) { |
| 13 | printf("enter cookie name error!\r\n"); |
| 14 | return false; |
| 15 | } |
| 16 | |
| 17 | string buf; |
| 18 | buf.format("const char* %s = req.getCookieValue(\"%s\");\r\n", line, line); |
| 19 | buf.format_append("\tif (%s == NULL) {\r\n\t\tres.addCookie(\"%s\", \"{xxx}\");\r\n\t}\r\n", line, line); |
| 20 | |
| 21 | tpl_set_field_fmt_global(tpl, "GET_COOKIES", "%s", buf.c_str()); |
| 22 | return true; |
| 23 | } |
| 24 | |
| 25 | ////////////////////////////////////////////////////////////////////////// |
| 26 |
no test coverage detected
searching dependent graphs…