做网站找什么公司工作,企业网站颜色,杭州室内设计培训,网站首页导航栏怎么做今天遇到几个PUT上传的点#xff0c;但是都没利用起来。一怒之下#xff0c;在自己本地试了一下。步骤如下#xff1a; 一、环境#xff1a; 首先#xff0c;根据 配置Apache服务器支持向目录PUT文件 更新一下httpd.conf文件#xff0c;重启所有服务。 二、HTTP - PUT PU…今天遇到几个PUT上传的点但是都没利用起来。一怒之下在自己本地试了一下。步骤如下 一、环境 首先根据 配置Apache服务器支持向目录PUT文件 更新一下httpd.conf文件重启所有服务。 二、HTTP - PUT PUT的前提是了解HTTP协议。下面给出HTTP - PUT的一个模板 PUT /test.txt HTTP/1.1
Accept: */*
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)
Host: test.com:8080hello world 要注意如下几个点 ① PUT方法是HTTP 1.1协议中才出现的。 ② HTTP协议对空格敏感每行数据的结尾不能出现空格 ③ HTTP头部和数据中间要空一行即HTTP头部是以\r\n\r\n结尾的。 ④ 端口号直接跟在HOST后面 三、第一次PUT 好了现在可以PUT了。用Linux下的nc命令来进行连接。 nc -v www.baidu.com 80 rootbb:/etc# nc -v 192.168.163.1 8080
nc: 192.168.163.1 (192.168.163.1) 8080 [http-alt] open /*在得到如上输出之后再将PUT包的内容贴到命令行中回车*/
PUT /test.txt HTTP/1.1
Content-Length: 11
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)
Host: 192.168.163.1:8080hello world/*发送的PUT包到此为止以下为收到的数据包*/
HTTP/1.1 500 Internal Server Error
Date: Wed, 29 Apr 2015 09:15:18 GMT
Server: Apache/2.2.21 (Win64) PHP/5.3.10 DAV/2
Content-Length: 535
Connection: close
Content-Type: text/html; charsetiso-8859-1!DOCTYPE HTML PUBLIC -//IETF//DTD HTML 2.0//EN
htmlhead
title500 Internal Server Error/title
/headbody
h1Internal Server Error/h1
pThe server encountered an internal error or misconfiguration and was unable to complete your request./p
pPlease contact the server administrator, adminlocalhost and inform them of the time the error occurred,and anything you might have done that may have caused the error./p
pMore information about this error may be available in the server error log./p
/body/html 好像不对啊500是服务器内部错误啊。好吧好吧我们去看看主机的Apache日志。 四、再次配环境 主机用的是WAMP日志在/wamp/logs/apache_error.log。找到对应的那一条 通过浏览器搜索又找到一篇日志。Linux(CentOS) 服务端搭建与配置原来用HTTP - PUT还要添加一个什么锁。 所以解决方法是在Apache配置文件中也就是httpd.conf增加一行设定webDAV锁位置。再次重启所有服务。 DavLockDB DavLock #目录没有就创建DavLock 为文件名,应该有的目录结构是\wamp\bin\apache\Apache2.2.21\DavLock 五、终于成功PUT rootbb:/etc# nc -v 192.168.163.1 8080
nc: 192.168.163.1 (192.168.163.1) 8080 [http-alt] open
PUT /test.txt HTTP/1.1
Content-Length: 11
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)
Host: 192.168.163.1:8080hello world
HTTP/1.1 201 Created
Date: Wed, 29 Apr 2015 09:25:24 GMT
Server: Apache/2.2.21 (Win64) PHP/5.3.10 DAV/2
Location: http://192.168.163.1:8080/test.txt
Content-Length: 181
Content-Type: text/html; charsetISO-8859-1!DOCTYPE HTML PUBLIC -//IETF//DTD HTML 2.0//EN
htmlhead
title201 Created/title
/headbody
h1Created/h1
pResource /test.txt has been created./p
/body/html 0。0 差不多这样之后有更多关于PUT的经验再分享 转载于:https://www.cnblogs.com/kuoaidebb/p/4466602.html