The default bug view has changed. See this FAQ.

User-Agent ProductSub depends on whether logging is enabled

RESOLVED FIXED in mozilla16

Status

()

Core
Networking: HTTP
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: mcmanus, Assigned: mcmanus)

Tracking

16 Branch
mozilla16
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
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.
(Assignee)

Comment 1

5 years ago
Created attachment 634469 [details] [diff] [review]
patch 0
Attachment #634469 - Flags: review?(jduell.mcbugs)
Attachment #634469 - Flags: review?(jduell.mcbugs) → review+
(Assignee)

Comment 2

5 years ago
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
https://hg.mozilla.org/mozilla-central/rev/e1e34d0f5a31
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.