cvs: /php4 aolserver.c

From: Date: Sat, 25 Sep 1999 15:37:02 +0000
Subject: cvs: /php4 aolserver.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-4908@lists.php.net to get a copy of this message
sas Sat Sep 25 11:37:02 1999 EDT Modified files: /php4 aolserver.c Log: * remove debugging message * use SAPI's http response code * improve POST read (still blocks in Ns_ConnRead, even if there is enough data to read) * improve config data handling Index: php4/aolserver.c diff -u php4/aolserver.c:1.2 php4/aolserver.c:1.3 --- php4/aolserver.c:1.2 Fri Sep 24 21:06:33 1999 +++ php4/aolserver.c Sat Sep 25 11:37:02 1999 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: aolserver.c,v 1.2 1999/09/25 01:06:33 sas Exp $ */ +/* $Id: aolserver.c,v 1.3 1999/09/25 15:37:02 sas Exp $ */ #include "php.h" @@ -60,7 +60,6 @@ ctx = (php_aol_context *) SG(server_context); Ns_DStringInit(&dstr); - Ns_Log(Notice, "writing %d bytes\n", str_length); Ns_DStringNAppend(&dstr, (char *) str, str_length); Ns_ConnSendDString(ctx->conn, &dstr); Ns_DStringFree(&dstr); @@ -104,7 +103,7 @@ php_aol_context *ctx; ctx = (php_aol_context *) SG(server_context); - Ns_ConnFlushHeaders(ctx->conn, 200); + Ns_ConnFlushHeaders(ctx->conn, SG(sapi_headers).http_response_code); return SAPI_HEADER_SENT_SUCCESSFULLY; } @@ -114,7 +113,12 @@ uint total_read = 0; php_aol_context *ctx = (php_aol_context *) SG(server_context); - total_read = Ns_ConnRead(ctx->conn, buf, total_read); + total_read = Ns_ConnRead(ctx->conn, buf, count_bytes); + + if(total_read == NS_ERROR) { + total_read = -1; + } + return total_read; } @@ -239,21 +243,36 @@ int i; char *path; Ns_Set *set; - char *map; - path = Ns_ConfigPath(server, NULL, "php", NULL); - map = NULL; + path = Ns_ConfigPath(server, module, NULL); set = Ns_ConfigGetSection(path); for(i = 0; set && i < Ns_SetSize(set); i++) { - char *key = Ns_SetValue(set, i); + char *key = Ns_SetKey(set, i); + char *value = Ns_SetValue(set, i); if(!strcasecmp(key, "map")) { - map = Ns_SetValue(set, i); - Ns_RegisterRequest(server, "GET", map, request_handler, NULL, ctx, 0); - Ns_RegisterRequest(server, "POST", map, request_handler, NULL, ctx, 0); - Ns_RegisterRequest(server, "HEAD", map, request_handler, NULL, ctx, 0); + Ns_Log(Notice, "Registering PHP for \"%s\"", value); + Ns_RegisterRequest(server, "GET", value, request_handler, NULL, ctx, 0); + Ns_RegisterRequest(server, "POST", value, request_handler, NULL, ctx, 0); + Ns_RegisterRequest(server, "HEAD", value, request_handler, NULL, ctx, 0); + } else if(!strcasecmp(key, "php_value")) { + char *val; + + val = strchr(value, ' '); + if(val) { + char *key_end; + + key_end = val; + + do { + val++; + } while(*val == ' '); + + php_alter_ini_entry(key, key_end - key, val, strlen(val), PHP_INI_SYSTEM); + } } + } }

« previous php.version4 (#4908) next »