summaryrefslogtreecommitdiff
path: root/src/ne_basic.h
diff options
context:
space:
mode:
authorjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2004-12-30 11:55:13 +0000
committerjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2004-12-30 11:55:13 +0000
commit4bbd032fc525b0185c4bfe3f73395ab857e507e8 (patch)
tree9b0191b7f4e0b47888322184f0f9e4608d400ee2 /src/ne_basic.h
parent5313dc13b9ed83dc429edc0fcec68980254ac91b (diff)
downloadneon-4bbd032fc525b0185c4bfe3f73395ab857e507e8.tar.gz
Remove callback-based response header handling in favour of
ne_get_response_header interface: * src/ne_request.h (ne_get_response_header): New function, replacing ne_add_response_header_handler and ne_add_response_header_catcher. * src/ne_request.c (struct header_handler): Remove. (struct field): Add. (struct ne_request_s): Store a hash of header fields rather than a hash of callbacks. (te_hdr_handler, connection_hdr_handler, clength_hdr_handler, ne_add_response_header_catcher, ne_add_response_header_handler, ne_duplicate_header, ne_handle_numeric_header): Remove functions. (get_response_header_hv, ne_get_response_header, add_response_header, remove_response_header): New functions. (ne_request_create): Don't register the callbacks. (read_response_headers): Call add_response_header for each field. (ne_begin_request): Move handling of Connection, T-E and C-L headers here. Comply with 2616/14.10 w.r.t. Connection header handling in HTTP/1.0 responses. (ne_request_dispatch): Use ne_discard_response (unrelated). * src/ne_redirect.c (struct redirect): Remove location field. (post_send): Adjust to retrieve location header here. * src/ne_basic.h (ne_get_content_type): Replaces ne_content_type_handler. * src/ne_basic.c (dispatch_to_fd): New function. (get_to_fd, get_lastmodified, clength_hdr_handler, accept_206, content_range_hdr_handler): Remove functions. (ne_getmodtime): Adjust to use ne_get_response_header. (ne_get_range, ne_get, ne_post): Adjust to use dispatch_to_fd. (ne_get_content_type): Adjust for new API, use ne_get_response_header. (parse_dav_header, ne_options): Adjust to use ne_get_response_header. * src/ne_compress.c (struct ne_decompress_s): Add ne_request * field, remove enchdr field. (gz_reader): Retrieve C-E header on demand, here. (ne_decompress_reader, ne_decompress_destroy): Remove C-E response header duplication. * src/ne_auth.c (auth_request): Remove auth_hdr, auth_info_hdr fields. (ah_collect_header): Remove function. (ah_create, ah_destroy): Remove response-header callback handling. (ah_post_send): Retrieve -Authenticate header here; correctly handle the broken proxy which sends a 401 in response to CONNECT. * src/ne_locks.c (lk_startelm): Retrieve Lock-Token header here. (get_ltoken_hdr): Remove function. (ne_lock, ne_lock_refresh): Remove response-header handling. * test/basic.c (content_type): Test new interface. * test/request.c (expect_header_value): Adjust to accept NULL value, use ne_get_response_header interface. (multi_header): Test new ne_get_response_header multi-header handling. (multi_header2, strip_http10_connhdr, strip_http10_connhdr2): New tests. git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@367 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
Diffstat (limited to 'src/ne_basic.h')
-rw-r--r--src/ne_basic.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ne_basic.h b/src/ne_basic.h
index f9b5157..c8f5ac3 100644
--- a/src/ne_basic.h
+++ b/src/ne_basic.h
@@ -1,6 +1,6 @@
/*
HTTP/1.1 methods
- Copyright (C) 1999-2002, Joe Orton <joe@manyfish.co.uk>
+ Copyright (C) 1999-2004, Joe Orton <joe@manyfish.co.uk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -77,9 +77,11 @@ typedef struct {
char *value;
} ne_content_type;
-/* Sets (*ne_content_type)userdata appropriately.
- * Caller must free ->value after use */
-void ne_content_type_handler(void *userdata, const char *value);
+/* Retrieve the content-type of the response; returns zero if response
+ * had valid content-type, in which case *ctype is filled in and the
+ * caller must free 'value' after use. Returns non-zero on error, in
+ * which case *ctype is not altered. */
+int ne_get_content_type(ne_request *req, ne_content_type *ctype);
/* Server capabilities: */
typedef struct {