+ The name is returned unchanged. If the input value has a 'name' attribute and it matches the name ignoring case, the value is returned unchanged. Otherwise the name and value are passed to header_factory method, and the resulting custom header object is returned a
(self, name, value)
| 135 | return (name, value.rstrip('\r\n')) |
| 136 | |
| 137 | def header_store_parse(self, name, value): |
| 138 | """+ |
| 139 | The name is returned unchanged. If the input value has a 'name' |
| 140 | attribute and it matches the name ignoring case, the value is returned |
| 141 | unchanged. Otherwise the name and value are passed to header_factory |
| 142 | method, and the resulting custom header object is returned as the |
| 143 | value. In this case a ValueError is raised if the input value contains |
| 144 | CR or LF characters. |
| 145 | |
| 146 | """ |
| 147 | validate_header_name(name) |
| 148 | if hasattr(value, 'name') and value.name.lower() == name.lower(): |
| 149 | return (name, value) |
| 150 | if isinstance(value, str) and len(value.splitlines())>1: |
| 151 | # XXX this error message isn't quite right when we use splitlines |
| 152 | # (see issue 22233), but I'm not sure what should happen here. |
| 153 | raise ValueError("Header values may not contain linefeed " |
| 154 | "or carriage return characters") |
| 155 | return (name, self.header_factory(name, value)) |
| 156 | |
| 157 | def header_fetch_parse(self, name, value): |
| 158 | """+ |
no test coverage detected