public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/14012] New: HttpURLConnection.setRequestProperty() is not case insensitive
@ 2004-02-04  6:17 k dot allan-gcc at au dot darkbluesea dot com
  2004-02-04  6:22 ` [Bug libgcj/14012] " k dot allan-gcc at au dot darkbluesea dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: k dot allan-gcc at au dot darkbluesea dot com @ 2004-02-04  6:17 UTC (permalink / raw)
  To: gcc-bugs

With Sun Javam the setRequestProperty() function is case insensitive.

For example on a default connection to http://apache.org/, the following request
header is sent by Sun java by default:
  GET / HTTP/1.1
  User-Agent: Java/1.4.1
  Host: apache.org
  Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
  Connection: keep-alive

And if you change the request by adding the following before getting the inpput
stream:
  conn.setRequestProperty("UsEr-AgEnT", "MyAgent/1.0");
Then the request is changed thusly:
  GET / HTTP/1.1
  UsEr-AgEnT: MyAgent/1.0
  Host: apache.org
  Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
  Connection: keep-alive

However with GCJ, the following headers are sent with the same request as above:
  GET / HTTP/1.1
  UsEr-AgEnT: MyAgent/1.0
  Content-type: application/x-www-form-urlencoded
  accept: */*
  Host: apache.org
  user-agent: gnu-libgcj/3.5.0 20040202 (experimental)
  Connection: Close

Now firstly, the lowercase format of the default headers defies convention,
anyone who is writing a client will be expecting the user-agent field to be
specified as "User-Agent".
Secondly the User-Agent field is sent twice, once in the mixed-case, and then
the default one is sent in lower case afterwards.
Thirdly, a "Content-type: application/x-www-form-urlencoded" header line is
added for no particular reason.

Further investigation reveals that the Sun engine, given the following set of
commands:
  conn.setRequestProperty("X-AgEnT", "Test 1");
  conn.setRequestProperty("x-aGeNt", "Test 2");
Ends up sending out a header line of:
  X-AgEnT: Test 2
Which has the key in the capitalization of the first line but the value is that
of the second line.

With the attached patch, GCJ will exhibit a more Sun java behaviour with respect
to setting/sending request properties.

The differences that exist between the GCJ and Sun implementations after this
patch are:
1) The "Host" line is sent before "User-Agent" line. This is consistent with the
behaviour of Mozilla (as a matter of fact, with this patch, all the standard
headers are output in Mozilla-like order)
2) The default "Accept" line has been changed to a more flexible:
    "text/xml,text/html;q=0.9,
     text/plain;q=0.8,
     video/x-mng,image/png,image/jpeg,image/gif;q=0.2,
     */*;q=0.1"

Maybe this last change is not suitable for everyone, and the Sun version of the
Accept line would be more preferred for the masses, but Sun didn't contain XML,
or PNG and that's what I'm using so that's what I put in. It's at least a
million times better than */* anyhow.

-- 
           Summary: HttpURLConnection.setRequestProperty() is not case
                    insensitive
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: k dot allan-gcc at au dot darkbluesea dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14012


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/14012] HttpURLConnection.setRequestProperty() is not case insensitive
  2004-02-04  6:17 [Bug libgcj/14012] New: HttpURLConnection.setRequestProperty() is not case insensitive k dot allan-gcc at au dot darkbluesea dot com
@ 2004-02-04  6:22 ` k dot allan-gcc at au dot darkbluesea dot com
  2004-02-04  6:59 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: k dot allan-gcc at au dot darkbluesea dot com @ 2004-02-04  6:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From k dot allan-gcc at au dot darkbluesea dot com  2004-02-04 06:22 -------
Created an attachment (id=5674)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5674&action=view)
Patch against gcc/libjava/gnu/java/net/protocol/http/Connection.java

