`
logicgate
  • 浏览: 97727 次
  • 性别: Icon_minigender_1
  • 来自: 新力吐皮
社区版块
存档分类
最新评论

Underscore in host name or domain name not allowed

    博客分类:
  • Java
阅读更多

Last week when I was deploying the system in customer's company I encountered a very strange problem: the objects stored in session sometimes lost due to unknown reason。My environment is windows 2003 server+tomcat+Internet Explorer.

 

As I know,servlet's session normally relies on two mechanisms, cookies , or url rewriting . If cookies are disabled, then we must use response.encodeURL to append jsessionid to url. After some study, I found that my problem is due to the browser can not accept cookies or the server does not send cookies, therefore after page forwarding without encodeURL the system failed to retrieve objects stored in session previously.

 

Then I checked the setting of browser, cookies are still allowed. Also, in tomcat's context setting, cookies are still set to "true", that means both client and server do not explicitly disable the cookies. So, what caused my cookies can not work properly?

 

I spent whole afternoon to research on this issue, finally I found the reason. The reason is that my host name contains an underscore ("_") thus it's invalid. Due to the invalid host name, cookies are never created by browser.

 

This error occurs when using Internet Explorer 5.5 and 6.0 or later with the Microsoft Patch MS01-055. When Internet Explorer is updated, it then becomes compliant with RFC 952 , which defines and restricts host and domain naming conventions. This compliance is to avoid certain security vulnerabilities with session cookies, as explained in this Microsoft Knowledge Base Article #316112 excerpt:

"A potential security vulnerability exists in Internet Explorer versions 5.5 and 6.0 in which a malicious user could create a URL that allows a Web site to gain unauthorized access to cookies that are stored on a client computer and then (potentially) modify the values that are contained in these cookies. Because some Web sites use cookies that are stored on client computers to store sensitive information, this security vulnerability could expose personal information. Security patch MS01-055 corrects this security vulnerability by preventing servers with improper name syntax from setting cookies names."

The RFC 952 document defines the proper syntax for a host/domain name.

"A "name" (Net, Host, Gateway, or Domain name) is a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-), and period (.). Note that periods are only allowed when they serve to delimit components of "domain style names". (See RFC-921, "Domain Name System Implementation Schedule", for background). No blank or space characters are permitted as part of a name. No distinction is made between upper and lower case.

 

There are several workarounds:

 

1. change the fully qualified host name of the server so that it is compliant with RFC 952.

2. use IP address instead of host name

3. use URL rewrite for cookies

 

Finally, I changed my host name and the problem was solved.

分享到:
评论

相关推荐

    Learning Underscore.js

    Understand and learn to apply functional programming principles using the built-in functions of Underscore.js Leverage and reuse Underscore.js-based code to create code that targets client, server, or...

    Learning Underscore.js(PACKT,2015)

    Underscore.js is one of the most popular ... You’ll also learn how to use Underscore.js as a base for your own modules and libraries within an object-oriented or functional programming style...

    underscore应用

    《深入理解underscore应用》 underscore.js,简称下划线或_,是一款轻量级的JavaScript实用库,它提供了一系列高效、实用的函数,用于处理数组、对象、字符串等各种数据类型,帮助开发者更方便地进行数据操作和函数...

    underscore.js 1.8.2

    underscore.js underscore.js underscore.js

    Underscore.php——Underscore.js的php移植版

    Underscore.js是目前最好用的Javascript工具包,提供了100多个函数。Underscore.php是Underscore.js的PHP移植版,并且实现了部分Underscore.js中的功能! 我花了一个月的时间将Underscore.php的文档翻译为中文,开源...

    underscore

    underscore js工具类,underscore为集合类对象提供了一致的接口

    underscore-1.6.0.zip

    《深入理解JavaScript库:underscore-1.6.0》 underscore.js是一款轻量级的JavaScript实用库,它为JavaScript开发提供了大量的实用函数,极大地增强了原生JavaScript对象的处理能力。在"underscore-1.6.0.zip"这个...

    underscore-min.js 1.8.3

    underscore-min.js

    underscore解析

    underscore源码解析

    Underscore1.8.3 参考手册.CHM

    Underscore1.8.3 参考手册.CHM,Underscore中文教程,Underscore离线手册

    underscore源码学习计划

    《深入剖析Underscore.js:源码学习指南》 Underscore.js,作为一个轻量级的JavaScript实用库,为开发者提供了丰富的函数式编程工具,帮助我们处理日常开发中的各种问题。其简洁的代码和强大的功能使得它在...

    underscore-1.4.3.zip

    《深入理解Underscore.js 1.4.3:核心概念与实践》 Underscore.js,一个轻量级的JavaScript实用库,以其强大的工具集和对JavaScript原生功能的补充,深受开发者喜爱。在本篇文章中,我们将深入探讨Underscore 1.4.3...

    underscore.js帮助文档

    Underscore.js是一款轻量级的JavaScript实用库,它提供了许多功能强大的函数,用于处理数组、对象、函数等,极大地增强了JavaScript的编程体验。在深入理解这个库之前,我们需要了解其核心理念:提供一套一致的方法...

    underscore.js api文档 chm

    underscore.js api文档 chm

    Underscore javascript库 使用教程.zip

    underscore javascript库 使用教程.zip

    Underscore.js 中文文档

    1.2.3的Underscore中文文档,采用网页版压缩制成的chm文件,方便查看,方便点击链接

    underscore.js源码

    underscore.js源码,适合初始化学习javascript,强烈推荐

Global site tag (gtag.js) - Google Analytics