~ubuntu-branches/ubuntu/breezy/ace/breezy

« back to all changes in this revision

Viewing changes to apps/JAWS2/HTTPU/parse_http_response.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad, Benjamin Montgomery, Adam Conrad
  • Date: 2005-09-18 22:51:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge) (0.1.2 woody)
  • Revision ID: james.westby@ubuntu.com-20050918225138-seav22q6fyylb536
Tags: 5.4.7-3ubuntu1
[ Benjamin Montgomery ]
* Added a patch for amd64 and powerpc that disables the compiler
  option -fvisibility-inlines-hidden

[ Adam Conrad ]
* Added DPATCH_OPTION_CPP=1 to debian/patches/00options to make
  Benjamin's above changes work correctly with dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// parse_http_response.cpp,v 1.2 2003/11/01 11:15:22 dhinton Exp
2
 
 
3
 
#include "HTTPU/parse_http_response.h"
4
 
#include "ace/OS_NS_string.h"
5
 
#include "ace/OS_NS_stdlib.h"
6
 
 
7
 
Parse_HTTP_Response::Parse_HTTP_Response (const char *response)
8
 
  : code_ (200),
9
 
    code_str_ (0),
10
 
    major_version_ (0),
11
 
    minor_version_ (9),
12
 
    version_ (0),
13
 
    response_ (0),
14
 
    error_ (0)
15
 
{
16
 
  if (response != 0)
17
 
    this->init (response);
18
 
}
19
 
 
20
 
Parse_HTTP_Response::~Parse_HTTP_Response (void)
21
 
{
22
 
  if (this->response_)
23
 
    ACE_OS::free (this->response_);
24
 
  this->response_ = 0;
25
 
  this->code_str_ = 0;
26
 
  this->version_ = 0;
27
 
}
28
 
 
29
 
void
30
 
Parse_HTTP_Response::init (const char *response)
31
 
{
32
 
  this->response_ = ACE_OS::strdup (response);
33
 
  if (this->response_ == 0)
34
 
    {
35
 
      this->error_ = NO_MEMORY;
36
 
      return;
37
 
    }
38
 
 
39
 
  int n = ::sscanf (this->response_, "HTTP/%d.%d %d %*s",
40
 
                    &(this->major_version_),
41
 
                    &(this->minor_version_),
42
 
                    &(this->code_));
43
 
 
44
 
  if (n == 3)
45
 
    {
46
 
      char *p = this->response_;
47
 
 
48
 
      while (*p == ' ' || *p == '\t')
49
 
        p++;
50
 
 
51
 
      this->version_ = p++;
52
 
 
53
 
      while (*p != ' ' && *p != '\t')
54
 
        p++;
55
 
 
56
 
      *p++ = '\0';
57
 
 
58
 
      while (*p == ' ' || *p == '\t')
59
 
        p++;
60
 
 
61
 
      this->code_str_ = p;
62
 
 
63
 
      while (*p && !ACE_OS::strchr (" \t\r\n", *p))
64
 
        p++;
65
 
 
66
 
      *p++ = '\0';
67
 
    }
68
 
  else
69
 
    this->error_ = BAD_RESPONSE;
70
 
}
71
 
 
72
 
#if !defined (ACE_HAS_INLINED_OSCALLS)
73
 
# include "HTTPU/parse_http_response.i"
74
 
#endif /* ACE_HAS_INLINED_OS_CALLS */