"Expect: 100-continue" not handled properly in PUT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I'm having a small problem with trying to use curl to upload files
to a shared folder that uses spice-webdavd. (I'm not mounting the
webdav, just trying to use curl to upload a single file).

In libphodav/phodav-method-put.c, lines 77 to 78, if the "Expect" header
if present, a warning is created, but no special handling is done.
Instead, "status" is set to either "SOUP_STATUS_CREATED" or
"SOUP_STATUS_OK".

As per the SoupServer documentation, if "status" if set and the "Expect"
header if present, the status will be returned and no further processing
will be done:

> (At this point, if the request headers contain "Expect: 100-continue",
> and a status code has been set, then SoupServer will skip the
> remaining steps and return the response. If the request headers
> contain "Expect: 100-continue" and no status code has been set,
> SoupServer will return a SOUP_STATUS_CONTINUE status before
> continuing.)

This is a problem because "curl --upload-file" will send a "PUT" request
with a "Expect: 100-continue" header, and instead of phodav sending a
"100" response and waiting for the body, it sends either "200" or "201".

Here is the output of "curl -T test.txt http://localhost:9843 -o
/dev/stdout -vvv", with "spice-webdavd" running on port 9843:

    *   Trying 127.0.0.1:9843...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to localhost (127.0.0.1) port 9843 (#0)
    > PUT /test.txt HTTP/1.1
    > Host: localhost:9843
    > User-Agent: curl/7.81.0
    > Accept: */*
    > Content-Length: 14
    > Expect: 100-continue
    > 
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 201 Created
    < Server: PhodavServer libsoup/2.65.1
    < Date: Wed, 26 Jan 2022 03:10:06 GMT
    < Content-Length: 0
    < 
      0    14    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    * Connection #0 to host localhost left intact

In contrast, when running the "simple-httpd" file from the libsoup
examples, with it listening on port "33467", and running "curl -T
test.txt http://localhost:33467 -o /dev/stdout -vvv", the output is:

    *   Trying 127.0.0.1:33467...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to localhost (127.0.0.1) port 33467 (#0)
    > PUT /test.txt HTTP/1.1
    > Host: localhost:33467
    > User-Agent: curl/7.81.0
    > Accept: */*
    > Content-Length: 14
    > Expect: 100-continue
    > 
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 100 Continue
    < Server: simple-httpd libsoup/3.0.4
    < Date: Wed, 26 Jan 2022 03:14:19 GMT
    } [14 bytes data]
    * We are completely uploaded and fine
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 201 Created
    < Content-Length: 0
    < 
    100    14    0     0  100    14      0  11137 --:--:-- --:--:-- --:--:-- 14000
    * Connection #0 to host localhost left intact

I have looked at the code, but I'm not sure how it would be possible to
handle this properly, because handling 100-continue needs a two step
process, which the current structure doesn't allow easily.

I'm doing this on an Alpine Linux aarch64 VM
Versions of packages used:
 - spice-webdavd: 2.5
 - curl 7.81.0




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]