| 8862 | } |
| 8863 | |
| 8864 | void |
| 8865 | HttpTransact::delete_warning_value(HTTPHdr *to_warn, HTTPWarningCode warning_code) |
| 8866 | { |
| 8867 | int w_code = static_cast<int>(warning_code); |
| 8868 | MIMEField *field = to_warn->field_find(MIME_FIELD_WARNING, MIME_LEN_WARNING); |
| 8869 | |
| 8870 | // Loop over the values to see if we need to do anything |
| 8871 | if (field) { |
| 8872 | HdrCsvIter iter; |
| 8873 | int val_code; |
| 8874 | MIMEField *new_field = nullptr; |
| 8875 | |
| 8876 | bool valid_p = iter.get_first_int(field, val_code); |
| 8877 | |
| 8878 | while (valid_p) { |
| 8879 | if (val_code == w_code) { |
| 8880 | // Ok, found the value we're look to delete Look over and create a new field appending all |
| 8881 | // elements that are not this value |
| 8882 | valid_p = iter.get_first_int(field, val_code); |
| 8883 | |
| 8884 | while (valid_p) { |
| 8885 | if (val_code != warning_code) { |
| 8886 | auto value = iter.get_current(); |
| 8887 | if (new_field) { |
| 8888 | new_field->value_append(to_warn->m_heap, to_warn->m_mime, value.data(), value.size(), true); |
| 8889 | } else { |
| 8890 | new_field = to_warn->field_create(); |
| 8891 | to_warn->field_value_set(new_field, value.data(), value.size()); |
| 8892 | } |
| 8893 | } |
| 8894 | valid_p = iter.get_next_int(val_code); |
| 8895 | } |
| 8896 | |
| 8897 | to_warn->field_delete(MIME_FIELD_WARNING, MIME_LEN_WARNING); |
| 8898 | if (new_field) { |
| 8899 | new_field->name_set(to_warn->m_heap, to_warn->m_mime, MIME_FIELD_WARNING, MIME_LEN_WARNING); |
| 8900 | to_warn->field_attach(new_field); |
| 8901 | } |
| 8902 | |
| 8903 | return; |
| 8904 | } |
| 8905 | valid_p = iter.get_next_int(val_code); |
| 8906 | } |
| 8907 | } |
| 8908 | } |
| 8909 | |
| 8910 | void |
| 8911 | HttpTransact::change_response_header_because_of_range_request(State *s, HTTPHdr *header) |
nothing calls this directly
no test coverage detected