~ubuntu-branches/ubuntu/dapper/gnupg2/dapper

« back to all changes in this revision

Viewing changes to include/http.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Mueller
  • Date: 2005-03-29 10:30:32 UTC
  • Revision ID: james.westby@ubuntu.com-20050329103032-sj42n2ain3ipx310
Tags: upstream-1.9.15
ImportĀ upstreamĀ versionĀ 1.9.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* http.h  -  HTTP protocol handler
 
2
 *      Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
 
3
 *
 
4
 * This file is part of GnuPG.
 
5
 *
 
6
 * GnuPG is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * GnuPG is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
19
 */
 
20
#ifndef G10_HTTP_H
 
21
#define G10_HTTP_H 1
 
22
 
 
23
#include "iobuf.h"
 
24
 
 
25
struct uri_tuple {
 
26
    struct uri_tuple *next;
 
27
    const char *name;   /* a pointer into name */
 
28
    char  *value;       /* a pointer to value (a Nul is always appended) */
 
29
    size_t valuelen;    /* and the real length of the value */
 
30
                        /* because the value may contain embedded Nuls */
 
31
};
 
32
typedef struct uri_tuple *URI_TUPLE;
 
33
 
 
34
struct parsed_uri {
 
35
    /* all these pointers point into buffer; most stuff is not escaped */
 
36
    char *scheme;       /* pointer to the scheme string (lowercase) */
 
37
    char *host;         /* host (converted to lowercase) */
 
38
    ushort port;        /* port (always set if the host is set) */
 
39
    char *path;         /* the path */
 
40
    URI_TUPLE params;   /* ";xxxxx" */
 
41
    URI_TUPLE query;    /* "?xxx=yyy" */
 
42
    char buffer[1];     /* buffer which holds a (modified) copy of the URI */
 
43
};
 
44
typedef struct parsed_uri *PARSED_URI;
 
45
 
 
46
typedef enum {
 
47
    HTTP_REQ_GET  = 1,
 
48
    HTTP_REQ_HEAD = 2,
 
49
    HTTP_REQ_POST = 3
 
50
} HTTP_REQ_TYPE;
 
51
 
 
52
enum {  /* put flag values into an enum, so that gdb can display them */
 
53
    HTTP_FLAG_TRY_PROXY = 1,
 
54
    HTTP_FLAG_NO_SHUTDOWN = 2,
 
55
    HTTP_FLAG_TRY_SRV = 3
 
56
};
 
57
 
 
58
struct http_context {
 
59
    int initialized;
 
60
    unsigned int status_code;
 
61
    int sock;
 
62
    int in_data;
 
63
    IOBUF fp_read;
 
64
    IOBUF fp_write;
 
65
    int is_http_0_9;
 
66
    PARSED_URI uri;
 
67
    HTTP_REQ_TYPE req_type;
 
68
    byte *buffer;          /* line buffer */
 
69
    unsigned buffer_size;
 
70
    unsigned int flags;
 
71
};
 
72
typedef struct http_context *HTTP_HD;
 
73
 
 
74
int http_open( HTTP_HD hd, HTTP_REQ_TYPE reqtype, const char *url,
 
75
                                                  unsigned int flags );
 
76
void http_start_data( HTTP_HD hd );
 
77
int  http_wait_response( HTTP_HD hd, unsigned int *ret_status );
 
78
void http_close( HTTP_HD hd );
 
79
 
 
80
int http_open_document( HTTP_HD hd, const char *document, unsigned int flags );
 
81
 
 
82
#endif /*G10_HTTP_H*/