if (cell->cdr ()) {
throw (uErrorWrongNumber);
} else {
- char* e = getenv (name);
-
- if (e) {
- ustring s (e);
- return newMNode_str (new ustring (fixUTF8 (omitCtrl (s))));
+ ustring e = getenvString (name);
+ if (e.length () > 0) {
+ return newMNode_str (new ustring (fixUTF8 (omitCtrl (e))));
} else {
return NULL;
}
if (matchAlNum (name.begin (), e) && name.length () < 128) {
name = ustring (CharConst ("HTTP_")).append (name);
- char* e = getenv (name.c_str ());
- if (e) {
- ustring s (e);
- return newMNode_str (new ustring (fixUTF8 (s)));
+ ustring e = getenvString (name.c_str ());
+ if (e.length () > 0) {
+ return newMNode_str (new ustring (fixUTF8 (omitCtrl (e))));
+ } else {
+ return NULL;
+ }
+ } else {
+ return NULL;
+ }
+}
+
+/*DOC:
+===get-ssl-env===
+ (get-ssl-env NAME) -> STRING
+
+*/
+//#AFUNC get-ssl-env ml_get_ssl_env
+MNode* ml_get_ssl_env (MNode* cell, MlEnv* mlenv) {
+ MNode* arg = cell->cdr ();
+ ustring name;
+ ustring::iterator b, e;
+
+ if (! arg)
+ throw (uErrorWrongNumber);
+ name = toUpper (eval_text1 (arg->car (), mlenv));
+ nextNode (arg);
+ if (arg)
+ throw (uErrorWrongNumber);
+
+ b = name.begin ();
+ e = name.end ();
+ for (; b != e; b ++) {
+ if (*b == '-') {
+ *b = '_';
+ }
+ }
+
+ if (matchAlNum (name.begin (), e) && name.length () < 128) {
+ name = ustring (CharConst ("SSL_")).append (name);
+ ustring e = getenvString (name.c_str ());
+ if (e.length () > 0) {
+ return newMNode_str (new ustring (fixUTF8 (omitCtrl (e))));
} else {
return NULL;
}
MNode* ml_ssl_client_s_dn (MNode* cell, MlEnv* mlenv);
MNode* ml_ssl_client_i_dn (MNode* cell, MlEnv* mlenv);
MNode* ml_get_http_header (MNode* cell, MlEnv* mlenv);
+MNode* ml_get_ssl_env (MNode* cell, MlEnv* mlenv);
MNode* ml_is_get_method (MNode* cell, MlEnv* mlenv);
MNode* ml_is_post_method (MNode* cell, MlEnv* mlenv);
MNode* ml_absolute_url (MNode* cell, MlEnv* mlenv);