PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LTP GCOV extension - code coverage report
Current view: directory - var/php_gcov/PHP_HEAD/main - php_content_types.c
Test: PHP Code Coverage
Date: 2009-11-23 Instrumented lines: 20
Code covered: 100.0 % Executed lines: 20
Legend: not executed executed

       1                 : /*
       2                 :    +----------------------------------------------------------------------+
       3                 :    | PHP Version 6                                                        |
       4                 :    +----------------------------------------------------------------------+
       5                 :    | Copyright (c) 1997-2009 The PHP Group                                |
       6                 :    +----------------------------------------------------------------------+
       7                 :    | This source file is subject to version 3.01 of the PHP license,      |
       8                 :    | that is bundled with this package in the file LICENSE, and is        |
       9                 :    | available through the world-wide-web at the following url:           |
      10                 :    | http://www.php.net/license/3_01.txt                                  |
      11                 :    | If you did not receive a copy of the PHP license and are unable to   |
      12                 :    | obtain it through the world-wide-web, please send a note to          |
      13                 :    | license@php.net so we can mail you a copy immediately.               |
      14                 :    +----------------------------------------------------------------------+
      15                 :    | Author:                                                              |
      16                 :    +----------------------------------------------------------------------+
      17                 : */
      18                 : 
      19                 : /* $Id: php_content_types.c 279528 2009-04-28 22:59:07Z stas $ */
      20                 : 
      21                 : #include "php.h"
      22                 : #include "SAPI.h"
      23                 : #include "rfc1867.h"
      24                 : 
      25                 : #include "php_content_types.h"
      26                 : 
      27                 : /* {{{ php_post_entries[]
      28                 :  */
      29                 : static sapi_post_entry php_post_entries[] = {
      30                 :         { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_std_post_handler },
      31                 :         { MULTIPART_CONTENT_TYPE,    sizeof(MULTIPART_CONTENT_TYPE)-1,    NULL,                         rfc1867_post_handler },
      32                 :         { NULL, 0, NULL, NULL }
      33                 : };
      34                 : /* }}} */
      35                 : 
      36                 : /* {{{ SAPI_POST_READER_FUNC
      37                 :  */
      38                 : SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader)
      39             167 : {
      40                 :         char *data;
      41                 :         int length;
      42                 : 
      43                 :         /* $HTTP_RAW_POST_DATA registration */
      44             167 :         if (!strcmp(SG(request_info).request_method, "POST")) {
      45              58 :                 if (NULL == SG(request_info).post_entry) {
      46                 :                         /* no post handler registered, so we just swallow the data */
      47               1 :                         sapi_read_standard_form_data(TSRMLS_C);
      48                 :                 }
      49                 : 
      50                 :                 /* For unknown content types we create HTTP_RAW_POST_DATA even if always_populate_raw_post_data off,
      51                 :                  * this is in-effecient, but we need to keep doing it for BC reasons (for now) */
      52              58 :                 if ((PG(always_populate_raw_post_data) || NULL == SG(request_info).post_entry) && SG(request_info).post_data) {
      53               2 :                         length = SG(request_info).post_data_length;
      54               2 :                         data = estrndup(SG(request_info).post_data, length);
      55               2 :                         SET_VAR_ASCII_STRINGL("HTTP_RAW_POST_DATA", data, length);
      56                 :                 }
      57                 :         }
      58                 : 
      59                 :         /* for php://input stream:
      60                 :          some post handlers modify the content of request_info.post_data
      61                 :          so for now we need a copy for the php://input stream
      62                 :          in the long run post handlers should be changed to not touch
      63                 :          request_info.post_data for memory preservation reasons
      64                 :         */
      65             167 :         if (SG(request_info).post_data) {
      66              30 :                 SG(request_info).raw_post_data = estrndup(SG(request_info).post_data, SG(request_info).post_data_length);
      67              30 :                 SG(request_info).raw_post_data_length = SG(request_info).post_data_length;
      68                 :         }
      69             167 : }
      70                 : /* }}} */
      71                 : 
      72                 : /* {{{ php_startup_sapi_content_types
      73                 :  */
      74                 : int php_startup_sapi_content_types(TSRMLS_D)
      75           17007 : {
      76           17007 :         sapi_register_default_post_reader(php_default_post_reader);
      77           17007 :         sapi_register_treat_data(php_default_treat_data);
      78           17007 :         sapi_register_input_filter(php_default_input_filter, NULL);
      79           17007 :         return SUCCESS;
      80                 : }
      81                 : /* }}} */
      82                 : 
      83                 : /* {{{ php_setup_sapi_content_types
      84                 :  */
      85                 : int php_setup_sapi_content_types(TSRMLS_D)
      86           17007 : {
      87           17007 :         sapi_register_post_entries(php_post_entries TSRMLS_CC);
      88                 : 
      89           17007 :         return SUCCESS;
      90                 : }
      91                 : /* }}} */
      92                 : 
      93                 : /*
      94                 :  * Local variables:
      95                 :  * tab-width: 4
      96                 :  * c-basic-offset: 4
      97                 :  * End:
      98                 :  * vim600: sw=4 ts=4 fdm=marker
      99                 :  * vim<600: sw=4 ts=4
     100                 :  */

Generated by: LTP GCOV extension version 1.5

Generated at Mon, 23 Nov 2009 17:39:46 +0000 (33 hours ago)

Copyright © 2005-2009 The PHP Group
All rights reserved.