Project

General

Profile

PUT request method

Added by calerius over 13 years ago

Hi All,
I've been struggling to get the PUT request method passed as an environment variable so that a custom fastcgi server could handle it. Instead I get 417 Expectation Failed error back to the client. I am using version 1.4.28.

lighttpd.conf - relevant port of the client

server.modules = (
"mod_fastcgi",
"mod_webdav",
"mod_accesslog",
"mod_auth",
"mod_alias",
"mod_access",
"mod_rewrite"
)

$HTTP["request-method"] =~ "^(PUT|DELETE)$" {
fastcgi.server = ( "" =>
((
"socket" => "/tmp/" + "test.fastcgi.socket",
"check-local" => "disable",
"bin-path" => "/home/guest/bin/test.fastcgi",
))
)
}

The client used was curl as follows

curl --upload-file upload.txt http://172.22.99.171/

The access logs does show the PUT request coming in

10.21.80.137 - - [15/Sep/2010:19:47:59 0700] "PUT /upload%2Etxt HTTP/1.1" 417 363 "" "curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3"

Can some one point if 1.4.28 supports it or should I move to 1.5 dev branch ?

Thanks in advance
Calerius


Replies (4)

RE: PUT request method - Added by nitrox over 13 years ago

Not sure if http://redmine.lighttpd.net/issues/1017 falls into this category.

RE: PUT request method - Added by smilligan almost 12 years ago

Hello,
It seems that this option will allow a PUT request method to be responded to from lighttpd
We are using 1.4.29

I was unable to find any reference to how to set this option in the lighttpd.conf file so PUT requests could be processed.

Are there any links explaining where this option should go in the CONF file?

Thanks in advance for your support.
Sean

RE: PUT request method - Added by Lord_Vader almost 12 years ago

Apparently curl and other tools send a "Expect: 100-continue" in the header that lighttpd does not like. The trace from "cadaver" webdav client seems to work OK with setup as described in mod_webdav.

Trace from CURL
PUT /dav/test.txt HTTP/1.1
User-Agent: curl/7.15.5
Host: 10.20.106.52:8080
Accept: */*
Content-Length: 6
Expect: 100-continue

HTTP/1.1 417 Expectation Failed
Content-Type: text/html
Content-Length: 363
Connection: close
Date: Tue, 12 Jun 2012 22:18:44 GMT
Server: lighttpd/1.4.30

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml&quot; xml:lang="en" lang="en">
<head>
<title>417 - Expectation Failed</title>
</head>
<body>
<h1>417 - Expectation Failed</h1>
</body>
</html>

trace from cadaver
PUT /dav/test.txt HTTP/1.1
User-Agent: cadaver/0.23.3 neon/0.29.1
Connection: TE
TE: trailers
Host: 10.20.106.52:8080
Content-Length: 6

Hello

HTTP/1.1 200 OK
Content-Length: 0
Date: Tue, 12 Jun 2012 14:11:22 GMT
Server: lighttpd/1.4.30

RE: PUT request method - Added by EXoloN over 11 years ago

curl

Curl adds the Expect: header field by default but this can be changed. Adding an explicit header Expect: field with no value effectively removes the field from the request header. This enables you to use curl with lighttpds mod_webdav.

Example:

curl -v -H "Expect:" -T "some.file" http://your.server.net/somedirectory/

trace

* About to connect() to alix port 80 (#0)
*   Trying 10.23.42.14... connected
> PUT /dav/testfile.rnd HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: alix
> Accept: */*
> Content-Length: 4096
> 
* We are completely uploaded and fine
< HTTP/1.1 201 Created
< Content-Length: 0
< Date: Wed, 12 Dec 2012 10:31:26 GMT
< Server: lighttpd/1.4.28
< 
* Connection #0 to host alix left intact
* Closing connection #0
    (1-4/4)