http_handler.h

来自「ace开发环境 用来开发网络程序 其运用了设计模式、多平台、C++等多种知识」· C头文件 代码 · 共 82 行

H
82
字号
/* -*- c++ -*- */// Hey, Emacs!  This is a C++ file.// $Id: http_handler.h 78853 2007-07-12 16:55:10Z johnnyw $// ============================================================================//// = LIBRARY//    apps/JAWS/clients/Caching//// = FILENAME//    http_handler.h//// = AUTHOR//    James Hu//// ============================================================================#include "ace/SOCK_Connector.h"#if !defined (ACE_LACKS_PRAGMA_ONCE)# pragma once#endif /* ACE_LACKS_PRAGMA_ONCE */#include "ace/Connector.h"#include "ace/Svc_Handler.h"class HTTP_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>  // = TITLE  //     A simple HTTP protocol handler for clients.  //  // = DESCRIPTION  //     Checks to see if the requested file is already cached.  If  //     so, it says so.  If not, the request is issued to the  //     connection.  The fetched file is cached.{public:  // = Initialization methods.  HTTP_Handler (void);  HTTP_Handler (const char * path);  virtual int open (void *);  // Open hook.  virtual int svc (void);  // Entry points defined by the abstract Svc_Handler.  const char *filename (void) const;  // Accessor to the file being fetched.private:  char request_[BUFSIZ];  size_t request_size_;  char filename_[BUFSIZ];  size_t response_size_;};class HTTP_Connector  // = TITLE  //     A simple HTTP connector.  //  // = DESCRIPTION  //     Creates an HTTP Handler based on the URL, and then delegates  //     to to the SOCK_CONNECTOR.  Adapter pattern.{public:  int connect (const char * url);  // User entry point into the HTTP connector.private:  int parseurl (const char *url,                char *host,                u_short *port,                char *path);  // Helper function.private:  ACE_Connector<HTTP_Handler, ACE_SOCK_CONNECTOR> connector_;  // Factory that actively establishes a connection with an HTTP  // server.};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?