richter 2003/01/01 23:39:44
Modified:.Changes.pod epcgiinit.c epdat2.h mod_embperl.c
eg/web base.epl
eg/web/db epwebapp.pl list.epl newpw.mail newuser.mail
updateditem.mail
xsbuilder/maps ep_structure.map
Log:
-> param -> server_addr + website updates
Revision ChangesPath
1.194 +1 -0 embperl/Changes.pod
Index: Changes.pod
===
RCS file: /home/cvs/embperl/Changes.pod,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -r1.193 -r1.194
--- Changes.pod 23 Dec 2002 20:47:35 - 1.193
+++ Changes.pod 2 Jan 2003 07:39:43 - 1.194
@@ -50,6 +50,7 @@
generated tags to contains a closing slash, so they are valid XML/XHTML.
- Fix make test to ignore different idention of newer versions of
libxslt.
+ - Added server_addr to the request param object.
=head1 2.0b8 (BETA) 25. Juni 2002
1.4 +35 -1 embperl/epcgiinit.c
Index: epcgiinit.c
===
RCS file: /home/cvs/embperl/epcgiinit.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- epcgiinit.c 26 Nov 2002 10:03:40 - 1.3
+++ epcgiinit.c 2 Jan 2003 07:39:44 - 1.4
@@ -268,6 +268,10 @@
tThreadData * pThread = pApp -> pThread ;
eptTHX_
char * p ;
+char buf[20] ;
+char * sHost ;
+intnPort ;
+char * scheme ;
pParam -> sFilename= GetHashValueStrDup (aTHX_ pPool, pThread -> pEnvHash,
"PATH_TRANSLATED", "") ;
pParam -> sUnparsedUri = GetHashValueStrDup (aTHX_ pPool, pThread -> pEnvHash,
"REQUEST_URI", "") ;
@@ -293,6 +297,36 @@
embperl_String2HV(pApp, p, ';', pHV) ;
}
+
+
+buf[0] = '\0' ;
+nPort = GetHashValueInt (aTHX_ pThread -> pEnvHash, "SERVER_PORT", 80) ;
+if (GetHashValueStr (aTHX_ pThread -> pEnvHash, "HTTPS", NULL))
+{
+ scheme = "https" ;
+ if (nPort != 443)
+ sprintf (buf, ":%d", nPort) ;
+ }
+else
+{
+ scheme = "http" ;
+ if (nPort != 80)
+ sprintf (buf, ":%d", nPort) ;
+ }
+
+if (!(sHost = GetHashValueStr (aTHX_ pThread -> pEnvHash, "HTTP_HOST", NULL)))
+ {
+sHost = GetHashValueStr (aTHX_ pThread -> pEnvHash, "SERVER_NAME", "") ;
+
+pParam -> sServerAddr = ep_pstrcat (pPool, scheme, "://",
+ sHost, buf, "//", NULL) ;
+ }
+else
+ {
+pParam -> sServerAddr = ep_pstrcat (pPool, scheme, "://",
+ sHost, "//", NULL) ;
+ }
+
return ok ;
}
1.4 +2 -1 embperl/epdat2.h
Index: epdat2.h
===
RCS file: /home/cvs/embperl/epdat2.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- epdat2.h 26 Nov 2002 10:03:40 - 1.3
+++ epdat2.h 2 Jan 2003 07:39:44 - 1.4
@@ -119,6 +119,7 @@
char * sFilename ;
char * sUnparsedUri ;
char * sUri ;
+char * sServerAddr ;/**< protocol://server:port */
char * sPathInfo ;
char * sQueryInfo ;
char * sLanguage ; /**< Language for the current request */
1.4 +25 -1 embperl/mod_embperl.c
Index: mod_embperl.c
===
RCS file: /home/cvs/embperl/mod_embperl.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mod_embperl.c 26 Nov 2002 10:03:42 - 1.3
+++ mod_embperl.c 2 Jan 2003 07:39:44 - 1.4
@@ -924,6 +924,9 @@
epaTHX_
char * p ;
struct addcookie s ;
+char buf[20] ;
+char * scheme ;
+
s.pApp = a ;
s.pParam = pParam ;
@@ -944,6 +947,27 @@
}
ap_table_do (embperl_AddCookie, &s, r -> headers_in, "Cookie", NULL) ;
+
+buf[0] = '\0' ;
+#ifdef EAPI
+if (ap_ctx_get (r -> connection -> client -> ctx, "ssl"))
+{
+ scheme = "https" ;
+ if (r -> server -> port != 443)
+ sprintf (buf, ":%d", r -> server -> port) ;
+ }
+else
+#endif
+{
+ scheme = "http" ;
+ if (r -> server -> port != 80)
+ sprintf (buf, ":%d", r -> server -> port) ;
+ }
+
+
+pParam -> sServerAddr = ep_pstrcat (pPool, scheme, "://",
+ r -> hostname?r -> hostname:r -> server -> server_hostname, buf,
"//", NULL) ;
+
return ok ;
}
1.4 +1 -0 embperl/eg/web/base.epl
Index: base.epl
=