[记录点滴]OpenResty 支持http v2的问题

0x00 摘要

记录一次OpenResty支持http v2的问题排查。

0x01 问题

错误现象:无法上传图片,后台log是http v2 not supported yet

以为是后台没有开启http v2,于是开始排查。

0x02 排查

nginx

nginx显示支持 v2

/usr/local/openresty/nginx/sbin/nginx -V
nginx version: openresty/1.11.2.3
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
built with OpenSSL 1.0.2k 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl/include' --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.60 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.8 --add-module=../ngx_lua_upstream-0.06 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.18 --add-module=../redis2-nginx-module-0.14 --add-module=../redis-nginx-module-0.3.7 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl/lib' --with-pcre-jit --with-ipv6 --with-stream --with-stream_ssl_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-file-aio --with-dtrace-probes --with-http_ssl_module

curl

用curl来验证,也显示支持v2

curl --http2 -I https://xxx/
HTTP/2 500
server: nginx
content-type: application/octet-stream
content-length: 11

需要看看curl是否支持http2,显示也支持

curl -V
curl 7.55.1 (x86_64-pc-linux-gnu) libcurl/7.55.1 OpenSSL/1.0.1 zlib/1.2.3.4 nghttp2/1.26.0-DEV librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy

nginx源码

nginx源码中,没有搜索到这个字符串http v2 not supported yet

Openresty编译https

怀疑是Openresty没有编译进去http2,于是重新编译

./configure --prefix=/usr/local/openresty_http_v2 \
--with-pcre-jit \
--with-ipv6 \
--with-http_iconv_module \
--with-luajit \
--with-http_v2_module \
--with-openssl=/home/xxx/openssl-1.0.2l\
-j2 \ --with-http_postgres_module \ --------------> 这个不行

但是这个版本也不行,同样的错误。

0x03 resty.upload代码排查

上传图片使用resty.upload

local UPLOAD = require "resty.upload"
local form,err = UPLOAD:new(chunk_size)
local typ, res, err = form:read()

所以我们去resty.upload代码看,发现使用了ngx.req.socket

local req_socket = ngx.req.socket
local sock, err = req_socket()
if not sock then
return nil, err
end

0x04 OpenResty源码

下载openresty源码,在ngx_http_lua_req_socket函数中,确实有这个字符串

static int ngx_http_lua_req_socket(lua_State *L) {
#if (NGX_HTTP_V2)
if (r->stream) {
return luaL_error(L, "http v2 not supported yet");
}
#endif
}

这明明是:在http v2情况下,socket不支持stream好不好!

0x05 解决

nginx.conf中,取消了http2的配置。这样客户端就知道后台只支持httpv1.1,就按照1.1来传输,就可以了。

[记录点滴]OpenResty 支持http v2的问题的更多相关文章

  1. [记录点滴]授人以渔,从Tensorflow找不到dll扩展到如何排查问题

    [记录点滴]授人以渔,从Tensorflow找不到dll扩展到如何排查问题 目录 [记录点滴]授人以渔,从Tensorflow找不到dll扩展到如何排查问题 0x00 摘要 0x01 引言 0x02 ...

  2. 关于使用视图进行分页时出现当前记录集不支持书签的错误解决方法及原因(asp)

    一般在使用视图进行查询时,视图中意般都关联了两个或者更多个表,一般在这种情况下才会使用视图,但是但我在使用视图来查询数据时没有问题,但是一旦在分页中使用到视图进行查询就会出现错误提示如下: ADODB ...

  3. ASP 代码当前记录集不支持更新问题的解决办法。

    错误类型: ADODB.Recordset (0x800A0CB3) 当前记录集不支持更新.这可能是提供程序的限制,也可能是选定锁定类型的限制. /Model/manage/Admin_Admin.a ...

  4. 反射记录点滴——Field

    反射记录点滴 1. 反射获取类的属性 Class.getDeclareFileld(String name) 返回一个Filed对象,该对象反映此Class对象所表示的类或接口的指定已声明字段. Cl ...

  5. 使用lua graphql 模块让openresty 支持graphql api

      graphql 是一个很不错的api 查询标准语言,已经有一个lua 的版本支持graphql 项目使用docker&&docker-compose 运行 环境准备 模块安装 lu ...

  6. Openresty支持HTTP2

    1. 下载openresty-1.13.6.1.tar.gz和openssl-1.0.2l.tar.gz,并解压 下载对应的软件版本,创建openresty_http2安装路径 2. 安装openre ...

  7. 继续Wcf记录点滴

    之前说wcf以tcp协议作为通信方式的话会出现很多奇怪的bug,今天我把自己遇到的比较特殊的一个exception和解决方案列出来.主要是自己记录一下,顺便方便遇到这个问题的有缘人吧!废话不多说直接上 ...

  8. PIL安装记录,编译支持jpeg png

    PIL是python理想的图片处理module,但是想要良好的支持各种图片,还需要检查一下几步,否则会提示:IOError: decoder jpeg not available之类的. 我的环境:L ...

  9. IPMITOOL命令支持列表V2.0

    命令集 命令行格式 命令行说明 User ipmitool -H <IP地址> -I lanplus -U <用户名> -P <密码> user summary 查 ...

  10. 配置OpenResty支持SSL(不受信任的证书)

    #关闭防火墙 chkconfig iptables off service iptables stop #关闭SELINUX sed -i 's/SELINUX=enforcing/SELINUX=d ...

随机推荐

  1. 基于 .NET 的开源工作流引擎框架

    前言 工作流管理成为了提高应用灵活性和可维护性的重要手段.Elsa 作为一款针对 .NET 平台的强大工作流库,为开发者提供了在各种 .NET 应用中轻松集成和执行复杂工作流的能力. 本文将详细介绍 ...

  2. 水位波纹动画兼容ie8

    效果观看请到下方: 链接:https://pan.baidu.com/s/1AWHz0BHTmj_7Vx6qhSmuaA 提取码:ih9p 复制这段内容后打开百度网盘手机App,操作更方便哦 下面介绍 ...

  3. 负载测试工具之Fortio

    github: github.com/fortio/fortio 日常开发中通常需要知道系统能承受的最大负载,不满足当前需求时对系统软硬件进行相应的优化或升级.今天推荐的工具 Fortio 就是用来测 ...

  4. 2021GPLT

    病毒溯源 给定一棵树,树上有\(n\)个节点,编号从\(0\)到\(n-1\),请你输出从根节点开始的最长的一条链,且该链字典序最小 题解:\(dfs\)树的遍历 + 贪心 首先我们先找到入度为\(0 ...

  5. Python 学习记录(2)

    NumPy数组规整 对数组进行各种变化 转换数组形状 import numpy as np a=np.arange(1,6+1) b=np.reshape(a,(2,3)) print(a) prin ...

  6. fiddler:The system proxy was changed.Click to reenable capturing

    前情 最近在开发一个老旧项目,由于本地环境已难跑起,于是想通过代理线上代码进行功能开发. 坑位 启动fiddler后,fiddler菜单栏会警告,大概意思是代理被更改了,点击重启fillder代理,但 ...

  7. Qt tr 无法翻译

    项目中碰到部分tr无法翻译的问题,最后发现由于继承QObject的子类没有加上Q_OBJECT宏.

  8. Ubuntu22.04安装cuda12.1+cudnn8.9.2+TensorRT8.6.1+pytorch2.3.0+opencv_cuda4.9+onnxruntime-gpu1.18

    说来话长,我想配一个一劳永逸的环境,方便以后复用.省的以后反复查教程重新装了 1. 安装miniconda+py3.10 cd /root wget -q https://repo.anaconda. ...

  9. 【Amadeus原创】域密码到期发送提醒邮件的超简单方法

    1,AD服务器下载安装免费的卓豪AD管理工具 https://www.manageengine.cn/products/self-service-password/free-password-expi ...

  10. Advanced .NET Remoting: 第 8 章 创建连接器

    第 8 章 创建连接器 上一章向您展示了各种类型的连接器,以及它们对于请求的同步和异步处理过程.到目前为止,我一直忽略的一个最为重要的步骤是:初始化连接器和连接器链.连接器通常既不是直接待代码中创建, ...