OSDN Git Service

implement the form variable processing of delete method.
authorvisor <visor@users.sourceforge.jp>
Wed, 27 Nov 2013 15:05:37 +0000 (00:05 +0900)
committervisor <visor@users.sourceforge.jp>
Wed, 27 Nov 2013 15:05:37 +0000 (00:05 +0900)
to-symbol function.

lib/form.cc
lib/form.h
lib/httpconst.h
lib/motorenv.cc
modules/ml-string.cc
modules/ml-string.h

index 66dd297..4ecb562 100644 (file)
@@ -78,8 +78,16 @@ CGIForm::method_type  CGIForm::methodType () {
        return M_NONE;
     else if (match (requestMethod, CharConst (kMETHOD_GET)))
        return M_GET;
+    else if (match (requestMethod, CharConst (kMETHOD_HEAD)))
+       return M_HEAD;
     else if (match (requestMethod, CharConst (kMETHOD_POST)))
        return M_POST;
+    else if (match (requestMethod, CharConst (kMETHOD_OPTIONS)))
+       return M_OPTIONS;
+    else if (match (requestMethod, CharConst (kMETHOD_PUT)))
+       return M_PUT;
+    else if (match (requestMethod, CharConst (kMETHOD_DELETE)))
+       return M_DELETE;
     else
        return M_OTHER;
 }
index 0f6e39e..3f08a94 100644 (file)
@@ -16,7 +16,11 @@ class  CGIForm {
     typedef enum {
        M_NONE,
        M_GET,
+       M_HEAD,
        M_POST,
+       M_OPTIONS,
+       M_PUT,
+       M_DELETE,
        M_OTHER,
     }  method_type;
     typedef enum {
index f4076d0..9f3c6f4 100644 (file)
 #define kSSL_SERVER_V_START    "SSL_SERVER_V_START"
 #define kSSL_SESSION_ID                "SSL_SESSION_ID"
 #define kMETHOD_GET            "GET"
+#define kMETHOD_HEAD           "HEAD"
 #define kMETHOD_POST           "POST"
+#define kMETHOD_OPTIONS                "OPTIONS"
+#define kMETHOD_PUT            "PUT"
+#define kMETHOD_DELETE         "DELETE"
 #define kMIME_FORMDATA         "multipart/form-data"
 #define kMIME_HTML             "text/html"
 #define kMIME_TEXT             "text/plain"
index 7f41528..620cbc5 100644 (file)
@@ -360,6 +360,7 @@ void  MotorEnv::readFormVar () {
     } else {
        switch (form->method) {
        case CGIForm::M_GET:
+       case CGIForm::M_DELETE:
            form->read_get ();
            break;
        case CGIForm::M_POST:
index 815624b..ed00ff3 100644 (file)
@@ -988,6 +988,36 @@ MNode*  ml_to_string (MNode* cell, MlEnv* mlenv) {
 }
 
 /*DOC:
+===to-symbol===
+ (to-symbol STRING) -> SYMBOL
+
+*/
+//#AFUNC       to-symbol       ml_to_symbol
+//#WIKIFUNC    to-symbol
+MNode*  ml_to_symbol (MNode* cell, MlEnv* mlenv) {
+    MNode*  arg = cell->cdr ();
+    MNodePtr  text;
+
+    if (! arg)
+       throw (uErrorWrongNumber);
+    text = eval (arg->car (), mlenv);
+    nextNode (arg);
+    if (arg)
+       throw (uErrorWrongNumber);
+
+    if (text ()) {
+       if (text ()->isSym ()) {
+           return text.release ();
+       } else {
+           return newMNode_sym (new ustring (text ()->to_string ()));
+       }
+    } else {
+       return NULL;
+    }
+//    return newMNode_str (new ustring (text));
+}
+
+/*DOC:
 ===dump-to-sexp===
  (dump-to-sexp OBJECT...) -> STRING
 
index 9e68ee3..6ab0792 100644 (file)
@@ -35,6 +35,7 @@ MNode*  ml_date_format (MNode* cell, MlEnv* mlenv);
 MNode*  ml_gmdate_format (MNode* cell, MlEnv* mlenv);
 MNode*  ml_random_key (MNode* cell, MlEnv* mlenv);
 MNode*  ml_to_string (MNode* cell, MlEnv* mlenv);
+MNode*  ml_to_symbol (MNode* cell, MlEnv* mlenv);
 MNode*  ml_dump_to_sexp (MNode* cell, MlEnv* mlenv);
 //MNode*  ml_to_sexp (MNode* cell, MlEnv* mlenv);
 MNode*  ml_read_sexp (MNode* cell, MlEnv* mlenv);