WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
17754
[Curl] Implement ResourceHandle::loadResourceSynchronously
https://bugs.webkit.org/show_bug.cgi?id=17754
Summary
[Curl] Implement ResourceHandle::loadResourceSynchronously
Julien Chaffraix
Reported
2008-03-10 15:46:33 PDT
Currently we lack this method for synchronous request.
Attachments
First version
(8.18 KB, patch)
2008-03-10 16:08 PDT
,
Julien Chaffraix
no flags
Details
Formatted Diff
Diff
Updated patch
(8.58 KB, patch)
2008-03-17 13:14 PDT
,
Julien Chaffraix
zecke
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Julien Chaffraix
Comment 1
2008-03-10 16:08:11 PDT
Created
attachment 19644
[details]
First version Implement all the necessary operations using an easy handle and curl_easy_perform for 2 reasons : - curl_easy_perform blocks until the transfert is finished. - using the multi handle is tricky as we can be called from the multi Curl API (throught a didFinishLoading for example) and that would cause random crashes in Curl.
Holger Freyther
Comment 2
2008-03-12 02:19:16 PDT
The patch looks pretty good, so this is mostly food for thoughts: -startSync..Job well you do more than starting let us find a better name -there are at least two test cases for sync loading in loading/ IIRC, it would be cool if we start using them and you could verify that they work. - f we at some point have proper glib integration in curl, how would the sync handling change? The only technical issue I see: - I'm not sure your usage of the String() c'tor is the one you want. Using String(m_url) but then again the current code is broken in this respect with this: d->m_url = strdup(url.latin1().data()); also ResourceHandleInternal initialize's m_url to 0 and if we do not call startJob m_url will stay zero and then we can get a crash in the d'tor of the ResourceHandleInternal. But these two issues predate this bug. You might want to fix the encoding of m_url (or convince me why url.latin1() is always correct) and then update your ResourceError line and then land your patch.
Julien Chaffraix
Comment 3
2008-03-16 19:20:31 PDT
(In reply to
comment #2
)
> The patch looks pretty good, so this is mostly food for thoughts: > -startSync..Job well you do more than starting let us find a better name
The name was chosen to match the one of the asynchronous case but you are right here (I will switch to dispatchSynchronousJob).
> -there are at least two test cases for sync loading in loading/ IIRC, it > would be cool if we start using them and you could verify that they work.
Actually all synchronous XHR uses that methods so it resolves a lot of test cases in http/tests/xmlhttprequest (I have tested the patch thoroughly on those).
> - f we at some point have proper glib integration in curl, how would the > sync handling change? >
There should be very little modification : - we will always have to block WebKit main thread as it is already the case (to prevent for example continuing JavaScript execution during synchronous request) - As I have understood it, Curl is completely reentrant so having 2 threads polling it should not be an issue (if it is wrong then a small synchronization should be added).
> The only technical issue I see: > - I'm not sure your usage of the String() c'tor is the one you want. Using > String(m_url) but then again the current code is broken in this respect with > this: > > d->m_url = strdup(url.latin1().data()); also ResourceHandleInternal
IIRC the URL should be in plain ASCII with special characters escaped with %XX. If it is the case, there does not seem to be any appropriate encoder / decoder. It should be quite easy to add one (that could be shared somewhere else).
> initialize's m_url to 0 and if we do not call startJob m_url will stay zero and > then we can get a crash in the d'tor of the ResourceHandleInternal. But these > two issues predate this bug. >
No, i have moved the initialization of the handle (which include m_url) in the initiliaze() method. It is called in both cases so we should not have any issue.
> You might want to fix the encoding of m_url (or convince me why url.latin1() is > always correct) and then update your ResourceError line and then land your > patch. >
Julien Chaffraix
Comment 4
2008-03-17 13:14:52 PDT
Created
attachment 19846
[details]
Updated patch
> IIRC the URL should be in plain ASCII with special characters escaped with %XX. > If it is the case, there does not seem to be any appropriate encoder / decoder. > It should be quite easy to add one (that could be shared somewhere else).
Forget that part : the KURL constructor already escapes characters.
> You might want to fix the encoding of m_url (or convince me why url.latin1() is > always correct) and then update your ResourceError line and then land your > patch. >
I did some testing and the encoding seems right mainly due to the KURL constructor's escaping as mentioned above. Thus calling latin1() is only a way of having a char* (no character translation occurs in latin1() as the string is already in ASCII).
Julien Chaffraix
Comment 5
2008-03-17 13:16:17 PDT
Comment on
attachment 19644
[details]
First version Clear first patch review flag (forgot to mark it as obsolete).
Holger Freyther
Comment 6
2008-03-17 13:41:38 PDT
Comment on
attachment 19846
[details]
Updated patch The encoded URL should be ascii/latin1. We will find out sooner or later. We should really try to get the layout regression suite going...
Holger Freyther
Comment 7
2008-03-17 14:34:43 PDT
Yeah, landed in
r31109
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug