⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 http_client.cpp

📁 ACE源码
💻 CPP
字号:
// http_client.cpp,v 1.5 2001/12/08 14:49:31 schmidt Exp

// ============================================================================
//
// = LIBRARY
//    apps/JAWS/clients/Caching
// 
// = FILENAME
//    http_client.cpp
//
// = DESCRIPTION
//    This is a very simple client.  It accepts URLs from a prompt, and
//    will try to fetch them.  Also accepts shell escapes.
//
// = AUTHOR
//    James Hu
// 
// ============================================================================

#include "http_handler.h"

ACE_RCSID(Caching, http_client, "http_client.cpp,v 1.5 2001/12/08 14:49:31 schmidt Exp")

int
main (int, char *[])
{
  // Present a command line.
  // * Accept a URL.
  //     Pass it to the HTTP_Connector.
  //     Connect.
  //     Report status.
  // * Accept shell escape character.

  char buf[BUFSIZ];

  ACE_DEBUG ((LM_DEBUG, "* "));

  while (ACE_OS::fgets (buf, sizeof (buf), stdin) != NULL)
    {
      char *s = buf;

      // get rid of trailing '\n'
      int len = ACE_OS::strlen (s);

      if (len > 0 && s[len - 1] == '\n')
        s[len - 1] = 0;

      while (isspace (*s))
        s++;

      if (*s == '!')
        {
          do 
	    s++; 
	  while (isspace (*s));

          // Shell command.
          if (ACE_OS::system (s) == -1)
            ACE_ERROR ((LM_ERROR, " ! Error executing: %s\n", s));
        }
      else if (ACE_OS::strncmp (s, "http://", 7) == 0)
        {
          // URL
          HTTP_Connector connector;
          connector.connect (s);
        }
      else
        ACE_ERROR ((LM_ERROR, " ? I don't understand: %s\n", s));

      ACE_ERROR ((LM_ERROR, "* "));
    }

  ACE_DEBUG ((LM_DEBUG, "\nBye!\n"));

  return 0;
}

⌨️ 快捷键说明

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