1 #include "JAWS/Headers.h"
2 #include "ace/OS_NS_stdlib.h"
3 #include "ace/OS_NS_strings.h"
4 #include "ace/OS_NS_string.h"
8 JAWS_Header_Data::JAWS_Header_Data (const char *name
, const char *value
,
10 : header_name_ (name
? ACE_OS::strdup (name
) : 0),
11 header_value_ (value
? ACE_OS::strdup (value
) : 0),
16 JAWS_Header_Data::JAWS_Header_Data (const char *name
, int type
,
18 : header_name_ (name
? ACE_OS::strdup (name
) : 0),
19 header_value_ (value
? ACE_OS::strdup (value
) : 0),
24 JAWS_Header_Data::~JAWS_Header_Data ()
26 if ( this->header_name_
)
27 ACE_OS::free ((void *)this->header_name_
);
28 if ( this->header_value_
)
29 ACE_OS::free ((void *)this->header_value_
);
30 this->header_name_
= 0;
31 this->header_value_
= 0;
35 JAWS_Header_Data::header_name () const
37 return this->header_name_
;
41 JAWS_Header_Data::header_value () const
43 return this->header_value_
;
47 JAWS_Header_Data::header_type () const
49 return this->header_type_
;
53 JAWS_Header_Data::header_name (const char *name
)
55 if (this->header_name_
)
56 ACE_OS::free ((void *)this->header_name_
);
57 this->header_name_
= name
? ACE_OS::strdup (name
) : 0;
61 JAWS_Header_Data::header_value (const char *value
)
63 if (this->header_value_
)
64 ACE_OS::free ((void *)this->header_value_
);
65 this->header_value_
= value
? ACE_OS::strdup (value
) : 0;
69 JAWS_Header_Data::header_type (int type
)
71 this->header_type_
= type
;
77 JAWS_Headers::JAWS_Headers ()
82 JAWS_Headers::~JAWS_Headers ()
86 JAWS_Header_Table_Iterator
&
93 JAWS_Headers::insert (JAWS_Header_Data
*new_data
)
95 // Since there may be duplicate header entries, we don't worry about
96 // doing this find anymore. Make the application developer figure
97 // out how to interpret duplicate entries.
99 return (JAWS_Header_Table::insert_tail (new_data
) ? 0 : -1);
103 JAWS_Headers::find (const char *const &header_name
)
105 this->iter_
.first ();
106 return this->find_next (header_name
);
110 JAWS_Headers::find_next (const char *const &header_name
)
112 JAWS_Header_Data
*data
= 0;
113 JAWS_Header_Table_Iterator
&i
= this->iter_
;
120 if (ACE_OS::strcasecmp (data
->header_name (), header_name
) != 0)
132 JAWS_Headers::remove_all (const char *const &header_name
)
134 JAWS_Header_Data
*data
;
139 JAWS_Header_Table_Iterator
i (*this);
146 && ACE_OS::strcasecmp (data
->header_name (), header_name
) == 0)