Opened 9 years ago

Closed 9 years ago

#809 closed defect (worksforme)

http2 cookies not readable under php

Reported by: Gunter Grodotzki Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.9.x
Keywords: http2, cookies Cc:
uname -a: Linux XXXXXX 3.13.0-042stab092.3 #1 SMP Sun Jul 20 13:27:24 MSK 2014 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.9.5
built by gcc 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)
built with LibreSSL 2.3.0
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --without-select_module --without-poll_module --with-file-aio --with-ipv6 --with-pcre=../pcre-8.37 --with-pcre-jit --with-md5-asm --with-sha1-asm --with-zlib=../zlib-1.2.8 --with-zlib-asm=pentiumpro --with-openssl=../libressl-2.3.0 --with-ld-opt=-lrt --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_stub_status_module --without-http_ssi_module --without-http_userid_module --without-http_geo_module --without-http_split_clients_module --without-http_referer_module --without-http_uwsgi_module --without-http_scgi_module --without-http_memcached_module --without-http_empty_gif_module

Description

Very simple PHP script:

<?php
setcookie('foo', 'bar', 0, '/', $_SERVER['HTTP_HOST'], !empty($_SERVER['HTTPS']), true);
var_dump($_COOKIE);

Returns empty array under Google Chrome (http2) but works well under cURL (assuming http1.1?):

curl -i -b "foo=bar" https://speedcounter.net/cookie.php
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 09 Oct 2015 22:17:30 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: foo=bar; path=/; domain=speedcounter.net; secure; httponly
X-Server: www01.speedcounter.net
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
X-Frame-Options: DENY
X-Content-Type-Options: nosniff

array(1) {
  ["foo"]=>
  string(3) "bar"
}
>curl --version
curl 7.44.0 (unknown-pc-win32) libcurl/7.44.0 WinSSL zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL libz
Google Chrome: Version 46.0.2490.64 beta-m (64-bit)

Change History (3)

comment:1 by Valentin V. Bartenev, 9 years ago

Resolution: wontfix
Status: newclosed

I've tested and everything works fine over HTTP/2. Your browser probably doesn't accept cookies due to untrusted certificate.

comment:2 by Valentin V. Bartenev, 9 years ago

Resolution: wontfix
Status: closedreopened

comment:3 by Valentin V. Bartenev, 9 years ago

Resolution: worksforme
Status: reopenedclosed
Note: See TracTickets for help on using tickets.