Last Comment Bug 766159 - User-Agent ProductSub depends on whether logging is enabled
: User-Agent ProductSub depends on whether logging is enabled
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Networking: HTTP (show other bugs)
: 16 Branch
: x86_64 Linux
: -- normal (vote)
: mozilla16
Assigned To: Patrick McManus [:mcmanus]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-19 09:16 PDT by Patrick McManus [:mcmanus]
Modified: 2012-06-21 04:04 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch 0 (2.10 KB, patch)
2012-06-19 09:27 PDT, Patrick McManus [:mcmanus]
jduell.mcbugs: review+
Details | Diff | Review

Description Patrick McManus [:mcmanus] 2012-06-19 09:16:42 PDT
the user-agent string is constructed on a first-time-used basis from http://mxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/nsHttpHandler.cpp#514

It depends on a bunch of member variables being setup correctly, including mProductSub.. That one is set on line 287 of ::Init().

unfortunately, on http://mxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/nsHttpHandler.cpp#276, there is an invocation of UserAgent() in a NSPR LOG(()) statement. If that is executed (only when logging is enabled), the string is constructed and cached for future use without mProductSub being initialized.

The result is different UA with and without logging. bad news.

logging: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/ Firefox/16.0a1
no-logging: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/16.0 Firefox/16.0a1

The plus.google.com URL /u/0/_/notifications/frame for some reason is quite sensitive to this - and returns 0 byte responses with large set-cookies for the logging version, and normal gzip'd responses for the no-logging version. The with-log version resulted in random save-as dialogs :(

To fix it, just move the log statement to after the initialization.
Comment 1 Patrick McManus [:mcmanus] 2012-06-19 09:27:26 PDT
Created attachment 634469 [details] [diff] [review]
patch 0
Comment 2 Patrick McManus [:mcmanus] 2012-06-20 14:24:55 PDT
Thanks jason - this is a small thing but knowing where those random save-as dialogs were coming from is a big deal to me!

https://hg.mozilla.org/integration/mozilla-inbound/rev/e1e34d0f5a31
Comment 3 Ed Morley [:emorley] 2012-06-21 04:04:24 PDT
https://hg.mozilla.org/mozilla-central/rev/e1e34d0f5a31

Note You need to log in before you can comment on or make changes to this bug.