]> sjero.net Git - wget/blobdiff - src/http.c
fixed 204 response handling, added new Test-204.px
[wget] / src / http.c
index 8bba70dfdb5cb0ea0fa192c01361559e18e81af4..00a35b324aae5ed9672d6a91c4e6bb6d42ecbaf6 100644 (file)
@@ -2618,6 +2618,22 @@ read_header:
   if (H_20X (statcode))
     *dt |= RETROKF;
 
+  if (statcode == HTTP_STATUS_NO_CONTENT)
+    {
+      /* 204 response has no body (RFC 2616, 4.3) */
+
+      /* In case the caller cares to look...  */
+      hs->len = 0;
+      hs->res = 0;
+      hs->restval = 0;
+
+      CLOSE_FINISH (sock);
+      xfree_null (type);
+      xfree (head);
+
+      return RETRFINISHED;
+    }
+
   /* Return if redirected.  */
   if (H_REDIRECTED (statcode) || statcode == HTTP_STATUS_MULTIPLE_CHOICES)
     {