source: trunk/third/libghttp/http_resp.h @ 15592

Revision 15592, 2.5 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r15591, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * http_resp.h -- routines for reading http responses
3 * Created: Christopher Blizzard <blizzard@appliedtheory.com> 9-Aug-1998
4 *
5 * Copyright (C) 1998 Free Software Foundation
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#ifndef HTTP_RESP_H
23#define HTTP_RESP_H
24
25#include "http_hdrs.h"
26#include "http_trans.h"
27#include "http_req.h"
28
29#define HTTP_RESP_INFORMATIONAL(x) (x >=100 && < 200)
30#define HTTP_RESP_SUCCESS(x) (x >= 200 && x < 300)
31#define HTTP_RESP_REDIR(x) (x >= 300 && x < 400)
32#define HTTP_RESP_CLIENT_ERR(x) (x >= 400 && x < 500)
33#define HTTP_RESP_SERVER_ERR(x) (x >= 500 && x < 600)
34
35typedef enum http_resp_header_state_tag
36{
37  http_resp_header_start = 0,
38  http_resp_reading_header
39} http_resp_header_state;
40
41typedef enum http_resp_body_state_tag
42{
43  http_resp_body_start = 0,
44  http_resp_body_read_content_length,
45  http_resp_body_read_chunked,
46  http_resp_body_read_standard
47} http_resp_body_state;
48
49
50
51typedef struct http_resp_tag
52{
53  float                                http_ver;
54  int                                  status_code;
55  char                                *reason_phrase;
56  http_hdr_list                       *headers;
57  char                                *body;
58  int                                  body_len;
59  int                                  content_length;
60  int                                  flushed_length;
61  http_resp_header_state               header_state;
62  http_resp_body_state                 body_state;
63} http_resp;
64
65http_resp *
66http_resp_new(void);
67
68void
69http_resp_destroy(http_resp *a_resp);
70
71int
72http_resp_read_body(http_resp *a_resp,
73                    http_req *a_req,
74                    http_trans_conn *a_conn);
75
76int
77http_resp_read_headers(http_resp *a_resp, http_trans_conn *a_conn);
78
79void
80http_resp_flush(http_resp *a_resp,
81                http_trans_conn *a_conn);
82
83#endif /* HTTP_RESP_H */
Note: See TracBrowser for help on using the repository browser.