Opened 4 years ago

Closed 4 years ago

#12262 closed enhancement (fixed)

Changes to User Agent to Include a Version of the Application

Reported by: apl-haiku Owned by: waddlesplash
Priority: normal Milestone: Unscheduled
Component: Applications/HaikuDepot Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: yes Platform: All


The User-Agent HTTP header is presently "X-HDS-Client", but should be "HaikuDepot/x.y.z" where "x.y.z" is the version of the HaikuDepot application. Stephan; are you able to see if this is OK for me?

Attachments (1)

0001-HaikuDepot-enhancements-to-the-User-Agent-header-to-.patch (5.0 KB ) - added by apl-haiku 4 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by apl-haiku, 4 years ago

Has a Patch: set

comment:2 by korli, 4 years ago

Several checks are missing. For instance:

if (file.InitCheck() == B_OK) {

It's also better when you can exactly include what you need instead of StorageKit.h or AppKit.h.

Also the default constructor is automatically called:

BString WebAppInterface::fUserAgent; 
BLocker WebAppInterface::fUserAgentLocker; 

What I don't understand is why you don't build the user agent string on WebAppInterface construction, instead of lazily. Also why the static keyword? Are there several WebAppInterface instances involved?

comment:3 by apl-haiku, 4 years ago

I'm building the user agent string as a static member variable because the "WebAppInterface" is instantiated in more than one place in the application and I don't want it to be encumbered with the overhead of reading the application version each time.

I've expanded the includes and added more checks for error states. I've also re-arranged the code a bit to make the error handling less onerous around deriving the version string through early-exit.

Patch re-attached.

comment:4 by apl-haiku, 4 years ago

Sorry - somehow the last iteration of the patch was the wrong version. I have re-attached the updated patch now.

comment:5 by waddlesplash, 4 years ago

Owner: changed from stippi to waddlesplash
Status: newin-progress

comment:6 by waddlesplash, 4 years ago

Resolution: fixed
Status: in-progressclosed

Applied in hrev49515. Thanks!

Note: See TracTickets for help on using tickets.