Hash ("#") in "Location"-HTTP-header - problems with IE

A

alexnb

Hello,

Can anyone help on the follwing problem:

The serverside (e.g. a Java-Servlet) sends this HTTP-header:

"Location: http://myhost/page.jsp?param1=value1#xyz"

Mozilla,Opera reacts with the follwing GET:
GET http://myhost/page.jsp?param1=value1

_BUT_ the Internet Explorer
GET http://myhost/page.jsp?param1=value1#xyz

In case of IE this leads to:
request.getParameter("param1") == "value1#xyz"

Question 1: is it allowed to use # in Location-header?

Question 2: shouldn't the servlet engine cut the #-part of the URL
off??

Thanks,
Alex
 
A

A. Bolmarcich

Hello,

Can anyone help on the follwing problem:

The serverside (e.g. a Java-Servlet) sends this HTTP-header:

"Location: http://myhost/page.jsp?param1=value1#xyz"

Mozilla,Opera reacts with the follwing GET:
GET http://myhost/page.jsp?param1=value1

_BUT_ the Internet Explorer
GET http://myhost/page.jsp?param1=value1#xyz

In case of IE this leads to:
request.getParameter("param1") == "value1#xyz"

Question 1: is it allowed to use # in Location-header?

No. According to the Hypertext Transfer Protocol -- HTTP/1.1 document
(see http://www.faqs.org/rfcs/rfc2616.html), the value of the Location
header is an absoluteURI. According to the Uniform Resource Identifiers
(URI): Generic Syntax document (see http://www.faqs.org/rfcs/rfc2396.html)
an absoluteURI may not contain a "#" character.

According to that document a URI-reference may contat a "#" character;
a URI-reference has the form

[ absoluteURI | relativeURI ] [ "#" fragment ]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top