This patch adds case insensitivity to HttpURLConnection requestProperties,
makes default headers output in the generally accepted proper case and
establishes some sanity to the order that common headers are sent in.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14012


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/14012] HttpURLConnection.setRequestProperty() is not case insensitive
  2004-02-04  6:17 [Bug libgcj/14012] New: HttpURLConnection.setRequestProperty() is not case insensitive k dot allan-gcc at au dot darkbluesea dot com
  2004-02-04  6:22 ` [Bug libgcj/14012] " k dot allan-gcc at au dot darkbluesea dot com
@ 2004-02-04  6:59 ` pinskia at gcc dot gnu dot org
  2004-06-27 16:20 ` mckinlay at redhat dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-04  6:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-04 06:59 -------
Confirm, patches for libjava should to both gcc-patches and java-patches after reading http://
gcc.gnu.org/contribute.html, note this might need to go into classpath also as libjava gets merged in 
from there.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-02-04 06:59:06
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14012


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/14012] HttpURLConnection.setRequestProperty() is not case insensitive
  2004-02-04  6:17 [Bug libgcj/14012] New: HttpURLConnection.setRequestProperty() is not case insensitive k dot allan-gcc at au dot darkbluesea dot com
  2004-02-04  6:22 ` [Bug libgcj/14012] " k dot allan-gcc at au dot darkbluesea dot com
  2004-02-04  6:59 ` pinskia at gcc dot gnu dot org
@ 2004-06-27 16:20 ` mckinlay at redhat dot com
  2005-01-07 22:43 ` konqueror at gmx dot de
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mckinlay at redhat dot com @ 2004-06-27 16:20 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |16229
              nThis|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14012


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/14012] HttpURLConnection.setRequestProperty() is not case insensitive
  2004-02-04  6:17 [Bug libgcj/14012] New: HttpURLConnection.setRequestProperty() is not case insensitive k dot allan-gcc at au dot darkbluesea dot com
                   ` (2 preceding siblings ...)
  2004-06-27 16:20 ` mckinlay at redhat dot com
@ 2005-01-07 22:43 ` konqueror at gmx dot de
  2005-01-11 20:20 ` cvs-commit at gcc dot gnu dot org
  2005-01-11 20:27 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: konqueror at gmx dot de @ 2005-01-07 22:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From konqueror at gmx dot de  2005-01-07 22:43 -------
I'm working on it. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |konqueror at gmx dot de
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14012


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/14012] HttpURLConnection.setRequestProperty() is not case insensitive
  2004-02-04  6:17 [Bug libgcj/14012] New: HttpURLConnection.setRequestProperty() is not case insensitive k dot allan-gcc at au dot darkbluesea dot com
                   ` (3 preceding siblings ...)
  2005-01-07 22:43 ` konqueror at gmx dot de
@ 2005-01-11 20:20 ` cvs-commit at gcc dot gnu dot org
  2005-01-11 20:27 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-01-11 20:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-01-11 20:20 -------
Subject: Bug 14012

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mkoch@gcc.gnu.org	2005-01-11 20:19:57

Modified files:
	libjava        : ChangeLog Makefile.am Makefile.in 
	libjava/gnu/java/net/protocol/http: Handler.java 
	libjava/javax/net/ssl: HttpsURLConnection.java 
Added files:
	libjava/gnu/java/net: BASE64.java EmptyX509TrustManager.java 
	                      LineInputStream.java 
	libjava/gnu/java/net/protocol/http: Authenticator.java 
	                                    ByteArrayRequestBodyWriter.java 
	                                    ByteArrayResponseBodyReader.java 
	                                    ChunkedInputStream.java 
	                                    Cookie.java 
	                                    CookieManager.java 
	                                    Credentials.java 
	                                    HTTPConnection.java 
	                                    HTTPDateFormat.java 
	                                    HTTPURLConnection.java 
	                                    Headers.java Request.java 
	                                    RequestBodyWriter.java 
	                                    Response.java 
	                                    ResponseBodyReader.java 
	                                    ResponseHeaderHandler.java 
	                                    SimpleCookieManager.java 
	libjava/gnu/java/net/protocol/http/event: ConnectionEvent.java 
	                                          ConnectionListener.java 
	                                          RequestEvent.java 
	                                          RequestListener.java 
Removed files:
	libjava/gnu/java/net/protocol/http: Connection.java 

