使用cURL POST上传文件
发布时间:August 8, 2013 // 分类:网络工具 // No Comments
cURL以application/x-www-url-encoded方式POST表单,实现类似于浏览器表单登录:
curl -c ck.txt -d "name=user&pw=password" "https://www.haiyun.me/login.php"
以multipart/form-data二进制数据上传文件,-F为提交的表单参数:
curl -i -b qi.txt -F "file=@test.tar.gz;filename=c.tar.gz" \
-F "autoDir=flase" \
-F "parentPath=/Share/2013/08/08" \
-F "desc=tes.tar.gz" \
"https://www.haiyun.me/view?module=upload&action=uploadSave”
对于大文件上传cURL会自动添加Expect: 100-continue首部,有的服务器不支持此功能会返回HTTP/1.1 417 Expectation failed,添加HEAD解决:
-H "Expect:"
有的不能正常发送MIME需手工指定:
file=@test.tar.gz;filename=c.tar.gz;type=application/x-rar
cURL超时设置和重试
发布时间:August 7, 2013 // 分类:网络工具 // No Comments
使用cURL采集数据或测试服务器时防止一直连接要用到超时和重连设置,连接超时参数:
--connect-timeout
#连接超时秒
-m
#总连接超时秒,包含连接超时
连接超时后重连参数:
--retry
#重连次数
--retry-delay
#等待多少秒重连
示例:
curl.exe -I -m 5 --retry-delay 2 --retry 2 127.0.0.1
PHP CURL超时设置:
#连接超时
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,3);
#curl最大执行时间
curl_setopt($ch, CURLOPT_TIMEOUT,5);
#1秒内传输1字节数据终止
curl_setopt($ch, CURLOPT_LOW_SPEED_TIME, '1');
curl_setopt($ch, CURLOPT_LOW_SPEED_LIMIT, '1');
BT5安装初始化设置国内软件源及网络IP
发布时间:October 8, 2012 // 分类:网络工具 // No Comments
BT5连接官方源较慢,更改为科大提供的源:
cd /etc/apt/
cp sources.list sources.list.bak
cat sources.list
#https://www.haiyun.me
deb http://mirrors.ustc.edu.cn/backtrack/source revolution main microverse non-free testing
deb http://mirrors.ustc.edu.cn/backtrack/all revolution main microverse non-free testing
deb http://mirrors.ustc.edu.cn/backtrack/32 revolution main microverse non-free testing
设置固定IP,默认为DHCP:
cat /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.31
netmask 255.255.255.0
gateway 192.168.1.1
重启网络生效:
/etc/init.d/networking restart
分类
- Apache (13)
- Nginx (45)
- PHP (86)
- IIS (8)
- Mail (17)
- DNS (16)
- Cacti (14)
- Squid (5)
- Nagios (4)
- Puppet (7)
- CentOS (13)
- Iptables (23)
- RADIUS (3)
- OpenWrt (41)
- DD-WRT (1)
- VMware (9)
- 网站程序 (2)
- 备份存储 (11)
- 常用软件 (20)
- 日记分析 (10)
- Linux基础 (18)
- 欧诺代理 (0)
- Linux服务 (18)
- 系统监控 (4)
- 流量监控 (7)
- 虚拟化 (28)
- 伪静态 (2)
- LVM (3)
- Shell (18)
- 高可用 (2)
- 数据库 (16)
- FreeBSD (3)
- 网络安全 (25)
- Windows (35)
- 网络工具 (22)
- 控制面板 (3)
- 系统调优 (10)
- Cisco (3)
- VPN (6)
- ROS (20)
- Vim (14)
- KMS (4)
- PXE (2)
- Mac (1)
- Git (1)
- PE (1)
- LNS (2)
- Xshell (7)
- Firefox (13)
- Cygwin (4)
- OpenSSL (9)
- Sandboxie (3)
- StrokesPlus (1)
- AutoHotKey (4)
- Total Commander (3)
- WordPress (3)
- iMacros (6)
- Typecho (2)
- Ollydbg (1)
- Photoshop (1)
- 正则 (3)
- Debian (3)
- Python (8)
- NoSQL (6)
- 消息队列 (4)
- JS (7)
- Tmux (3)
- GO (7)
- HHVM (2)
- 算法 (1)
- Docker (2)
- PT (15)
- N1 (16)
- K2P (6)
- LUKS (4)
最新文章
- openwrt/linux使用tcpdump/nflog ulogd记录iptables日志
- tmux bash shell自动保存history
- ImmortalWrt/OpenWRT为guest wifi网络配置ipv6 nat6
- PVE更新upgrade遇到The following packages have been kept back
- openwrt/immortalwrt修改odhcpd ipv6 preferred_lifetime和valid_lifetime
- golang版本udpxy iptv rtp多播转http单播
- 贝尔G-140-ME光猫使用sshd登录提示Your password has expired
- 联通使用移动贝尔G-140-ME光猫及使用TTL连接
- openwrt单线复用iptv并将组播转为http单播流任意设备观看
- 联通光猫SK-D740-C获取超级密码开启telnet及编译ssh/dropbear
最近回复
- 海运: 恩山有很多。
- swsend: 大佬可以分享一下固件吗,谢谢。
- Jimmy: 方法一 nghtp3步骤需要改成如下才能编译成功: git clone https://git...
- 海运: 地址格式和udpxy一样,udpxy和msd_lite能用这个就能用。
- 1: 怎么用 编译后的程序在家里路由器内任意一台设备上运行就可以吗?比如笔记本电脑 m参数是笔记本的...
- 孤狼: ups_status_set: seems that UPS [BK650M2-CH] is ...
- 孤狼: 擦。。。。apcupsd会失联 nut在冲到到100的时候会ONBATT进入关机状态,我想想办...
- 海运: 网络,找到相应的url编辑重发请求,firefox有此功能,其它未知。
- knetxp: 用浏览器F12网络拦截或监听后编辑重发请求,修改url中的set为set_super,将POS...
- Albert: 啊啊啊啊啊啊啊啊啊 我太激动了,终于好了英文区搜索了半天,翻遍了 pve 论坛没找到好方法,博...