Thread: $100 reward for help in solving this problem.
$100 reward for help in solving this
problem.
2007-01-25 00:15:58
I will pay $100 to the first person who can tell me why this upload is
failing.
The money will be available through paypal. All I need is your email
address.
I am trying to upload a file from a flash app running in firefox on
windows xp to a turbogears controller running on linux. The controller
is never getting dispatched, as is apparent from the lack of output
from my
print 'got here'
statement. I tried this print trick in another controller in same TG
app just to be sure, and it did, in fact, work there.
What I'm seeing is that cherrypy is trying to read the file and timing
out. Here's the trace:
2007-01-24 22:00:20,459 cherrypy.msg INFO HTTP: Traceback (most recent
call last):
File
"/opt/python2.4.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py",
line 98, in _run
self.processBody()
File
"/opt/python2.4.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py",
line 230, in processBody
keep_blank_values=1)
File
"/opt/python2.4.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpcgifs.py",
line 8, in __init__
cgi.FieldStorage.__init__(self, *args, **kwds)
File "/opt/python2.4.4/lib/python2.4/cgi.py", line 530, in __init__
self.read_multi(environ, keep_blank_values, strict_parsing)
File "/opt/python2.4.4/lib/python2.4/cgi.py", line 655, in read_multi
environ, keep_blank_values, strict_parsing)
File
"/opt/python2.4.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpcgifs.py",
line 8, in __init__
cgi.FieldStorage.__init__(self, *args, **kwds)
File "/opt/python2.4.4/lib/python2.4/cgi.py", line 532, in __init__
self.read_single()
File "/opt/python2.4.4/lib/python2.4/cgi.py", line 665, in
read_single
self.read_lines()
File "/opt/python2.4.4/lib/python2.4/cgi.py", line 687, in read_lines
self.read_lines_to_outerboundary()
File
"/opt/python2.4.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpcgifs.py",
line 31, in read_lines_to_outerboundary
line = self.fp.readline(1<<16)
File
"/opt/python2.4.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/lib/httptools.py",
line 496, in readline
data = self.rfile.readline(size)
File "/opt/python2.4.4/lib/python2.4/socket.py", line 359, in
readline
data = self._sock.recv(self._rbufsize)
timeout: timed out
Request Headers:
Content-Length: 7264
USER-AGENT: Shockwave Flash
CONNECTION: Keep-Alive
CONTENT-LENGTH: 7264
HOST: www01.videoonramp.com:8080
CACHE-CONTROL: no-cache
CONTENT-TYPE: multipart/form-data;
boundary=----------KM7KM7Ij5cH2GI3ei4GI3GI3cH2KM7
ACCEPT: text/*
Remote-Addr: 74.192.146.128
Content-Type: multipart/form-data;
boundary=----------KM7KM7Ij5cH2GI3ei4GI3GI3cH2KM7
Remote-Host: 74.192.146.128
74.192.146.128 - - "POST / HTTP/1.1" 500 2505 "" "Shockwave Flash"
$100 to first correct answer that solves this problem.
no questions asked...if it works, you get the money.
thanks,
Jesse
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Re: $100 reward for help in solving
this problem.
2007-01-25 00:39:30
Jesse James wrote:
> What I'm seeing is that cherrypy is trying to read the file and timing
> out.
Are you sure the file is being sent? Have you put
a packet sniffer between client and server and
checked for any obvious problems that way?
Also, it might be a good idea to post your code.
-- JK
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Re: $100 reward for help in solving
this problem.
2007-01-25 01:06:34
I have not sniffed packets, but I am using some pretty boilerplate code
on the flex side, and it does appear to be sending as evidenced by the
CONTENT-LENGTH header param. The code on the TG side has been reduced
to this:
expose()
def postFile(self,*args,**kwargs):
print "!!!!!!!!!!!!!!!!!!!!!!!!!"
return 'ok'
and is, AFAICT, not being called by cherrypy (TG). On the flex side,
here's the actionScript.
Basically, the user browses a file to upload, then on 'ok'
(onSelectClipThumbFile event below), the 'onSelectClipThumbFile()'
function is called.
This updates the UI and calls the 'startUpload' function. This follows
the prescribed usage for a FileReference in adobe's docs for Flex
(http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=5534a12f and
http://livedocs.macromedia.com/flex/2/langref/flash/net/FileReference.html).
// Called to select file for clip thumbnail.
private function selectClipThumbFile():void {
_refUploadFile = new FileReference();
_refUploadFile.addEventListener(Event.SELECT,
onSelectClipThumbFile);
_refUploadFile.browse();
}
private function onSelectClipThumbFile(evt:Event) :void{
var thumb:String = 'images/'+_refUploadFile.name;
videoXml.project[projectList.selectedIndex].clip[projectClips.selectedIndex].thumb
= thumb;
projectClips.selectedItem.thumb = thumb;
startUpload(true);
}
private function startUpload(isFirst:Boolean):void{
var sendVars:URLVariables = new URLVariables();
sendVars.action = "postFile";
sendVars.name = "afile";
if (isFirst) {
_numCurrentUpload = 0;
}
var request:URLRequest = new URLRequest();
request.data = sendVars;
request.url = getUploadScript();
request.method = URLRequestMethod.POST;
request.contentType = "multipart/form-data";
_refUploadFile.addEventListener(ProgressEvent.PROGRESS,
onUploadProgress);
_refUploadFile.addEventListener(Event.COMPLETE,
onUploadComplete);
_refUploadFile.addEventListener(IOErrorEvent.IO_ERROR,
onUploadIoError);
_refUploadFile.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
onUploadSecurityError);
_refUploadFile.upload(request,"file", true);
// debug.
//Alert.show("uploading file, contentType="+request.contentType,
"Info");
}
On 25 Jan, 00:39, JK kneuro.net> wrote:
> Jesse James wrote:
> > What I'm seeing is that cherrypy is trying to read the file and timing
> > out.Are you sure the file is being sent? Have you put
> a packet sniffer between client and server and
> checked for any obvious problems that way?
>
> Also, it might be a good idea to post your code.
>
> -- JK
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Re: $100 reward for help in solving
this problem.
2007-01-25 01:30:25
Jesse James wrote:
> I am trying to upload a file from a flash app running
> in firefox on windows xp to a turbogears controller
> running on linux.
> Request Headers:
> CONTENT-TYPE: multipart/form-data;
boundary=----------KM7KM7Ij5cH2GI3ei4GI3GI3cH2KM7
> Content-Type: multipart/form-data;
boundary=----------KM7KM7Ij5cH2GI3ei4GI3GI3cH2KM7
You really shouldn't be seeing two sets of these headers. My guess is you're using FileReference and running into the same bug described here:
http://www.modpython.org/pipermail/mod_python/2006-April/020897.html (basically, the Flash upload violates the spec).
To work around this in cherrypy, you'll have to hack the wsgiserver to use something other than mimetools.Message to parse the headers. This has already been done for CherryPy 3, so you might be able to steal it (or just its read_headers() method).
def read_headers(self):
"""Read header lines from the incoming stream."""
environ = self.environ
while True:
line = self.rfile.readline()
if not line:
# No more data--illegal end of headers
raise ValueError("Illegal end of headers.")
if line == 'rn':
# Normal end of headers
break
if line[0] in ' t':
# It's a continuation line.
v = line.strip()
else:
k, v = line.split(":", 1)
k, v = k.strip().upper(), v.strip()
envname = "HTTP_" + k.replace("-", "_")
if k in comma_separated_headers:
existing = environ.get(envname)
if existing:
v = ", ".join((existing, v))
environ[envname] = v
ct = environ.pop("HTTP_CONTENT_TYPE", None)
if ct:
environ["CONTENT_TYPE"] = ct
cl = environ.pop("HTTP_CONTENT_LENGTH", None)
if cl:
environ["CONTENT_LENGTH"] = cl
It would be nice if you could file a bug at http://www.cherrypy.org/newticket. What would be MOST helpful would be if you could get a repr of the entire request stream. And the easiest way to do *that* would be to modify cherrypy.lib.http.SizeCheckWrapper's read* methods to print their data:
def read(self, size = None):
data = self.rfile.read(size)
# Add this line to read and readline:
print repr(data)
self.bytes_read += len(data)
self._check_length()
return data
Robert Brewer
System Architect
Amor Ministries
fumanchuamor.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Re: $100 reward for help in solving
this problem.
2007-01-25 13:11:55
What would be MOST helpful would be if you could get a repr of the
entire request stream. And the easiest way to do *that* would be to
modify cherrypy.lib.http.SizeCheckWrapper's read* methods to print
their data:
>
> def read(self, size = None):
> data = self.rfile.read(size)
>
> # Add this line to read and readline:
> print repr(data)
>
> self.bytes_read += len(data)
> self._check_length()
> return data
>
I added the print code to read and readline in all the appropriate
spots (3) and got the following:
'POST /postFile HTTP/1.1rn'
'Accept: text/*rn'
'Content-Type: multipart/form-data;
boundary=----------ei4KM7GI3ei4KM7ei4KM7gL6ae0gL6rn'
'User-Agent: Shockwave Flashrn'
'Host: www01.videoonramp.com:8080rn'
'Content-Length: 6898rn'
'Connection: Keep-Alivern'
'Cache-Control: no-cachern'
'rn'
'------------ei4KM7GI3ei4KM7ei4KM7gL6ae0gL6rn'
'Content-Disposition: form-data; name="Filename"rn'
'rn'
'videos.xmlrn'
'------------ei4KM7GI3ei4KM7ei4KM7gL6ae0gL6rn'
'Content-Disposition: form-data; name="Filedata";
filename="videos.xml"rn'
'Content-Type: application/octet-streamrn'
'rn'
'n'
'n'
'tn'
'tn'
....... remainder of xml file contents (omitted for brevity).....
'------------ei4KM7GI3ei4KM7ei4KM7gL6ae0gL6rn'
'Content-Disposition: form-data; name="Upload"rn'
'rn'
'Submit Queryrn'
2007-01-25 10:43:04,883 cherrypy.msg INFO HTTP: Traceback (most recent
call last):
File
"/opt/python2.4.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py",
line 98, in _run
self.processBody()
File
"/opt/python2.4.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py",
line 230, in processBody
keep_blank_values=1)
File
"/opt/python2.4.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpcgifs.py",
line 8, in __init__
cgi.FieldStorage.__init__(self, *args, **kwds)
File "/opt/python2.4.4/lib/python2.4/cgi.py", line 530, in __init__
self.read_multi(environ, keep_blank_values, strict_parsing)
File "/opt/python2.4.4/lib/python2.4/cgi.py", line 655, in read_multi
environ, keep_blank_values, strict_parsing)
File
"/opt/python2.4.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpcgifs.py",
line 8, in __init__
cgi.FieldStorage.__init__(self, *args, **kwds)
File "/opt/python2.4.4/lib/python2.4/cgi.py", line 532, in __init__
self.read_single()
File "/opt/python2.4.4/lib/python2.4/cgi.py", line 665, in
read_single
self.read_lines()
File "/opt/python2.4.4/lib/python2.4/cgi.py", line 687, in read_lines
self.read_lines_to_outerboundary()
File
"/opt/python2.4.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpcgifs.py",
line 31, in read_lines_to_outerboundary
line = self.fp.readline(1<<16)
File
"/opt/python2.4.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/lib/httptools.py",
line 502, in readline
data = self.rfile.readline(size)
File "/opt/python2.4.4/lib/python2.4/socket.py", line 359, in
readline
data = self._sock.recv(self._rbufsize)
timeout: timed out
Request Headers:
Content-Length: 6898
USER-AGENT: Shockwave Flash
CONNECTION: Keep-Alive
CONTENT-LENGTH: 6898
HOST: www01.videoonramp.com:8080
CACHE-CONTROL: no-cache
CONTENT-TYPE: multipart/form-data;
boundary=----------ei4KM7GI3ei4KM7ei4KM7gL6ae0gL6
ACCEPT: text/*
Remote-Addr: 74.192.146.128
Content-Type: multipart/form-data;
boundary=----------ei4KM7GI3ei4KM7ei4KM7gL6ae0gL6
Remote-Host: 74.192.146.128
74.192.146.128 - - "POST /postFile HTTP/1.1" 500 2505 "" "Shockwave
Flash"
The part, just prior to the file content:
'------------ei4KM7GI3ei4KM7ei4KM7gL6ae0gL6rn'
'Content-Disposition: form-data; name="Filename"rn'
'rn'
'videos.xmlrn'
'------------ei4KM7GI3ei4KM7ei4KM7gL6ae0gL6rn'
'Content-Disposition: form-data; name="Filedata";
filename="videos.xml"rn'
'Content-Type: application/octet-streamrn'
seems to be missing the blank line after the 2nd Content-Disposition
param.
Don't know if that matters.
I'm going to try the cherrypy 3 route.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Re: $100 reward for help in solving
this problem.
2007-01-25 15:11:43
I tried posting a file via a simple html upload form and then posting
the same file via the flash app.
some striking differences were found, including different
Content-Length values (flash was 885, html was 677), and flash's double
boundary before the content.
Seems like both of these things are potential problems with flash's
upload code.
flash:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'POST /postFile HTTP/1.1rn'
'Accept: text/*rn'
'Content-Type: multipart/form-data;
boundary=----------KM7Ij5cH2KM7Ef1gL6ae0ae0cH2gL6rn'
'User-Agent: Shockwave Flashrn'
'Host: www01.videoonramp.com:8080rn'
'Content-Length: 885rn'
'Connection: Keep-Alivern'
'Cache-Control: no-cachern'
'rn'
'------------KM7Ij5cH2KM7Ef1gL6ae0ae0cH2gL6rn'
'Content-Disposition: form-data; name="Filename"rn'
'rn'
'.projectrn'
'------------KM7Ij5cH2KM7Ef1gL6ae0ae0cH2gL6rn'
'Content-Disposition: form-data; name="Filedata";
filename=".project"rn'
'Content-Type: application/octet-streamrn'
<---- ACTUAL CONTENT HERE ----->
'------------KM7Ij5cH2KM7Ef1gL6ae0ae0cH2gL6rn'
'Content-Disposition: form-data; name="Upload"rn'
'rn'
'Submit Queryrn'
(and subsequent cherrypy traceback, timeout)
Simple HTML form:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'POST /upload HTTP/1.1rn'
'Host: www01.videoonramp.com:8080rn'
'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.0.9) Gecko/20061206 Firefox/1.5.0.9rn'
'Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5rn'
'Accept-Language: en-us,en;q=0.5rn'
'Accept-Encoding: gzip,deflatern'
'Accept-Charset: UTF-8,*rn'
'Keep-Alive: 300rn'
'Connection: keep-alivern'
'Referer: http://www01.videoonramp.com:8080/testUploadrn'
'Cookie: tg-visit=a45746678ee38f1a27c12923cc260a190891f594rn'
'Content-Type: multipart/form-data;
boundary=---------------------------187161971819895rn'
'Content-Length: 677rn'
'rn'
'-----------------------------187161971819895rn'
'Content-Disposition: form-data; name="myFile";
filename=".project"rn'
'Content-Type: application/octet-streamrn'
<---- ACTUAL CONTENT HERE ----->
'-----------------------------187161971819895--rn'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Re: $100 reward for help in solving
this problem.
2007-01-25 16:22:34
Jesse James wrote:
> I tried posting a file via a simple html upload form and then posting
> the same file via the flash app.
> some striking differences were found, including different
> Content-Length values (flash was 885, html was 677), and flash's double
> boundary before the content.
>
The Content-Length is larger because the Flash POST includes more
parameters. You could simulate that in your simple HTML form by adding
and .
It isn't necessary to have a blank line before a MIME section boundary,
so that isn't an issue.
--
Tim Roberts, timrprobo.com
Providenza & Boekelheide, Inc.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Re: $100 reward for help in solving
this problem.
2007-01-25 16:26:20
> The Content-Length is larger because the Flash POST includes more
> parameters. You could simulate that in your simple HTML form by adding
> and name=Upload>.
>
Hmmm....seems like just the opposite is true...Flash actually posted
fewer params.
What am I missing?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Re: $100 reward for help in solving
this problem.
2007-01-25 17:47:01
Jesse James wrote:
a75g2000cwd.googlegroups.com"
type="cite">
The Content-Length is larger because the Flash POST includes more
parameters. You could simulate that in your simple HTML form by adding
<input type=text name=Filename value=".project"> and <input type=submit
name=Upload>.
Hmmm....seems like just the opposite is true...Flash actually posted
fewer params.
What am I missing?
In the example you posted at 1:11 PM, you showed the Flash POST having
content length 885 with parameters "Filename", "Filedata", and
"Upload". The simple HTML form showed content length 677 with "myFile"
as the only parameter. Were they labeled backwards?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group. To post to this group, send email to cherrypy-usersgooglegroups.com To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en -~----------~----~----~----~------~----~------~--~---
Re: $100 reward for help in solving
this problem.
2007-01-25 18:07:14
ok. well, still having this problem.
cherrypy is choking.
I tried the code posted by Robert Brewer and it did not help.
I am baffled.
On 25 Jan, 17:47, Tim Roberts probo.com> wrote:
> Jesse James wrote:
> >> The Content-Length is larger because the Flash POST includes more
> >> parameters. You could simulate that in your simple HTML form by adding
> >> and >> name=Upload>.
>
> > Hmmm....seems like just the opposite is true...Flash actually posted
> > fewer params.
> > What am I missing?In the example you posted at 1:11 PM, you showed the Flash POST having
> content length 885 with parameters "Filename", "Filedata", and
> "Upload". The simple HTML form showed content length 677 with "myFile"
> as the only parameter. Were they labeled backwards?
>
> --
> Tim Roberts, t...probo.com
> Providenza & Boekelheide, Inc.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---