2 #include "HTTP_10_Request.h"
3 #include "ace/OS_NS_pwd.h"
8 JAWS_HTTP_10_Request::JAWS_HTTP_10_Request ()
13 JAWS_HTTP_10_Request::~JAWS_HTTP_10_Request ()
15 ACE_OS::free (this->path_
);
20 JAWS_HTTP_10_Request::method () const
22 return this->request_line ()->method_str ();
26 JAWS_HTTP_10_Request::uri () const
28 return this->request_line ()->url ();
32 JAWS_HTTP_10_Request::version () const
34 return this->request_line ()->version ();
38 JAWS_HTTP_10_Request::type () const
40 return this->request_line ()->method ();
44 JAWS_HTTP_10_Request::path () const
48 JAWS_HTTP_10_Request
*mutable_this
= (JAWS_HTTP_10_Request
*)this;
49 mutable_this
->path (this->uri ());
55 JAWS_HTTP_10_Request::set_status (int s
)
57 HTTP_Request::set_status (s
);
61 JAWS_HTTP_10_Request::path (const char *uri_string
)
63 char const *file_name
= uri_string
;
64 char buf
[MAXPATHLEN
+ 1];
67 if (file_name
== 0) return;
69 if (*file_name
== '/')
72 if (*file_name
== '~')
76 while (*++file_name
&& *file_name
!= '/')
82 ACE_OS::strcpy (buf
, ACE_OS::getenv ("HOME"));
85 #if !defined (ACE_WIN32) && !defined (VXWORKS)
87 struct passwd pw_struct
;
88 if (ACE_OS::getpwnam_r (buf
, &pw_struct
, pw_buf
, sizeof (pw_buf
))
91 ACE_OS::strcpy (buf
, pw_struct
.pw_dir
);
92 #endif /* NOT ACE_WIN32 AND NOT VXWORKS */
95 ACE_OS::strcat (buf
, "/");
97 ACE_OS::strcat (buf
, HTTP_Config::instance ()->user_dir ());
99 ACE_OS::strcat (buf
, ".www-docs");
101 ACE_OS::strcat (buf
, file_name
);
105 // With a starting '/' but no '~'
107 ACE_OS::strcat (buf
, HTTP_Config::instance ()->document_root ());
109 ACE_OS::strcat (buf
, ".");
111 ACE_OS::strcat (buf
, file_name
- 1);
116 this->path_
= ACE_OS::strdup (buf
);