3 //=============================================================================
9 //=============================================================================
12 #include "ace/SOCK_Connector.h"
14 #if !defined (ACE_LACKS_PRAGMA_ONCE)
16 #endif /* ACE_LACKS_PRAGMA_ONCE */
18 #include "ace/Connector.h"
19 #include "ace/Svc_Handler.h"
24 * @brief A simple HTTP protocol handler for clients.
26 * Checks to see if the requested file is already cached. If
27 * so, it says so. If not, the request is issued to the
28 * connection. The fetched file is cached.
30 class HTTP_Handler
: public ACE_Svc_Handler
<ACE_SOCK_STREAM
, ACE_NULL_SYNCH
>
34 HTTP_Handler (const char * path
);
37 virtual int open (void *);
39 /// Entry points defined by the abstract Svc_Handler.
42 /// Accessor to the file being fetched.
43 const char *filename () const;
46 char request_
[BUFSIZ
];
49 char filename_
[BUFSIZ
];
50 size_t response_size_
;
54 * @class HTTP_Connector
56 * @brief A simple HTTP connector.
58 * Creates an HTTP Handler based on the URL, and then delegates
59 * to to the SOCK_CONNECTOR. Adapter pattern.
64 /// User entry point into the HTTP connector.
65 int connect (const char * url
);
69 int parseurl (const char *url
,
75 /// Factory that actively establishes a connection with an HTTP
77 ACE_Connector
<HTTP_Handler
, ACE_SOCK_CONNECTOR
> connector_
;