--- /php/php5-org/ext/standard/head.c 2005-06-23 22:54:12.000000000 +0200 +++ head.c 2005-06-23 23:27:53.000000000 +0200 @@ -59,7 +59,7 @@ } -PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure, int url_encode TSRMLS_DC) +PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure, int httponly, int url_encode TSRMLS_DC) { char *cookie, *encoded_value = NULL; int len=sizeof("Set-Cookie: "); @@ -131,6 +131,9 @@ if (secure) { strcat(cookie, "; secure"); } + if (httponly) { + strcat(cookie, "; httponly"); + } ctr.line = cookie; ctr.line_len = strlen(cookie); @@ -141,23 +144,23 @@ } -/* php_set_cookie(name, value, expires, path, domain, secure) */ -/* {{{ proto bool setcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure]]]]]) +/* php_set_cookie(name, value, expires, path, domain, secure, httponly) */ +/* {{{ proto bool setcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure [, bool httponly]]]]]]) Send a cookie */ PHP_FUNCTION(setcookie) { char *name, *value = NULL, *path = NULL, *domain = NULL; long expires = 0; - zend_bool secure = 0; + zend_bool secure = 0, httponly = 0; int name_len, value_len, path_len, domain_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssb", &name, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, &name_len, &value, &value_len, &expires, &path, - &path_len, &domain, &domain_len, &secure) == FAILURE) { + &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) { return; } - if (php_setcookie(name, name_len, value, value_len, expires, path, path_len, domain, domain_len, secure, 1 TSRMLS_CC) == SUCCESS) { + if (php_setcookie(name, name_len, value, value_len, expires, path, path_len, domain, domain_len, secure, httponly, 1 TSRMLS_CC) == SUCCESS) { RETVAL_TRUE; } else { RETVAL_FALSE; @@ -165,22 +168,22 @@ } /* }}} */ -/* {{{ proto bool setrawcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure]]]]]) +/* {{{ proto bool setrawcookie(string name [, string value [, int expires [, string path [, string domain [, bool secure [, bool httponly]]]]]]) Send a cookie with no url encoding of the value */ PHP_FUNCTION(setrawcookie) { char *name, *value = NULL, *path = NULL, *domain = NULL; long expires = 0; - zend_bool secure = 0; + zend_bool secure = 0, httponly=0; int name_len, value_len, path_len, domain_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssb", &name, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, &name_len, &value, &value_len, &expires, &path, - &path_len, &domain, &domain_len, &secure) == FAILURE) { + &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) { return; } - if (php_setcookie(name, name_len, value, value_len, expires, path, path_len, domain, domain_len, secure, 0 TSRMLS_CC) == SUCCESS) { + if (php_setcookie(name, name_len, value, value_len, expires, path, path_len, domain, domain_len, secure, httponly, 0 TSRMLS_CC) == SUCCESS) { RETVAL_TRUE; } else { RETVAL_FALSE;