Bug 21211 - [CURL] Upload doesn't work because cancel is called
Summary: [CURL] Upload doesn't work because cancel is called
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Major
Assignee: Marco Barisione
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2008-09-29 07:27 PDT by Marco Barisione
Modified: 2008-10-15 13:55 PDT (History)
1 user (show)

See Also:


Attachments
Don't call cancel if the upload was successful (3.03 KB, patch)
2008-09-29 07:42 PDT, Marco Barisione
zecke: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Barisione 2008-09-29 07:27:36 PDT
When uploading a file with the curl backend cancel is always called at the end of the upload, so the file has been uploaded, the response has been received from the server but no result is shown.
Comment 1 Marco Barisione 2008-09-29 07:42:06 PDT
Created attachment 23907 [details]
Don't call cancel if the upload was successful

FormDataStream::read() returns 0 when retrieving data from the form fails, but also when there is no more data to send. This means that cancel is always called even when the data was successfully sent.
Comment 2 Amit 2008-10-07 02:51:25 PDT
This patch prevents cancellation of a request, but still does not successfully upload the file.
Here is what I tried,
open rapidshare.com and try uploading a file.
I observed the HTTP traffic and noticed that POST packet is not seen, i.e. nothing is posted to the server!
Comment 3 Marco Barisione 2008-10-07 17:37:05 PDT
(In reply to comment #2)
> This patch prevents cancellation of a request, but still does not successfully
> upload the file.
> Here is what I tried,
> open rapidshare.com and try uploading a file.
> I observed the HTTP traffic and noticed that POST packet is not seen, i.e.
> nothing is posted to the server!

Really? I tried it and upload was working even before. What doesn't work is showing the page you get after you upload a file.
I suspect that your problem could be a separate issue, I will test it in the next days.

Comment 4 Amit 2008-10-13 00:13:02 PDT
I merged the latest code in my code and it is able POST the contents successfully now. The problem which you mentioned that next page is not displayed, when I included the patch that is provided for this bug with the latest code the code started working fine.
So I think if you merge the patch for this bug in the latest code uploading will work fine!
Comment 5 Holger Freyther 2008-10-15 13:29:12 PDT
Comment on attachment 23907 [details]
Don't call cancel if the upload was successful

Sounds reasonable. The only complain would be to always put the Vector on the stack. In the majority of code we have early exits. e.g
  if (!httpBody())
    return false;

  return m_formDataElementIndex < m_resourceHandle()->request().httpBody()->elements().size();

but this is no hard requirement but something to keep in mind.
Comment 6 Holger Freyther 2008-10-15 13:38:54 PDT
Okay this does not even compile because of the const, non-const mismatch. I will land a compiling version.
Comment 7 Holger Freyther 2008-10-15 13:55:02 PDT
The patch was applied. Closing this bug.