• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

User-Agent being null

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I came across a strange scenario where user-agent is coming null and due to which our application is breaking. It is strange for me for user-agent being null.
Please clarify the below queries.
1) What are the cases when user-agent will be null for a web client?
2) Is user-agent being null according to W3C standards?

I'm not sure if this is the place this query has to be posted. Can any one of you please help me out with the clarification. It would be really greatful!!!

Thanks in Advance.
~ Sandeep.
 
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I know if someone is running a program to crawl your web site, in such a case user-agent header may not be set.
Even some web stripping software may allow to change the user-agent and even not set it.

It could also be some one is running a malicious program to scrape your site.
It could be someone is running a diagnostic program checking your site.
It could be a search engine indexing your site (I think most search engines would include some kind of identification in the user-agent header).

The http 1.1 specification says "User agents SHOULD include this field with requests."
The link is here

There could be other reasons why such a thing could happen..
 
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some browsers (or browser extensions) allow people to suppress the header from being sent, or an arbitrary value to be sent. This is sometimes used when badly developed web sites exclude users based on which browser they use.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can never expect the User-Agent header to be set, or to be set truthfully. If you're application depends upon this header being set and being truthful, you are in a lot of trouble.
 
What's that smell? I think this tiny ad may have stepped in something.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic