From:             [EMAIL PROTECTED]
Operating system: Linux
PHP version:      4.1.0
PHP Bug Type:     Zlib Related
Bug description:  getallheaders() possible bug.

getallheaders is this :
PHP_FUNCTION(getallheaders)
{
    array_header *env_arr;
    table_entry *tenv;
    int i;
 
    if (array_init(return_value) == FAILURE) {
  RETURN_FALSE;
    }
    env_arr = table_elts(((request_rec *)
SG(server_context))->headers_in);
    tenv = (table_entry *)env_arr->elts;
    for (i = 0; i < env_arr->nelts; ++i) {
  if (!tenv[i].key ||
   (PG(safe_mode) &&
    !strncasecmp(tenv[i].key, "authorization", 13))) {
   continue;
  }
  if (add_assoc_string(return_value, tenv[i].key, (tenv[i].val==NULL) ? ""
: tenv[i].val, 1)==FAILURE) {
   RETURN_FALSE;
  }
    }
}
Using the example from the docs :
<?php
$headers = getallheaders();
while (list ($header, $value) = each ($headers)) {
    echo "$header: $value<br>\n";
}
var_dump($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING']);
?>
I receive this :
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-powerpoint, application/vnd.ms-excel,
application/msword, */*
Accept-Language: bg
Connection: Keep-Alive
Host: vanity.masq
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
NULL 

I thought that to get if the browser has capability of encoding it must be
in $HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING']. Why I decided that?
Snippet from zlib.c :
 if (ZLIBG(ob_gzhandler_status)==-1
  || zend_hash_find(&EG(symbol_table), "HTTP_SERVER_VARS",
sizeof("HTTP_SERVER_VARS"), (void **) &data)==FAILURE
  || Z_TYPE_PP(data)!=IS_ARRAY
  || zend_hash_find(Z_ARRVAL_PP(data), "HTTP_ACCEPT_ENCODING",
sizeof("HTTP_ACCEPT_ENCODING"), (void **) &a_encoding)==FAILURE) {
  /* return the original string */
  *return_value = **zv_string;
  zval_copy_ctor(return_value);
  ZLIBG(ob_gzhandler_status)=-1;
  return;
 }

The sniff from Naviscope :
GET http://myserver.masq/proxy/getall.php HTTP/1.1
Accept: */*
Accept-Language: bg
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
Host: vanity.masq
Proxy-Connection: Keep-Alive
Pragma: no-cache

Regards,
Andrey Hristov
-- 
Edit bug report at: http://bugs.php.net/?id=14362&edit=1


-- 
PHP Development 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]

Reply via email to