add_if_state adds a condition to an if_header. */
| 598 | /* add_if_state adds a condition to an if_header. |
| 599 | */ |
| 600 | static dav_error * dav_add_if_state(apr_pool_t *p, dav_if_header *ih, |
| 601 | const char *state_token, |
| 602 | dav_if_state_type t, int condition, |
| 603 | const dav_hooks_locks *locks_hooks) |
| 604 | { |
| 605 | dav_if_state_list *new_sl; |
| 606 | |
| 607 | new_sl = apr_pcalloc(p, sizeof(*new_sl)); |
| 608 | |
| 609 | new_sl->condition = condition; |
| 610 | new_sl->type = t; |
| 611 | |
| 612 | if (t == dav_if_opaquelock) { |
| 613 | dav_error *err; |
| 614 | |
| 615 | if ((err = (*locks_hooks->parse_locktoken)(p, state_token, |
| 616 | &new_sl->locktoken)) != NULL) { |
| 617 | /* If the state token cannot be parsed, treat it as an |
| 618 | * unknown state; this will evaluate to "false" later |
| 619 | * during If header validation. */ |
| 620 | if (err->error_id == DAV_ERR_LOCK_UNK_STATE_TOKEN) { |
| 621 | new_sl->type = dav_if_unknown; |
| 622 | } |
| 623 | else { |
| 624 | /* ### maybe add a higher-level description */ |
| 625 | return err; |
| 626 | } |
| 627 | } |
| 628 | } |
| 629 | else |
| 630 | new_sl->etag = state_token; |
| 631 | |
| 632 | new_sl->next = ih->state; |
| 633 | ih->state = new_sl; |
| 634 | |
| 635 | return NULL; |
| 636 | } |
| 637 | |
| 638 | /* fetch_next_token returns the substring from str+1 |
| 639 | * to the next occurrence of char term, or \0, whichever |
no outgoing calls
no test coverage detected