Bug 82041

Summary: [BlackBerry]Missing cookies from HTTP response header in Network tab of Web Inspector.
Product: WebKit Reporter: Jason Liu <jasonliuwebkit>
Component: WebKit BlackBerryAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: joenotcharles, kpiascik, leo.yang, rwlbuis, staikos, tonikitoo, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: Other   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Jason Liu
Reported 2012-03-23 03:44:48 PDT
These cookies are been set, it's only missing from the web inspector.
Attachments
Patch (1.81 KB, patch)
2012-03-23 04:02 PDT, Jason Liu
no flags
Patch (1.81 KB, patch)
2012-03-26 02:36 PDT, Jason Liu
no flags
Patch (1.84 KB, patch)
2012-03-26 18:44 PDT, Jason Liu
no flags
Jason Liu
Comment 1 2012-03-23 04:02:22 PDT
Leo Yang
Comment 2 2012-03-25 22:50:24 PDT
Comment on attachment 133455 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=133455&action=review > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > + > + if (m_response.httpHeaderFields().contains("Set-Cookie")) > + return m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); m_response.setHTTPHeaderField(key, value) has been called at the end of this function. Why this is needed here? Are you trying to catenate all 'Set-Cookie' headers to one?
Jason Liu
Comment 3 2012-03-25 22:52:32 PDT
(In reply to comment #2) > (From update of attachment 133455 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=133455&action=review > > > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > > + > > + if (m_response.httpHeaderFields().contains("Set-Cookie")) > > + return m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); > > m_response.setHTTPHeaderField(key, value) has been called at the end of this function. Why this is needed here? Are you trying to catenate all 'Set-Cookie' headers to one? Yes, I catenate them so that overwrite doesn't happen.
Leo Yang
Comment 4 2012-03-25 23:19:34 PDT
(In reply to comment #3) > (In reply to comment #2) > > (From update of attachment 133455 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=133455&action=review > > > > > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > > > + > > > + if (m_response.httpHeaderFields().contains("Set-Cookie")) > > > + return m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); > > > > m_response.setHTTPHeaderField(key, value) has been called at the end of this function. Why this is needed here? Are you trying to catenate all 'Set-Cookie' headers to one? > > Yes, I catenate them so that overwrite doesn't happen. But you are setting "Set-Cookie" header twice for the first "Set-Cookie" header, which is a waste. Why use "\r\n" as delimiter? What do the other ports use?
Jason Liu
Comment 5 2012-03-26 02:36:24 PDT
Leo Yang
Comment 6 2012-03-26 02:47:19 PDT
(In reply to comment #4) > (In reply to comment #3) > > (In reply to comment #2) > > > (From update of attachment 133455 [details] [details] [details]) > > > View in context: https://bugs.webkit.org/attachment.cgi?id=133455&action=review > > > > > > > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > > > > + > > > > + if (m_response.httpHeaderFields().contains("Set-Cookie")) > > > > + return m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); > > > > > > m_response.setHTTPHeaderField(key, value) has been called at the end of this function. Why this is needed here? Are you trying to catenate all 'Set-Cookie' headers to one? > > > > Yes, I catenate them so that overwrite doesn't happen. > > But you are setting "Set-Cookie" header twice for the first "Set-Cookie" header, which is a waste. Why use "\r\n" as delimiter? What do the other ports use? Never mind, you returned. But is "\r\n" the best delimiter? How other ports deal with this case?
Konrad Piascik
Comment 7 2012-03-26 06:55:20 PDT
> Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > + return m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); why do you return a value from a void method?
Jason Liu
Comment 8 2012-03-26 18:44:44 PDT
Jason Liu
Comment 9 2012-03-26 18:48:08 PDT
(In reply to comment #7) > > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > > + return m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); > > why do you return a value from a void method? Sorry, I forgot updating yesterday.
Konrad Piascik
Comment 10 2012-03-26 18:59:01 PDT
> Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > + m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); I still would like to know about the delimiter, as Leo mentioned. Can you tell us whether the delimiter of \r\n is a good choice and if other ports use it?
Jason Liu
Comment 11 2012-03-26 19:21:20 PDT
(In reply to comment #10) > > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > > + m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); > > I still would like to know about the delimiter, as Leo mentioned. Can you tell us whether the delimiter of \r\n is a good choice and if other ports use it? I am compiling QT. Trying to find QT's implementation.
Jason Liu
Comment 12 2012-03-26 20:01:20 PDT
(In reply to comment #11) > (In reply to comment #10) > > > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > > > + m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); > > > > I still would like to know about the delimiter, as Leo mentioned. Can you tell us whether the delimiter of \r\n is a good choice and if other ports use it? > > I am compiling QT. Trying to find QT's implementation. Qt uses comma(",") to separate them.
Leo Yang
Comment 13 2012-03-26 20:12:44 PDT
(In reply to comment #12) > (In reply to comment #11) > > (In reply to comment #10) > > > > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > > > > + m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); > > > > > > I still would like to know about the delimiter, as Leo mentioned. Can you tell us whether the delimiter of \r\n is a good choice and if other ports use it? > > > > I am compiling QT. Trying to find QT's implementation. > > Qt uses comma(",") to separate them. Where does qt porting do this? Network stack? or WebCore?
Jason Liu
Comment 14 2012-03-26 20:17:42 PDT
(In reply to comment #12) > (In reply to comment #11) > > (In reply to comment #10) > > > > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > > > > + m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); > > > > > > I still would like to know about the delimiter, as Leo mentioned. Can you tell us whether the delimiter of \r\n is a good choice and if other ports use it? > > > > I am compiling QT. Trying to find QT's implementation. > > Qt uses comma(",") to separate them. But Qt's inspector doesn't show ",". Qt's inspector: Set-Cookie:cookieONE=ONE; expires=Tue, 27-Mar-2012 04:11:32 GMT cookieTWO=TWO; expires=Tue, 27-Mar-2012 04:11:32 GMT cookieTHREE=THREE; expires=Tue, 27-Mar-2012 04:11:32 GMT cookieFOUR=FOUR; expires=Tue, 27-Mar-2012 04:11:32 GMT Playbook's inspector(using ","): Set-Cookie:cookieONE=ONE; expires=Tue, 27-Mar-2012 04:09:22 GMT,cookieTWO=TWO; expires=Tue, 27-Mar-2012 04:09:22 GMT,cookieTHREE=THREE; expires=Tue, 27-Mar-2012 04:09:22 GMT,cookieFOUR=FOUR; expires=Tue, 27-Mar-2012 04:09:22 GMT I think "\r\n" looks better for our code.
Jason Liu
Comment 15 2012-03-26 20:18:20 PDT
(In reply to comment #13) > (In reply to comment #12) > > (In reply to comment #11) > > > (In reply to comment #10) > > > > > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > > > > > + m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); > > > > > > > > I still would like to know about the delimiter, as Leo mentioned. Can you tell us whether the delimiter of \r\n is a good choice and if other ports use it? > > > > > > I am compiling QT. Trying to find QT's implementation. > > > > Qt uses comma(",") to separate them. > > Where does qt porting do this? Network stack? or WebCore? Network stack.
Jason Liu
Comment 16 2012-03-28 00:09:42 PDT
(In reply to comment #15) > (In reply to comment #13) > > (In reply to comment #12) > > > (In reply to comment #11) > > > > (In reply to comment #10) > > > > > > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > > > > > > + m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); > > > > > > > > > > I still would like to know about the delimiter, as Leo mentioned. Can you tell us whether the delimiter of \r\n is a good choice and if other ports use it? > > > > > > > > I am compiling QT. Trying to find QT's implementation. > > > > > > Qt uses comma(",") to separate them. > > > > Where does qt porting do this? Network stack? or WebCore? > > Network stack. "\r\n" or "," (In reply to comment #14) > (In reply to comment #12) > > (In reply to comment #11) > > > (In reply to comment #10) > > > > > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > > > > > + m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); > > > > > > > > I still would like to know about the delimiter, as Leo mentioned. Can you tell us whether the delimiter of \r\n is a good choice and if other ports use it? > > > > > > I am compiling QT. Trying to find QT's implementation. > > > > Qt uses comma(",") to separate them. > > But Qt's inspector doesn't show ",". > Qt's inspector: > Set-Cookie:cookieONE=ONE; expires=Tue, 27-Mar-2012 04:11:32 GMT > cookieTWO=TWO; expires=Tue, 27-Mar-2012 04:11:32 GMT > cookieTHREE=THREE; expires=Tue, 27-Mar-2012 04:11:32 GMT > cookieFOUR=FOUR; expires=Tue, 27-Mar-2012 04:11:32 GMT > > Playbook's inspector(using ","): > Set-Cookie:cookieONE=ONE; expires=Tue, 27-Mar-2012 04:09:22 GMT,cookieTWO=TWO; expires=Tue, 27-Mar-2012 04:09:22 GMT,cookieTHREE=THREE; expires=Tue, 27-Mar-2012 04:09:22 GMT,cookieFOUR=FOUR; expires=Tue, 27-Mar-2012 04:09:22 GMT > > I think "\r\n" looks better for our code. "\r\n" or "," only affect inspector's showing.
Rob Buis
Comment 17 2012-03-28 04:17:03 PDT
Comment on attachment 133958 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=133958&action=review > Source/WebCore/ChangeLog:6 > + We shouldn't overwrite cookies of response if there are more than one Don't you mean "one or more"? > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:318 > + if (m_response.httpHeaderFields().contains("Set-Cookie")) { Is there an AtomicString/static String for Set-Cookie? > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > + m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); Is "\r\n" used like that all the time? Any constants?
Jason Liu
Comment 18 2012-03-28 19:07:17 PDT
(In reply to comment #17) > (From update of attachment 133958 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=133958&action=review > > > Source/WebCore/ChangeLog:6 > > + We shouldn't overwrite cookies of response if there are more than one > > Don't you mean "one or more"? > > > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:318 > > + if (m_response.httpHeaderFields().contains("Set-Cookie")) { > > Is there an AtomicString/static String for Set-Cookie? > > > Source/WebCore/platform/network/blackberry/NetworkJob.cpp:319 > > + m_response.setHTTPHeaderField(key, m_response.httpHeaderField(key) + "\r\n" + value); > > Is "\r\n" used like that all the time? Any constants? 1. I mean the second cookie shouldn't overwrite the first one of response. 2. No, there isn't. 3. "\r\n" is only used in this special case.
Rob Buis
Comment 19 2012-03-28 19:26:10 PDT
Comment on attachment 133958 [details] Patch Looks good.
WebKit Review Bot
Comment 20 2012-03-28 19:33:05 PDT
Comment on attachment 133958 [details] Patch Clearing flags on attachment: 133958 Committed r112494: <http://trac.webkit.org/changeset/112494>
WebKit Review Bot
Comment 21 2012-03-28 19:33:11 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.