bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] Segmentation fault with current development version of wg


From: Gijs van Tulder
Subject: Re: [Bug-wget] Segmentation fault with current development version of wget
Date: Wed, 01 May 2013 21:26:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

Giuseppe Scrivano wrote:
> what about this patch?  Any comment?

Another suggestion: why not save the original opt.method, set opt.method to NULL and put the original opt.method back later?

Gijs


diff --git a/src/retr.c b/src/retr.c
index d51b7e7..2aee578 100644
--- a/src/retr.c
+++ b/src/retr.c
@@ -679,22 +679,23 @@ calc_rate (wgint bytes, double secs, int *units)

 #define SUSPEND_POST_DATA do {                  \
   post_data_suspended = true;                   \
   saved_post_data = opt.body_data;              \
   saved_post_file_name = opt.body_file;         \
+  saved_method = opt.method;                    \
   opt.body_data = NULL;                         \
   opt.body_file = NULL;                         \
   opt.method = NULL;                            \
 } while (0)

 #define RESTORE_POST_DATA do {                          \
   if (post_data_suspended)                              \
     {                                                   \
       opt.body_data = saved_post_data;                  \
       opt.body_file = saved_post_file_name;             \
+      opt.method = saved_method;                        \
       post_data_suspended = false;                      \
-      opt.method = "POST";                              \
     }                                                   \
 } while (0)

 static char *getproxy (struct url *);

@@ -721,10 +722,11 @@ retrieve_url (struct url * orig_parsed, const char *origurl, char **file,
   int redirection_count = 0;

   bool post_data_suspended = false;
   char *saved_post_data = NULL;
   char *saved_post_file_name = NULL;
+  char *saved_method = NULL;

   /* If dt is NULL, use local storage.  */
   if (!dt)
     {
       dt = &dummy;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]