2 * HTTP handling routines and related socket stuff for CNTLM
4 * CNTLM is free software; you can redistribute it and/or modify it under the
5 * terms of the GNU General Public License as published by the Free Software
6 * Foundation; either version 2 of the License, or (at your option) any later
9 * CNTLM is distributed in the hope that it will be useful, but WITHOUT ANY
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
16 * St, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Copyright (c) 2007 David Kubicek
31 * A couple of shortcuts for if statements
33 #define CONNECT(data) ((data) && (data)->req && !strcasecmp("CONNECT", (data)->method))
34 #define HEAD(data) ((data) && (data)->req && !strcasecmp("HEAD", (data)->method))
35 #define GET(data) ((data) && (data)->req && !strcasecmp("GET", (data)->method))
37 typedef long long int length_t
;
39 extern int is_http_header(const char *src
);
40 extern char *get_http_header_name(const char *src
);
41 extern char *get_http_header_value(const char *src
);
42 extern int http_parse_basic(hlist_t headers
, const char *header
, struct auth_s
*tcreds
);
43 extern int headers_recv(int fd
, rr_data_t data
);
44 extern int headers_send(int fd
, rr_data_t data
);
45 extern int tunnel(int cd
, int sd
);
46 extern length_t
http_has_body(rr_data_t request
, rr_data_t response
);
47 extern int http_body_send(int writefd
, int readfd
, rr_data_t request
, rr_data_t response
);
48 extern int http_body_drop(int fd
, rr_data_t response
);