支持put上傳需要修改以下配置
http.conf
//打開下面兩個module
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
//增加一下配置,允許Apache支持put方法
<Directory />
Dav On
AllowOverride None
Options ALL
Order allow,deny
Allow from all
</Directory>
DavLockDB DavLock
除此之外,想要通過put上傳文件,需要建立一個文件夾 DavLock
文件目錄位置為 ./Apache/DavLock
為Apache安裝目錄下增加一個鎖文件
WebDAV使得應用程序可以直接將文件寫到 Web Server 上,
并且在寫文件時候可以對文件加鎖,寫完后對文件解鎖,還可以支持對文件所做的版本控制。
基于 WebDAV可以實現一個功能強大的內容管理系統或者配置管理系統。
PUT /test.txt HTTP/1.1
Accept: */*
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)
Host: 127.0.0.1
hello world
COPY /test.txt HTTP/1.1
Host: test.com
Destination: http://test.com/test.asp
MOVE /dir_name/test.aspx HTTP/1.1
Destination: /test.aspx
Host: test.com
//MOVE方法要求移動的文件不在同一個文件夾內
PUT,COPY,MOVE等方法執行成功后服務器響應的返回值都會是201
使用BurpSuit的Repeater模塊發包
Request請求包
PUT /test.txt HTTP/1.1
Accept: */*
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)
Host: 127.0.0.1
Content-Length: 35
<?php echo "<h3>hello world<h3>" ?>
Respons響應包
HTTP/1.1 201 Created
Date: Fri, 22 Dec 2017 09:46:32 GMT
Server: Apache/2.4.23 (Win32) OpenSSL/1.0.2j PHP/5.5.38
Location: http://127.0.0.1/test.txt
Content-Length: 181
Content-Type: text/html; charset=ISO-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>201 Created</title>
</head><body>
<h2>Created</h2>
<p>Resource /test.txt has been created.</p>
</body></html>
Request請求包
COPY /test.txt HTTP/1.1
Accept: */*
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)
Host: 127.0.0.1
Destination: http://127.0.0.1/test.php
Content-Length: 2
\r\n
\r\n
#必須要有兩個回車,便于理解使用(\r\n)表明,實際直接敲兩個回車就好。
Respons響應包
HTTP/1.1 201 Created
Date: Fri, 22 Dec 2017 09:56:11 GMT
Server: Apache/2.4.23 (Win32) OpenSSL/1.0.2j PHP/5.5.38
Location: http://127.0.0.1/test.php
Content-Length: 184
Content-Type: text/html; charset=ISO-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>201 Created</title>
</head><body>
<h2>Created</h2>
<p>Destination /test.php has been created.</p>
</body></html>
Request請求包
GET /test.php HTTP/1.1
Host: 127.0.0.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://127.0.0.1/
Connection: close
Upgrade-Insecure-Requests: 1
Respons響應包
HTTP/1.1 200 OK
Date: Fri, 22 Dec 2017 10:07:57 GMT
Server: Apache/2.4.23 (Win32) OpenSSL/1.0.2j PHP/5.5.38
X-Powered-By: PHP/5.5.38
Content-Length: 19
Connection: close
Content-Type: text/html
<h3>hello world<h3>
Request請求包
GET /test.txt HTTP/1.1
Host: 127.0.0.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://127.0.0.1/
Connection: close
Upgrade-Insecure-Requests: 1
Respons響應包
HTTP/1.1 200 OK
Date: Fri, 22 Dec 2017 10:09:23 GMT
Server: Apache/2.4.23 (Win32) OpenSSL/1.0.2j PHP/5.5.38
Last-Modified: Fri, 22 Dec 2017 09:46:32 GMT
ETag: "1a-560eab110da27"
Accept-Ranges: bytes
Content-Length: 26
Connection: close
Content-Type: text/plain
echo "<h3>hello world<h3>"
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。