]> sjero.net Git - wget/blobdiff - src/http.c
fixed 204 response handling, added new Test-204.px
[wget] / src / http.c
index 690fcdecfd04ab65a58db2912661386f03b7b780..00a35b324aae5ed9672d6a91c4e6bb6d42ecbaf6 100644 (file)
@@ -1040,7 +1040,7 @@ modify_param_name(param_token *name)
 static void
 modify_param_value (param_token *value, int encoding_type )
 {
-  if (RFC2231_ENCODING == encoding_type)
+  if (encoding_type == RFC2231_ENCODING)
     {
       const char *delim = memrchr (value->b, '\'', value->e - value->b);
       if ( delim != NULL )
@@ -1073,6 +1073,7 @@ extract_param (const char **source, param_token *name, param_token *value,
                char separator, bool *is_url_encoded)
 {
   const char *p = *source;
+  int param_type;
   if (is_url_encoded)
     *is_url_encoded = false;   /* initializing the out parameter */
 
@@ -1130,10 +1131,10 @@ extract_param (const char **source, param_token *name, param_token *value,
     }
   *source = p;
 
-  int param_type = modify_param_name(name);
-  if (NOT_RFC2231 != param_type)
+  param_type = modify_param_name(name);
+  if (param_type != NOT_RFC2231)
     {
-      if (RFC2231_ENCODING == param_type && is_url_encoded)
+      if (param_type == RFC2231_ENCODING && is_url_encoded)
         *is_url_encoded = true;
       modify_param_value(value, param_type);
     }
@@ -2617,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)
     {
@@ -3120,6 +3137,8 @@ Spider mode enabled. Check if remote file exists.\n"));
       /* Decide whether or not to restart.  */
       if (force_full_retrieve)
         hstat.restval = hstat.len;
+      else if (opt.start_pos >= 0)
+        hstat.restval = opt.start_pos;
       else if (opt.always_rest
           && got_name
           && stat (hstat.local_file, &st) == 0