joosters Tue Mar 27 08:29:45 2001 EDT Modified files: (Branch: PHP_4_0_5) /php4/sapi/fastcgi fastcgi.c Log: Changed header handling; before, we were somehow losing Content-Type: text/html Index: php4/sapi/fastcgi/fastcgi.c diff -u php4/sapi/fastcgi/fastcgi.c:1.1.2.1 php4/sapi/fastcgi/fastcgi.c:1.1.2.2 --- php4/sapi/fastcgi/fastcgi.c:1.1.2.1 Tue Mar 20 10:13:20 2001 +++ php4/sapi/fastcgi/fastcgi.c Tue Mar 27 08:29:45 2001 @@ -87,41 +87,15 @@ } -static int sapi_fastcgi_send_headers(sapi_headers_struct *sapi_headers SLS_DC) +static void sapi_fastcgi_send_header(sapi_header_struct *sapi_header, void +*server_context) { - char buf[1024]; - int n = 0; - zend_llist_position pos; - sapi_header_struct *h; - - switch( sapi_headers->http_response_code ) { - case 200: - /* Default, assumed by FastCGI */ - break; - case 302: - FCGX_PutS( "Status: 302 Moved Temporarily\r\n", out ); - break; - case 401: - FCGX_PutS( "Status: 401 Authorization Required\r\n", out ); - break; - default: - FCGX_FPrintF( out, "Status: %d Undescribed\r\\n", - sapi_headers->http_response_code ); - } - - h = zend_llist_get_first_ex(&sapi_headers->headers, &pos); - while (h) { - /* TODO: Buffer headers together into one big Put? */ + if( sapi_header ) { #ifdef DEBUG_FASTCGI - fprintf( stderr, "Printing header %s\n", h->header ); + fprintf( stderr, "Header: %s\n", sapi_header->header ); #endif - FCGX_PutStr( h->header, h->header_len, out ); - FCGX_PutStr( "\r\n", 2, out ); - h = zend_llist_get_next_ex(&sapi_headers->headers, &pos); + FCGX_PutStr( sapi_header->header, sapi_header->header_len, out ); } FCGX_PutStr( "\r\n", 2, out ); - - return SAPI_HEADER_SENT_SUCCESSFULLY; } static int sapi_fastcgi_read_post(char *buffer, uint count_bytes SLS_DC) @@ -182,8 +156,8 @@ php_error, NULL, - sapi_fastcgi_send_headers, NULL, + sapi_fastcgi_send_header, sapi_fastcgi_read_post, sapi_fastcgi_read_cookies, @@ -218,6 +192,7 @@ static void init_request_info( SLS_D ) { char *content_length = getenv("CONTENT_LENGTH"); + char *content_type = getenv( "CONTENT_TYPE" ); const char *auth; struct stat st; char *pi = getenv( "PATH_INFO" ); @@ -227,7 +202,7 @@ SG(request_info).request_method = getenv("REQUEST_METHOD"); SG(request_info).query_string = getenv("QUERY_STRING"); SG(request_info).request_uri = path_info; - SG(request_info).content_type = getenv("CONTENT_TYPE"); + SG(request_info).content_type = ( content_type ? content_type : "" ); SG(request_info).content_length = (content_length?atoi(content_length):0); SG(sapi_headers).http_response_code = 200; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]