473,414 Members | 1,751 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

multiple content-types break cgi.py

Hi!

The Nokia Java SDK allows one to define multiple content-types in a
single HTTP header field. I'm not sure if it's standard, but it's
happening from some Java-enabled phones.

This breaks the FieldStorage class in cgi.py by not causing
self.read_urlencoded() to be called at object init. Specifically when
one gets a type value like 'text/plain, application/x-www-form-
urlencoded'.

Hacking one of the lines from:
if ctype == 'application/x-www-form-urlencoded':
self.read_urlencoded()
to
if 'application/x-www-form-urlencoded' in [s.strip() for s in
ctype.split(",")]:
self.read_urlencoded()
makes it work as expected.

The only reference to this "bug" I can find dates back to 1999:
http://tinyurl.com/3ahc3r

Regards
Janto

Mar 4 '07 #1
4 1368
In article <11**********************@p10g2000cwp.googlegroups .com>, Janto Dreijer wrote:
The Nokia Java SDK allows one to define multiple content-types in a
single HTTP header field. I'm not sure if it's standard, but it's
happening from some Java-enabled phones.

The only reference to this "bug" I can find dates back to 1999:
http://tinyurl.com/3ahc3r
It's not a bug - sending multiple content-types is just totally broken.
What would such a header even be supposed to mean? It's like saying
"this is an apple orange".
Mar 4 '07 #2
In <sl***********************@snowy.squish.net>, Jon Ribbens wrote:
It's not a bug - sending multiple content-types is just totally broken.
What would such a header even be supposed to mean? It's like saying
"this is an apple orange".
And the correct header for such a beast would be "this is an iOrange" of
course. ;-)

SCNR,
Marc 'BlackJack' Rintsch
Mar 4 '07 #3
On Mar 4, 12:29 pm, Jon Ribbens <jon+use...@unequivocal.co.ukwrote:
In article <1173002603.690853.250...@p10g2000cwp.googlegroups .com>, Janto Dreijer wrote:
The Nokia Java SDK allows one to define multiple content-types in a
single HTTP header field. I'm not sure if it's standard, but it's
happening from some Java-enabled phones.
The only reference to this "bug" I can find dates back to 1999:
http://tinyurl.com/3ahc3r

It's not a bug - sending multiple content-types is just totally broken.
What would such a header even be supposed to mean? It's like saying
"this is an apple orange".
Hmmm. Thanks! I suspected as much.

Rough inspection suggests that calling
connection.setRequestProperty("Content-Type", "application/x-www-
form-urlencoded");
on the Nokia 6230 would actually cause the value to be *appended* and
not set.

Yuck! It looks like I'm going to have to keep a modified copy of
cgi.py if I want to support the phone. Or hack something on the Java
side.

Janto

Mar 4 '07 #4
In article <11*********************@s48g2000cws.googlegroups. com>, Janto Dreijer wrote:
>It's not a bug - sending multiple content-types is just totally broken.
What would such a header even be supposed to mean? It's like saying
"this is an apple orange".

Hmmm. Thanks! I suspected as much.

Rough inspection suggests that calling
connection.setRequestProperty("Content-Type", "application/x-www-
form-urlencoded");
on the Nokia 6230 would actually cause the value to be *appended* and
not set.
If that method is inherited from java.net.URLConnection, then if the
phone is behaving as you suggest, its Java library is bugged and
behaving contrary to Sun's Java documentation.
Mar 4 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Billy Jacobs | last post by:
I am using a datagrid to display some data. I need to create 2 header rows for this grid with columns of varying spans. In html it would be the following. <Table> <tr> <td colspan=8>Official...
1
by: grandeandy | last post by:
question: in the code below, and in general, how would I input multiple functions into the code, and get multiple outputs? basically, I want to be able to add say 2 or 3 of the div's to the link so...
1
by: Andy Britcliffe | last post by:
Hi I'm faced with the situation where I could have a single physical file that could contain multiplie XML documents e.g file.txt contains the following: <?xml version="1.0"...
1
by: Rob | last post by:
I have an ASP.NET application that uses forms-based authentication. A user wishes to be able to run multiple sessions of this application simultaneously from the user's client machine. The...
3
by: Arun | last post by:
Hi, I have simple question to ask. How to write multiple Binary files to the Browser using Asp.Net and Visual C#.net I have seen examples where single binary file is written to browser. ...
3
by: Henrik Dahl | last post by:
Hello! From default, the ASPNET user is giving the process identity for the ASP.NET runtime environment of IIS, however it's possible to change the user by modifying the <processModel> element...
11
by: xenophon | last post by:
I have a web site with forms authentication and a single logon page. I have 4 subdirectories, each that should be protected by a different username/password combination. For testing purposes, the...
3
by: Michel | last post by:
Hi, I wrote an app in .Net and I whant only 1 instance of this app open for the user; the user open my app, do some works and try to open another instance of my app, I whant to show a message to...
4
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys Just a general query regarding using the AccessDataSource within a website which uses a MasterPage. The layout of my content page is as follows... <asp:Content ID="Content1"...
3
by: MikeB | last post by:
Hello, I have a content page that is from a Master page which has 2 content panes. How do I add my forms to the content page? Each pane needs a form but you can not have multiple form tags nor...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.