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

2013-06-17 Thread Darshit Shah
On Mon, Jun 17, 2013 at 2:05 AM, Giuseppe Scrivano wrote: > Thanks, the code seems correct but since you are going to write a lot of > code during your Summer of Code project, I will be very pedantic. This > time I have just amended the changes before push your patch. > > > Darshit Shah writes:

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

2013-06-16 Thread Giuseppe Scrivano
Thanks, the code seems correct but since you are going to write a lot of code during your Summer of Code project, I will be very pedantic. This time I have just amended the changes before push your patch. Darshit Shah writes: > Please be aware that Wget needs to know the size of the POST data

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

2013-06-16 Thread Darshit Shah
> please follow the GNU Coding standards here. Empty space between > function name and '(' and also leave spaces around the operator !=. > > Sorry for missing these. Fixed in all the relevant locations in the patch. > Could you please also add some comments in the documentation? > Added the chan

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

2013-06-16 Thread Giuseppe Scrivano
thanks for your contribution, some comments inline: Darshit Shah writes: > - if (statcode == HTTP_STATUS_TEMPORARY_REDIRECT) > -return NEWLOCATION_KEEP_POST; > + switch (statcode) > + { > +case HTTP_STATUS_TEMPORARY_REDIRECT: > + re

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

2013-06-14 Thread Darshit Shah
Attaching a patch that should (hopefully) fix all the problems listed here. I have tested it and it looks good to me. On Thu, May 9, 2013 at 9:55 AM, Darshit Shah wrote: > > > We currently suspend any method if the response code is a non 307 >> > redirect. That I believe is wrong. We should onl

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

2013-05-08 Thread Darshit Shah
> > We currently suspend any method if the response code is a non 307 > > redirect. That I believe is wrong. We should only be suspending the > > POST method and not others. > > It sounds good, but we must be careful also with 303. > > Do you agree that the matrix for the method to use on the next

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

2013-05-08 Thread Giuseppe Scrivano
Darshit Shah writes: > > We suspend the post data only when we receive a 307, or do you > mean we > shouldn't suspend in this case too? > > It's the other way round. A 307 response code is used when the server > wishes to explicitly ask the client to not suspend. And that is

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

2013-05-06 Thread Darshit Shah
> > We suspend the post data only when we receive a 307, or do you mean we > shouldn't suspend in this case too? > > It's the other way round. A 307 response code is used when the server wishes to explicitly ask the client to not suspend. And that is also the current behaviour. We currently suspen

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

2013-05-06 Thread Giuseppe Scrivano
Darshit Shah writes: > While DELETE *may* be redirected, the document did not mention > anything explicitly about it. From what I gauge, we should not suspend > a DELETE command upon a redirect. We suspend the post data only when we receive a 307, or do you mean we shouldn't suspend in this case

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

2013-05-06 Thread Darshit Shah
> This paragraph: > > "The 307 (Temporary Redirect) status code indicates that the target > resource resides temporarily under a different URI and the user agent > MUST NOT change the request method if it performs an automatic > redirection to that URI. Since the redirection can change over tim

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

2013-05-05 Thread Giuseppe Scrivano
Darshit Shah writes: >while I agree that your patch makes the code more readable and it is > > good to apply it, I don't see how the previous version was broken. > What > compiler have you used? > >I see you pushed the patch. But have we gotten to the bottom of the >cau

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

2013-05-05 Thread Darshit Shah
> > while I agree that your patch makes the code more readable and it is > good to apply it, I don't see how the previous version was broken. What > compiler have you used? > > I see you pushed the patch. But have we gotten to the bottom of the cause? If the result changes with the GCC version, we

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

2013-05-05 Thread Giuseppe Scrivano
Darshit Shah writes: > I also think some more explicit sanity checks are needed in the code. > Like sending data with a HEAD request makes absolutely no sense (does > it?). no, it doesn't, same for GET. -- Giuseppe

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

2013-05-04 Thread Darshit Shah
Hi Giuseppe, while I agree that your patch makes the code more readable and it is > good to apply it, I don't see how the previous version was broken. What > compiler have you used? > This occurs when compiling on gcc 4.8.0. The following output ensues: Setting --method (method) to head DEBUG o

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

2013-05-04 Thread Giuseppe Scrivano
Hi Darshit, Darshit Shah writes: > The patch supplied by you adding cmd_uppercase_String seems to break > the header generation since (*q++) causes the pointer to increment > before the c_toupper() method returns. > > We should instead increment it only after the statement successfully > retur

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

2013-05-04 Thread Darshit Shah
Hi Giuseppe, The patch supplied by you adding cmd_uppercase_String seems to break the header generation since (*q++) causes the pointer to increment before the c_toupper() method returns. We should instead increment it only after the statement successfully returns. I have also converted the loop

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

2013-05-02 Thread Giuseppe Scrivano
Daniel Stenberg writes: > On Thu, 2 May 2013, Giuseppe Scrivano wrote: > >> RFC 2606 doesn't seem very clear about it, and I can't find anywhere >> that PUT/OPTIONS/ANYTHING should be handled differently than POST >> wrt redirections. I don't see why suspending a PUT request would be >> incorrec

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

2013-05-01 Thread Daniel Stenberg
On Thu, 2 May 2013, Giuseppe Scrivano wrote: RFC 2606 doesn't seem very clear about it, and I can't find anywhere that PUT/OPTIONS/ANYTHING should be handled differently than POST wrt redirections. I don't see why suspending a PUT request would be incorrect. Darshit, do you have any pointer?

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

2013-05-01 Thread Giuseppe Scrivano
Gijs van Tulder writes: > Hi Darshit, > > Darshit Shah wrote: >> Unless we explicitly check for opt.method = POST, this will cause a lot >> of issues. Since the macro is being called on every redirect, even >> HEAD/PUT/OPTIONS headers will get suspended to give way to GET. That is >> not the beha

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

2013-05-01 Thread Gijs van Tulder
Hi Darshit, Darshit Shah wrote: > Unless we explicitly check for opt.method = POST, this will cause a lot > of issues. Since the macro is being called on every redirect, even > HEAD/PUT/OPTIONS headers will get suspended to give way to GET. That is > not the behaviour we want. Ah, I see it's mor

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

2013-05-01 Thread Darshit Shah
> > Still, even if the sanitization is removed: I think it would be better if > RESTORE_POST_DATA restores the previous value of opt.method, instead of > overwriting it with a hardcoded "POST". Isn't it? > > As double safety yes. Maybe we should do that. > A related question: how is a redirect re

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

2013-05-01 Thread Gijs van Tulder
Hi Giuseppe, Dropping the bit that sanitizes the opt.method is probably a good idea. (Perhaps I shouldn't have replied to your patch directly.) Still, even if the sanitization is removed: I think it would be better if RESTORE_POST_DATA restores the previous value of opt.method, instead of ov

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

2013-05-01 Thread Darshit Shah
On Thu, May 2, 2013 at 12:56 AM, Gijs van Tulder wrote: > 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 > Unless we explicitly check for

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

2013-05-01 Thread Giuseppe Scrivano
hi Gijs, Gijs van Tulder writes: > 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? thanks for your suggestion but I think we should drop the code t

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

2013-05-01 Thread Gijs van Tulder
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

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

2013-05-01 Thread Tim Rühsen
Am Mittwoch, 1. Mai 2013 schrieb Darshit Shah: > First, sorry for the quick and dirty hack which was the perfect example of > how NOT to do things. Than it was a good example ;-) > Secondly, it lies upon me that this feature wasn't tested before submitting > the patch. I had however relied on the

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

2013-05-01 Thread Giuseppe Scrivano
Darshit Shah writes: > I am fixing this issue, but it is a terribly ugly hack. If someone could > help improve it I'd be most truly grateful. > I have a couple of ideas, but I will need to work them out and implement > them when I have the time. > > The reason it has to be so ugly is that, we can

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

2013-05-01 Thread Darshit Shah
Couple of things. First, sorry for the quick and dirty hack which was the perfect example of how NOT to do things. Secondly, it lies upon me that this feature wasn't tested before submitting the patch. I had however relied on the Test Environment and since it passed everything there, I thought it

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

2013-04-30 Thread Tim Rühsen
Hi Darshit, I understand that your patch was just a quick hack. But even than you should avoid doing opt.method == "POST" for string comparisons. This definitely not portable. Not every compiler/linker aggregates two occurrences of the same static string into one address in memory. You

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

2013-04-30 Thread Stefano Lattarini
On 04/30/2013 07:01 PM, Darshit Shah wrote: > Okay, I could not prevent myself from looking into it. > > It seems as if the SUSPEND_POST_DATA macro was being called during a > recursive download attempt. > > Attaching a hack around the situation. Will look more deeply when I have > more time to i

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

2013-04-30 Thread Darshit Shah
Okay, I could not prevent myself from looking into it. It seems as if the SUSPEND_POST_DATA macro was being called during a recursive download attempt. Attaching a hack around the situation. Will look more deeply when I have more time to identify what caused the regression. On Tue, Apr 30, 2013

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

2013-04-30 Thread Darshit Shah
I'm in the middle of University exams at the moment. I'll still have a look at it tomorrow when I get a breather. However, it looks like wget is converting any method to a POST request which is weird since that should have caused it to fail most of the tests. I'll have to look into it and check w

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

2013-04-30 Thread Tim Ruehsen
Hi, you can even reproduce it with a simple wget -r http://translationproject.org/latest/make Darshit, maybe you can have a look at it. It has something to do with opt.method (set to read-only "POST" in http.c, line 1772). Even with --method=GET opt.method points to "POST". And the code

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

2013-04-30 Thread Stefano Lattarini
Here is the reproducer: $ wget --passive-ftp -nv --recursive --level=1 --no-directories --no-parent \ --no-check-certificate -A '*.po' http://translationproject.org/latest/make 2013-04-30 16:41:25 URL:https://translationproject.org/latest/make/ [5489/5489] -> "make" [1] Segmentati