RESOLVED FIXED 177373
[Curl] Refactor and improve methods in the CurlHandle
https://bugs.webkit.org/show_bug.cgi?id=177373
Summary [Curl] Refactor and improve methods in the CurlHandle
Basuke Suzuki
Reported 2017-09-22 11:46:46 PDT
Cleanup method name, consistent naming, remove unused feature, better enum naming, etc.
Attachments
patch (15.88 KB, patch)
2017-09-25 11:52 PDT, Basuke Suzuki
achristensen: review-
achristensen: commit-queue-
fix (16.10 KB, patch)
2017-09-25 12:43 PDT, Basuke Suzuki
no flags
Basuke Suzuki
Comment 1 2017-09-25 11:52:31 PDT
Alex Christensen
Comment 2 2017-09-25 12:14:14 PDT
Comment on attachment 321714 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=321714&action=review > Source/WebCore/platform/network/curl/CurlContext.cpp:263 > + m_handle = nullptr; It's probably not necessary to set m_handle to nullptr in the destructor. > Source/WebCore/platform/network/curl/CurlContext.cpp:345 > +void CurlHandle::removeRequestHeader(const String& name) > +{ > + // Add a header with no content, the internally used header will get disabled. > + String header(name); > + header.append(":"); > + > appendRequestHeader(header); This is very confusing. Are we removing or appending? We should definitely call it something else. > Source/WebCore/platform/network/curl/CurlContext.cpp:354 > +void CurlHandle::appendRequestHeader(const String& header, bool appendOnly) > { > m_requestHeaders.append(header); > + > + if (!appendOnly) > + enableRequestHeaders(); > } I think adding this bool indicates that we've got the responsibilities of these functions all wrong.
Basuke Suzuki
Comment 3 2017-09-25 12:43:54 PDT
Basuke Suzuki
Comment 4 2017-09-25 12:44:06 PDT
Thank you. I've fixed.
Basuke Suzuki
Comment 5 2017-09-25 13:27:05 PDT
> > Source/WebCore/platform/network/curl/CurlContext.cpp:345 > > +void CurlHandle::removeRequestHeader(const String& name) > > +{ > > + // Add a header with no content, the internally used header will get disabled. > > + String header(name); > > + header.append(":"); > > + > > appendRequestHeader(header); > > This is very confusing. Are we removing or appending? We should definitely > call it something else. This is the libcurl's spec. If we need to delete the pre appended header including the default prepared one, we need to append empty value header to the list. The original code has used that behavior directly, so we've added a meaningful method and hide the detail inside.
Basuke Suzuki
Comment 6 2017-09-25 13:28:47 PDT
(In reply to Alex Christensen from comment #2) > Comment on attachment 321714 [details] > patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=321714&action=review > > > Source/WebCore/platform/network/curl/CurlContext.cpp:263 > > + m_handle = nullptr; > > It's probably not necessary to set m_handle to nullptr in the destructor. removed. Also removed from other class's destructors. > > Source/WebCore/platform/network/curl/CurlContext.cpp:354 > > +void CurlHandle::appendRequestHeader(const String& header, bool appendOnly) > > { > > m_requestHeaders.append(header); > > + > > + if (!appendOnly) > > + enableRequestHeaders(); > > } > > I think adding this bool indicates that we've got the responsibilities of > these functions all wrong. removed that flag argument and handle the situation internally.
WebKit Commit Bot
Comment 7 2017-09-25 16:24:48 PDT
Comment on attachment 321723 [details] fix Clearing flags on attachment: 321723 Committed r222479: <http://trac.webkit.org/changeset/222479>
WebKit Commit Bot
Comment 8 2017-09-25 16:24:53 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9 2017-09-27 12:17:32 PDT
Note You need to log in before you can comment on or make changes to this bug.