ab fails to connect to localhost
The following command fails: $ ab -n 1 localhost:8000/
...
Benchmarking localhost (be patient)...apr_socket_recv: Connection refused (111) But this one succeeds: $ ab -n 1 127.0.0.1:8000/ In /etc/hosts I have: 127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost The issue here is caused by ab taking the first result returned by apr_sockaddr_info_get: https://github.com/apache/httpd/blob/2.4.29/support/ab.c#L1835-L1837 But apr_sockaddr_info_get returns a list. If it were to try the second sockaddr structure, it would connect. This way it works: rv = apr_sockaddr_info_get(&sa, REMOTE_HOST, APR_UNSPEC, REMOTE_PORT, 0, mp);
if (rv != APR_SUCCESS) {
return rv;
} for ( ; sa; sa = sa->next) {
rv = apr_socket_create(&s, sa->family, SOCK_STREAM, APR_PROTO_TCP, mp);
if (rv != APR_SUCCESS) {
return rv;
} apr_socket_opt_set(s, APR_SO_NONBLOCK, 1);
apr_socket_timeout_set(s, SOCK_TIMEOUT); rv = apr_socket_connect(s, sa);
if (rv == ECONNREFUSED) {
continue;
} else if (rv == APR_SUCCESS) {
break;
} else {
return rv;
}
} apr_socket_opt_set(s, APR_SO_NONBLOCK, 0);
apr_socket_timeout_set(s, SOCK_TIMEOUT); Other tools (like, curl, wget, w3m) deal with it just fine. P.S. A couple of links just in case https://gist.github.com/x-yuri/5ad28ac0a22ca19a7c3073ce0de5abf0
https://gist.github.com/x-yuri/95fd4776fb9bf8f1eaae7eb2e7ed6bd4
ab fails to connect to localhost的更多相关文章
- Docker - Failed to connect to localhost port 4000: Connection refused
转载.翻译自 https://stackoverflow.com/questions/44014698/docker-failed-to-connect-to-localhost-port-4000- ...
- Nodejs学习之mongodb Error: failed to connect to [localhost:27017]
在连接mongodb时出现以下错误提示信息 events.js: throw er; // Unhandled 'error' event ^ Error: failed to connect to ...
- 【Docker】在本地打包maven程序为docker镜像报错: Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1]
错误信息: [ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (default-cli) on pr ...
- Eureka 注册中心一直报Connect to localhost:8761 time out 的问题
忽略了配置eureka.client.service-url.defaultZone而导致的异常,重新覆盖配置就好 client: fetch-registry: false register-wit ...
- Eureka报错: Connect to localhost:8761 timed out
最近整理配置Eureka时, 注册服务后, Eureka服务一直报出如下错误: 如下是我的单台eureka的 application.yml 配置: spring: application: name ...
- Linux项目部署 jdk tomcat 安装配置 linux下 failed connect to localhost:8080;Connection refused
ONBOOT=yes 5.安装wget (1)安装 yum -y install wget (2) 查看版本 wget --version或 wget -V 一.安装jdk 配置 (1)安 ...
- ab性能并发测试语法
ab测试语法ab -n 全部请求数 -c 并发数 测试url 例如:ab -n 10000 -c 1000 http://myweb.com/test.html Server Software: Ap ...
- Apache ab 压力并发测试工具
当你使用PHP(或其他编程语言)完成一个web程序的开发,并且web程序在Apache服务器上正常运行的时候,你有没有考虑过对你的Apache服务器及部署在其上的web程序进行一些压力测试呢?毕竟,真 ...
- MySQL数据库localhost的root用户登陆遭遇失败
问题:Access denied for user 'root'@'localhost' (using password: YES)打开MySQL目录下的my.ini文件(Linux的话是/etc/m ...
随机推荐
- Node.js,一生所爱
下午参加了<云品秀--前端前沿>,用友云平台前端架构师郭永峰(站着的那位)讲得很棒,而我最关注的就是Node了.最后我问了他关于独立开发,后端选择Node还是别的语言.他讲了很多,说自己在 ...
- Linode跨节点迁移:从Tokyo到Fremont
背景 上一篇博客交代了如何在 Linode 上搭建邮件服务器,并配置好各种协议.记录来投入实际使用. 由于实践过程中,曾经尝试使用明文协议与服务器交流数据,可能泄露了账号.密码信息,造成之后被攻击发送 ...
- 记排查octopress生成时的编码错误
前些日子经若亮童鞋提醒,我在其他推荐的页面中增加了对 Dropbox 和 Linode 等工具的推荐,一来分享这些好用的产品,二来期望刚接触这些工具的好心的朋友可以不吝啬时间用我的推荐码注册,让我获得 ...
- Android 平台下Cordova 调用Activity插件开发
首先建立一个包名为package com.JiajiaCy.CallActivity; package com.JajaCy.CallActivity; import org.apache.cordo ...
- SQL SERVER配置[转]
感谢shuhao,sql server的配置都是他教的,下面是他写的总结,方便自己以后使用 总结一下,感觉比较实用.------------------------------------------ ...
- AVL 树的插入、删除、旋转归纳
参考链接: http://blog.csdn.net/gabriel1026/article/details/6311339 1126号注:先前有一个概念搞混了: 节点的深度 Depth 是指从根 ...
- Jenkins 部署
1 修改jenkins的根目录,默认地在C:\Documents and Settings\AAA\.jenkins . .jenkins ├─jobs│ └─JavaHelloWorld│ ...
- 作为学术用的 matlab
1. 可重复实验 程序实现的所谓随机,并非完全的随机,而是由某一算法(或者再需要一个种子值)生成出来的. randn('state', 0) % set state so that example c ...
- [GEiv]第七章:着色器 高效GPU渲染方案
第七章:着色器 高效GPU渲染方案 本章介绍着色器的基本知识以及Geiv下对其提供的支持接口.并以"渐变高斯模糊"为线索进行实例的演示解说. [背景信息] [计算机中央处理器的局限 ...
- XF Grid使用-两行两列-跟WPF不同
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http:/ ...