Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.10] Http 2 Server does not support streaming #75

Closed
Nek- opened this issue Nov 23, 2021 · 4 comments
Closed

[4.10] Http 2 Server does not support streaming #75

Nek- opened this issue Nov 23, 2021 · 4 comments

Comments

@Nek-
Copy link

Nek- commented Nov 23, 2021

Hello! Thanks for your work on swoole. I just tried it to make what I would hope a powerfull http/2 sse server but it didn't work at all. The reason is that it seems to be impossible to stream responses with swoole. Too bad!

  1. What did you do? If possible, provide a simple script for reproducing the error.

I tried to stream a response by using the method Response::write().

  1. What did you expect to see?

Response streamed to user. No warning from swoole.

  1. What did you see instead?
Warning: Swoole\Http\Response::write(): HTTP2 client does not support HTTP-CHUNK in /.../router/vendor/hhxsv5/php-sse/src/SSESwoole.php on line 29
  1. What version of Open Swoole are you using (show your php --ri openswoole)?

4.7.2

  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?
$ php -v
PHP 8.0.10 (cli) (built: Aug 26 2021 15:50:07) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.10, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.10, Copyright (c), by Zend Technologies
    with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
  1. Location of the issue inside swoole codebase

https://github.com/openswoole/swoole-src/blob/8a581f572e6869e28bdf308d5640643ea6846172/ext-src/swoole_http_response.cc#L240-L245

@doubaokun
Copy link
Contributor

According to RFC: https://greenbytes.de/tech/webdav/rfc7540.html#rfc.section.8.1.p.4

HTTP/2 uses DATA frames to carry message payloads. The chunked transfer encoding defined in Section 4.1 of [RFC7230] MUST NOT be used in HTTP/2.

The error message is updated to be more clear.

@Nek-
Copy link
Author

Nek- commented Jan 14, 2022

@doubaokun does this means there's a way to stream responses with HTTP/2 and Swoole that is different? Didn't find anything in the documentation.

@Nek-
Copy link
Author

Nek- commented Jan 14, 2022

@doubaokun are you saying SSE is not compatible with HTTP/2 ?

@doubaokun doubaokun reopened this Jan 21, 2022
@doubaokun doubaokun changed the title Http 2 Server does not support streaming [4.10] Http 2 Server does not support streaming Jan 23, 2022
@doubaokun
Copy link
Contributor

@Nek- it will be supported at the next release, PR #125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants