From: Vlad S. <ser...@us...> - 2008-10-21 21:46:44
|
Update of /cvsroot/naviserver/modules/nsphp In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31899/modules/nsphp Modified Files: nsphp.c Log Message: new function, new module tftp, fixed module nsphp Index: nsphp.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsphp/nsphp.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** nsphp.c 7 Aug 2008 23:34:23 -0000 1.10 --- nsphp.c 21 Oct 2008 21:46:37 -0000 1.11 *************** *** 909,924 **** PHP_FUNCTION(nsv_get) { - char *aname, *key, *result; int alen, klen; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &aname, &alen, &key, &klen) == FAILURE) { RETURN_FALSE; } ! result = Ns_ConnNsvGet(aname, key); ! if (result != NULL) { ! char *value = estrdup(result); ! ns_free(result); RETURN_STRING(value, 0); } } --- 909,927 ---- PHP_FUNCTION(nsv_get) { int alen, klen; + char *aname, *key; + Ns_DString ds; + Ns_Conn *conn = Ns_GetConn(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &aname, &alen, &key, &klen) == FAILURE) { RETURN_FALSE; } ! Ns_DStringInit(&ds); ! if (Ns_VarGet(Ns_ConnServer(conn), aname, key, &ds) == NS_OK) { ! char *value = estrdup(ds.string); ! Ns_DStringFree(&ds); RETURN_STRING(value, 0); } + Ns_DStringFree(&ds); } *************** *** 927,935 **** char *aname, *key, *value; int alen, klen, vlen; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &aname, &alen, &key, &klen, &value, &vlen) == FAILURE) { RETURN_FALSE; } ! RETURN_LONG(Ns_ConnNsvSet(aname, key, value)); } --- 930,939 ---- char *aname, *key, *value; int alen, klen, vlen; + Ns_Conn *conn = Ns_GetConn(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &aname, &alen, &key, &klen, &value, &vlen) == FAILURE) { RETURN_FALSE; } ! RETURN_LONG(Ns_VarSet(Ns_ConnServer(conn), aname, key, value, -1)); } *************** *** 938,946 **** char *aname, *key; int alen, klen; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &aname, &alen, &key, &klen) == FAILURE) { RETURN_FALSE; } ! RETURN_LONG(Ns_ConnNsvExists(aname, key)); } --- 942,951 ---- char *aname, *key; int alen, klen; + Ns_Conn *conn = Ns_GetConn(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &aname, &alen, &key, &klen) == FAILURE) { RETURN_FALSE; } ! RETURN_LONG(Ns_VarExists(Ns_ConnServer(conn), aname, key)); } *************** *** 949,957 **** char *aname, *key; int alen, klen, count = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &aname, &alen, &key, &klen, &count) == FAILURE) { RETURN_FALSE; } ! RETURN_LONG(Ns_ConnNsvIncr( aname, key, count)); } --- 954,963 ---- char *aname, *key; int alen, klen, count = 1; + Ns_Conn *conn = Ns_GetConn(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &aname, &alen, &key, &klen, &count) == FAILURE) { RETURN_FALSE; } ! RETURN_LONG(Ns_VarIncr(Ns_ConnServer(conn), aname, key, count)); } *************** *** 960,968 **** char *aname, *key = NULL; int alen, klen; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &aname, &alen, &key, &klen) == FAILURE) { RETURN_FALSE; } ! RETURN_LONG(Ns_ConnNsvUnset(aname, key)); } --- 966,975 ---- char *aname, *key = NULL; int alen, klen; + Ns_Conn *conn = Ns_GetConn(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &aname, &alen, &key, &klen) == FAILURE) { RETURN_FALSE; } ! RETURN_LONG(Ns_VarUnset(Ns_ConnServer(conn), aname, key)); } *************** *** 971,979 **** char *aname, *key, *value; int alen, klen, vlen; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &aname, &alen, &key, &klen, &value, &vlen) == FAILURE) { RETURN_FALSE; } ! RETURN_LONG(Ns_ConnNsvAppend(aname, key, value, NULL)); } --- 978,987 ---- char *aname, *key, *value; int alen, klen, vlen; + Ns_Conn *conn = Ns_GetConn(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &aname, &alen, &key, &klen, &value, &vlen) == FAILURE) { RETURN_FALSE; } ! RETURN_LONG(Ns_VarAppend(Ns_ConnServer(conn), aname, key, value, -1)); } *************** *** 995,1001 **** } ! if (Ns_ConnWriteData(ctx->conn, (void *) str, str_length, 0) != NS_OK) { php_handle_aborted_connection(); } return str_length; } --- 1003,1010 ---- } ! if (Ns_ConnWriteData(ctx->conn, (void *) str, str_length, NS_CONN_STREAM) != NS_OK) { php_handle_aborted_connection(); } + return str_length; } *************** *** 1043,1048 **** ctype = "text/html"; } ! Ns_ConnSetRequiredHeaders(ctx->conn, ctype, -1); ! Ns_ConnFlushHeaders(ctx->conn, SG(sapi_headers).http_response_code); return SAPI_HEADER_SENT_SUCCESSFULLY; } --- 1052,1057 ---- ctype = "text/html"; } ! Ns_ConnSetResponseStatus(ctx->conn, SG(sapi_headers).http_response_code); ! return SAPI_HEADER_SENT_SUCCESSFULLY; } |