Closed Bug 766159 Opened 14 years ago Closed 14 years ago

User-Agent ProductSub depends on whether logging is enabled

Categories

(Core :: Networking: HTTP, defect)

16 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: mcmanus, Assigned: mcmanus)

Details

Attachments

(1 file)

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.
Attached patch patch 0 — — Splinter Review
Attachment #634469 - Flags: review?(jduell.mcbugs)
Attachment #634469 - Flags: review?(jduell.mcbugs) → review+
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
Target Milestone: --- → mozilla16
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: