Changeset 5ebff60 for lib/http_client.h
- Timestamp:
- 2015-02-20T22:50:54Z (9 years ago)
- Branches:
- master
- Children:
- 0b9daac, 3d45471, 7733b8c
- Parents:
- af359b4
- git-author:
- Indent <please@…> (19-02-15 05:47:20)
- git-committer:
- dequis <dx@…> (20-02-15 22:50:54)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/http_client.h
raf359b4 r5ebff60 1 1 /********************************************************************\ 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * … … 28 28 response to come back. Initially written for MS Passport authentication, 29 29 but used for many other things now like OAuth and Twitter. 30 30 31 31 It's very useful for doing quick requests without blocking the whole 32 32 program. Unfortunately it doesn't support fancy stuff like HTTP keep- … … 38 38 struct http_request; 39 39 40 typedef enum http_client_flags 41 { 40 typedef enum http_client_flags { 42 41 HTTPC_STREAMING = 1, 43 42 HTTPC_EOF = 2, 44 43 HTTPC_CHUNKED = 4, 45 44 46 45 /* Let's reserve 0x1000000+ for lib users. */ 47 46 } http_client_flags_t; 48 47 49 48 /* Your callback function should look like this: */ 50 typedef void (*http_input_function)( struct http_request *);49 typedef void (*http_input_function)(struct http_request *); 51 50 52 51 /* This structure will be filled in by the http_dorequest* functions, and 53 52 it will be passed to the callback function. Use the data field to add 54 53 your own data. */ 55 struct http_request 56 { 54 struct http_request { 57 55 char *request; /* The request to send to the server. */ 58 56 int request_length; /* Its size. */ … … 65 63 short redir_ttl; /* You can set it to 0 if you don't want 66 64 http_client to follow them. */ 67 65 68 66 http_client_flags_t flags; 69 67 70 68 http_input_function func; 71 69 gpointer data; 72 70 73 71 /* Please don't touch the things down here, you shouldn't need them. */ 74 72 void *ssl; 75 73 int fd; 76 74 77 75 int inpa; 78 76 int bytes_written; 79 77 int bytes_read; 80 78 int content_length; /* "Content-Length:" header or -1 */ 81 79 82 80 /* Used in streaming mode. Caller should read from reply_body. */ 83 81 char *sbuf; 84 82 size_t sblen; 85 83 86 84 /* Chunked encoding only. Raw chunked stream is decoded from here. */ 87 85 char *cbuf; … … 93 91 you want to add some extra headers. As you can see, HTTPS connections 94 92 are also supported (using ssl_client). */ 95 struct http_request *http_dorequest( char *host, int port, int ssl, char *request, http_input_function func, gpointer data ); 96 struct http_request *http_dorequest_url( char *url_string, http_input_function func, gpointer data ); 93 struct http_request *http_dorequest(char *host, int port, int ssl, char *request, http_input_function func, 94 gpointer data); 95 struct http_request *http_dorequest_url(char *url_string, http_input_function func, gpointer data); 97 96 98 97 /* For streaming connections only; flushes len bytes at the start of the buffer. */ 99 void http_flush_bytes( struct http_request *req, size_t len);100 void http_close( struct http_request *req);98 void http_flush_bytes(struct http_request *req, size_t len); 99 void http_close(struct http_request *req);
Note: See TracChangeset
for help on using the changeset viewer.