| 348 | */ |
| 349 | |
| 350 | void |
| 351 | httpClose(http_t *http) /* I - HTTP connection */ |
| 352 | { |
| 353 | http_field_t field; /* Current field */ |
| 354 | #ifdef HAVE_GSSAPI |
| 355 | OM_uint32 minor_status; /* Minor status code */ |
| 356 | #endif /* HAVE_GSSAPI */ |
| 357 | |
| 358 | |
| 359 | DEBUG_printf(("httpClose(http=%p)", (void *)http)); |
| 360 | |
| 361 | /* |
| 362 | * Range check input... |
| 363 | */ |
| 364 | |
| 365 | if (!http) |
| 366 | return; |
| 367 | |
| 368 | /* |
| 369 | * Close any open connection... |
| 370 | */ |
| 371 | |
| 372 | _httpDisconnect(http); |
| 373 | |
| 374 | /* |
| 375 | * Free memory used... |
| 376 | */ |
| 377 | |
| 378 | httpAddrFreeList(http->addrlist); |
| 379 | |
| 380 | if (http->cookie) |
| 381 | free(http->cookie); |
| 382 | |
| 383 | #ifdef HAVE_GSSAPI |
| 384 | if (http->gssctx != GSS_C_NO_CONTEXT) |
| 385 | gss_delete_sec_context(&minor_status, &http->gssctx, GSS_C_NO_BUFFER); |
| 386 | |
| 387 | if (http->gssname != GSS_C_NO_NAME) |
| 388 | gss_release_name(&minor_status, &http->gssname); |
| 389 | #endif /* HAVE_GSSAPI */ |
| 390 | |
| 391 | #ifdef HAVE_AUTHORIZATION_H |
| 392 | if (http->auth_ref) |
| 393 | AuthorizationFree(http->auth_ref, kAuthorizationFlagDefaults); |
| 394 | #endif /* HAVE_AUTHORIZATION_H */ |
| 395 | |
| 396 | for (field = HTTP_FIELD_ACCEPT_LANGUAGE; field < HTTP_FIELD_MAX; field ++) |
| 397 | { |
| 398 | free(http->default_fields[field]); |
| 399 | if (field >= HTTP_FIELD_ACCEPT_ENCODING || http->fields[field] != http->_fields[field]) |
| 400 | free(http->fields[field]); |
| 401 | } |
| 402 | |
| 403 | if (http->authstring && http->authstring != http->_authstring) |
| 404 | free(http->authstring); |
| 405 | |
| 406 | free(http); |
| 407 | } |