Log message:
	2005-01-11  Michael Koch  <konqueror@gmx.de>
	
	PR libgcj/14012, PR libgcj/14013, PR libgcj/15157, PR libgcj/15509
	* gnu/java/net/BASE64.java,
	gnu/java/net/EmptyX509TrustManager.java,
	gnu/java/net/LineInputStream.java,
	gnu/java/net/protocol/http/Authenticator.java,
	gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java,
	gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java,
	gnu/java/net/protocol/http/ChunkedInputStream.java,
	gnu/java/net/protocol/http/Cookie.java,
	gnu/java/net/protocol/http/CookieManager.java,
	gnu/java/net/protocol/http/Credentials.java,
	gnu/java/net/protocol/http/HTTPConnection.java,
	gnu/java/net/protocol/http/HTTPDateFormat.java,
	gnu/java/net/protocol/http/HTTPURLConnection.java,
	gnu/java/net/protocol/http/Headers.java,
	gnu/java/net/protocol/http/Request.java,
	gnu/java/net/protocol/http/RequestBodyWriter.java,
	gnu/java/net/protocol/http/Response.java,
	gnu/java/net/protocol/http/ResponseBodyReader.java,
	gnu/java/net/protocol/http/ResponseHeaderHandler.java,
	gnu/java/net/protocol/http/SimpleCookieManager.java,
	gnu/java/net/protocol/http/event/ConnectionEvent.java,
	gnu/java/net/protocol/http/event/ConnectionListener.java,
	gnu/java/net/protocol/http/event/RequestEvent.java,
	gnu/java/net/protocol/http/event/RequestListener.java: New files.
	* gnu/java/net/protocol/http/Connection.java: Removed.
	* gnu/java/net/protocol/http/Handler.java,
	javax/net/ssl/HttpsURLConnection.java: Updated.
	* Makefile.am: Added new files and remove old ones.
	* Makefile.in: Regenerated.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3283&r2=1.3284
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/Makefile.am.diff?cvsroot=gcc&r1=1.434&r2=1.435
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/Makefile.in.diff?cvsroot=gcc&r1=1.464&r2=1.465
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/BASE64.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/EmptyX509TrustManager.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/LineInputStream.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/Authenticator.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/ChunkedInputStream.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/Cookie.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/CookieManager.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/Credentials.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/HTTPConnection.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/HTTPDateFormat.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/HTTPURLConnection.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/Headers.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/Request.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/RequestBodyWriter.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/Response.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/ResponseBodyReader.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/ResponseHeaderHandler.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/SimpleCookieManager.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/Handler.java.diff?cvsroot=gcc&r1=1.2&r2=1.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/Connection.java.diff?cvsroot=gcc&r1=1.23&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/event/ConnectionEvent.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/event/ConnectionListener.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/event/RequestEvent.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gnu/java/net/protocol/http/event/RequestListener.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/javax/net/ssl/HttpsURLConnection.java.diff?cvsroot=gcc&r1=1.1&r2=1.2



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14012


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/14012] HttpURLConnection.setRequestProperty() is not case insensitive
  2004-02-04  6:17 [Bug libgcj/14012] New: HttpURLConnection.setRequestProperty() is not case insensitive k dot allan-gcc at au dot darkbluesea dot com
                   ` (4 preceding siblings ...)
  2005-01-11 20:20 ` cvs-commit at gcc dot gnu dot org
@ 2005-01-11 20:27 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-11 20:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-11 20:27 -------
Fixed. on the mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14012


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-01-11 20:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-04  6:17 [Bug libgcj/14012] New: HttpURLConnection.setRequestProperty() is not case insensitive k dot allan-gcc at au dot darkbluesea dot com
2004-02-04  6:22 ` [Bug libgcj/14012] " k dot allan-gcc at au dot darkbluesea dot com
2004-02-04  6:59 ` pinskia at gcc dot gnu dot org
2004-06-27 16:20 ` mckinlay at redhat dot com
2005-01-07 22:43 ` konqueror at gmx dot de
2005-01-11 20:20 ` cvs-commit at gcc dot gnu dot org
2005-01-11 20:27 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).