* Parse expires header field body */
| 68 | * Parse expires header field body |
| 69 | */ |
| 70 | int parse_expires(struct hdr_field* _h) |
| 71 | { |
| 72 | exp_body_t* e; |
| 73 | |
| 74 | if (_h->parsed) { |
| 75 | return 0; /* Already parsed */ |
| 76 | } |
| 77 | |
| 78 | e = (exp_body_t*)pkg_malloc(sizeof(exp_body_t)); |
| 79 | if (e == 0) { |
| 80 | LM_ERR("no pkg memory left\n"); |
| 81 | return -1; |
| 82 | } |
| 83 | |
| 84 | memset(e, 0, sizeof(exp_body_t)); |
| 85 | |
| 86 | if (expires_parser(_h->body.s, _h->body.len, e) < 0) { |
| 87 | LM_ERR("failed to parse\n"); |
| 88 | set_err_info(OSER_EC_PARSER, OSER_EL_MEDIUM, |
| 89 | "error parsing EXPIRE header"); |
| 90 | set_err_reply(400, "bad headers"); |
| 91 | pkg_free(e); |
| 92 | return -2; |
| 93 | } |
| 94 | |
| 95 | _h->parsed = (void*)e; |
| 96 | return 0; |
| 97 | } |
| 98 | |
| 99 | |
| 100 | /* |
no test coverage detected