acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
solaris_http_lib.h
1/*
2 * Http put/get mini lib
3 * written by L. Demailly
4 * (c) 1998 Laurent Demailly - http://www.demailly.com/~dl/
5 * (c) 1996 Observatoire de Paris - Meudon - France
6 * see LICENSE for terms, conditions and DISCLAIMER OF ALL WARRANTIES
7 *
8 * $Id: http_lib.h,v 1.4 1998/09/23 06:14:15 dl Exp $
9 *
10 */
11
12#pragma once
13
14/* declarations */
15
16
17
18class CLASS_DECL_ACME tiny_http
19{
20public:
21
22 typedef enum
23 {
24 /* Client side errors */
25 ERRHOST=-1, /* No such host */
26 ERRSOCK=-2, /* Can't create socket */
27 ERRCONN=-3, /* Can't connect to host */
28 ERRWRHD=-4, /* Write error on socket while writing header */
29 ERRWRDT=-5, /* Write error on socket while writing data */
30 ERRRDHD=-6, /* Read error on socket while reading result */
31 ERRPAHD=-7, /* Invalid answer from data server */
32 ERRNULL=-8, /* Null data pointer */
33 ERRNOLG=-9, /* No/Bad length in header */
34 ERRMEM=-10, /* Can't allocate memory */
35 ERRRDDT=-11,/* Read error while reading data */
36 ERRURLH=-12,/* Invalid url - must start with 'http://' */
37 ERRURLP=-13,/* Invalid port in url */
38
39
40 /* Return code by the server */
41 ERR400=400, /* Invalid query */
42 ERR403=403, /* Forbidden */
43 ERR408=408, /* Request timeout */
44 ERR500=500, /* Server error */
45 ERR501=501, /* Not implemented */
46 ERR503=503, /* Service overloaded */
47
48 /* Succesful results */
49 OK0 = 0, /* successfull parse */
50 OK201=201, /* Ressource succesfully created */
51 OK200=200 /* Ressource succesfully read */
52 } http_retcode;
53
54 typedef enum
55 {
56 CLOSE, /* Close the socket after the query (for put) */
57 KEEP_OPEN /* Keep it open */
58 } querymode;
59
60
61
62 string m_strHttpServer;
63 ::i32 m_iHttpPort;
64 string m_strProxyServer;
65 ::i32 m_iHttpProxyPort;
66 string m_strUserAgent;
67 ::file::path m_strFileName;
68
69 string m_strContentType;
70
71 tiny_http();
72 ~tiny_http();
73
74 http_retcode t_put(const_char_pointer data, ::i32 length, ::i32 overwrite, void (*callback)(void *, ::i32, dword_ptr) = nullptr, void * callback_param = nullptr);
75 http_retcode t_get(char_pointer * pdata, ::i32 * plength, void (*callback)(void *, ::i32, dword_ptr) = nullptr, void * callback_param = nullptr);
76 http_retcode t_delete() ;
77 http_retcode t_head(::i32 *plength);
78 http_retcode t_parse_url(const_char_pointer url);
79
80 ::i32 t_read_line (::i32 fd,char_pointer buffer, ::i32 maximum) ;
81 ::i32 t_read_buffer (::i32 fd,char_pointer buffer, ::i32 maximum, void (*callback)(void *, ::i32, dword_ptr) = nullptr, void * callback_param = nullptr) ;
82
83 http_retcode t_query(const_char_pointer command, const_char_pointer url, const_char_pointer additional_header, querymode mode, char_pointer data, ::i32 length, ::i32 *pfd);
84};
85
86
Definition path.h:52