http://svn.tools.ietf.org/svn/wg/httpbi ... ssage.body
:
So this applies to e.g. '200 OK' and '404 Not Found' responses, which may have a zero message body.The presence of a message body in a request is signaled by a Content-Length or Transfer-Encoding header field. ...
... All 1xx (Informational), 204 (No Content), and 304 (Not Modified) responses do not include a message body. All other responses do include a message body, although the body might be of zero length.
newLISP:
Code: Select all
sr@mad:~$ newlisp
newLISP v.10.6.2 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h
> (get-url "http://localhost/empty.txt" "debug")
GET /empty.txt HTTP/1.1
Host: localhost
User-Agent: newLISP v10602
Connection: close
HTTP/1.1 200 OK
"ERR: HTTP document empty"
> ; but:
> (get-url "file:///tmp/empty.txt" "debug")
""
Code: Select all
sr@mad:~$ curl -v -X GET http://localhost/empty.txt
* About to connect() to localhost port 80 (#0)
* Trying ::1...
* connected
* Connected to localhost (::1) port 80 (#0)
> GET /empty.txt HTTP/1.1
> User-Agent: curl/7.26.0
> Host: localhost
> Accept: */*
>
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
< Date: Fri, 10 Jul 2015 12:49:10 GMT
< Server: Apache/2.2.22 (Debian)
< Last-Modified: Fri, 10 Jul 2015 12:10:49 GMT
< ETag: "8075b-0-51a84433bdbcf"
< Accept-Ranges: bytes
< Content-Length: 0
< Vary: Accept-Encoding
< Content-Type: text/plain
<
* Connection #0 to host localhost left intact
* Closing connection #0
Ideas:
- (http-error) for more fine-granular checking of http responses?
- net-error '24 HTTP document empty' only (possibly with 'empty' -> 'missing'), if there is no 'Content-Length or Transfer-Encoding header' for a response with an HTTP error code needing a message body?