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

master 分支,返回的 HTTP 信息异常 #5107

Closed
qiqizjl opened this issue Jul 26, 2023 · 2 comments
Closed

master 分支,返回的 HTTP 信息异常 #5107

qiqizjl opened this issue Jul 26, 2023 · 2 comments

Comments

@qiqizjl
Copy link
Contributor

qiqizjl commented Jul 26, 2023

Please answer these questions before submitting your issue.

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

master分支构建

<?php

$http = new Swoole\Http\Server('0.0.0.0', 9501);

$http->on('Request', function ($request, $response) {
    $response->status(200,"OKxxx");
    $response->header('Content-Type', 'text/html; charset=utf-8');
    $response->end('<h1>Hello Swoole. #' . rand(1000, 9999) . '</h1>');
});

$http->start();

怀疑和这个变更有关
55f8561

http_buffer->append(ZEND_STRL("HTTP/1.1 "));
http_buffer->append(response.status);
http_buffer->append(ZEND_STRL(" "));
http_buffer->append(ZEND_STRL(response.reason));
http_buffer->append(ZEND_STRL("\r\n"));
}

status 不传reason是正常的
之后 curl 127.0.0.1:9501 即可复现

  1. What did you expect to see?
    curl 成功 返回 HelloWorld

  2. What did you see instead?

> curl -v 127.0.0.1:9501/     
*   Trying 127.0.0.1:9501...
* Connected to 127.0.0.1 (127.0.0.1) port 9501 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:9501
> User-Agent: curl/8.1.2
> Accept: */*
> 
* Nul byte in header
* Closing connection 0
curl: (8) Nul byte in header
image
  1. What version of Swoole are you using (show your php --ri swoole)?

php --ri swoole
swoole

Swoole => enabled
Author => Swoole Team [email protected]
Version => 5.1.0-dev
Built => Jul 26 2023 22:12:56
coroutine => enabled with boost asm context
kqueue => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 3.1.1 30 May 2023
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
c-ares => 1.19.1
zlib => 1.2.12
mysqlnd => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_fiber_mock => Off => Off
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => Off => Off
swoole.unixsock_buffer_size => 262144 => 262144

  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?

Darwin xxx 23.0.0 Darwin Kernel Version 23.0.0: Tue Jul 18 20:34:24 PDT 2023; root:xnu-10002.0.199.505.1~3/RELEASE_ARM64_T6020 arm64

PHP 8.2.8 (cli) (built: Jul 6 2023 10:57:44) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.8, Copyright (c) Zend Technologies
with Zend OPcache v8.2.8, Copyright (c), by Zend Technologies

Apple clang version 15.0.0 (clang-1500.0.34.3)
Target: arm64-apple-darwin23.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@NathanFreeman
Copy link
Member

已修复#5108

图片

@qiqizjl
Copy link
Contributor Author

qiqizjl commented Jul 27, 2023

已修复#5108

图片

感谢 可以了~

matyhtf pushed a commit that referenced this issue Jul 28, 2023
* Fix bug #5107

* test
@matyhtf matyhtf closed this as completed Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants