| 299 | */ |
| 300 | |
| 301 | void |
| 302 | httpClearFields(http_t *http) /* I - HTTP connection */ |
| 303 | { |
| 304 | http_field_t field; /* Current field */ |
| 305 | |
| 306 | |
| 307 | DEBUG_printf(("httpClearFields(http=%p)", (void *)http)); |
| 308 | |
| 309 | if (http) |
| 310 | { |
| 311 | memset(http->_fields, 0, sizeof(http->_fields)); |
| 312 | |
| 313 | for (field = HTTP_FIELD_ACCEPT_LANGUAGE; field < HTTP_FIELD_ACCEPT_ENCODING; field ++) |
| 314 | { |
| 315 | if (!http->fields[field]) |
| 316 | continue; |
| 317 | |
| 318 | if (http->fields[field] != http->_fields[field]) |
| 319 | free(http->fields[field]); |
| 320 | |
| 321 | http->fields[field] = NULL; |
| 322 | } |
| 323 | |
| 324 | for (; field < HTTP_FIELD_MAX; field ++) |
| 325 | { |
| 326 | if (!http->fields[field]) |
| 327 | continue; |
| 328 | |
| 329 | free(http->fields[field]); |
| 330 | http->fields[field] = NULL; |
| 331 | } |
| 332 | |
| 333 | if (http->mode == _HTTP_MODE_CLIENT) |
| 334 | { |
| 335 | if (http->hostname[0] == '/') |
| 336 | httpSetField(http, HTTP_FIELD_HOST, "localhost"); |
| 337 | else |
| 338 | httpSetField(http, HTTP_FIELD_HOST, http->hostname); |
| 339 | } |
| 340 | |
| 341 | http->expect = (http_status_t)0; |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | |
| 346 | /* |