-
Feb 10th, 2005, 10:55 AM
#1
Thread Starter
Frenzied Member
HTML: application/x-www-form-urlencoded
Is there a limit to the amount of data you can POST with
application/x-www-form-urlencoded?
I thought I hada problem with my CGI script because I couldn't POST more
than 47kb as a string.
But when I changed the server from IIS to Apache, the amount increased to
69kb.
This implied a built in limit of the server.
Anyone know if this is configurable?
-
Feb 11th, 2005, 06:24 AM
#2
Re: HTML: application/x-www-form-urlencoded
Maximum post side is usually measured in MB not KB
What is it you are trying to send?
-
Feb 11th, 2005, 07:52 AM
#3
Thread Starter
Frenzied Member
Re: HTML: application/x-www-form-urlencoded
Im only sending a series of numbers added together in a string.
To demonstrate what is happening download CVMichaels example CGI program
http://www.vbforums.com/showthread.p...&highlight=cgi
(bottom post in thread) and add a couple of lines to write the buffer to a log file e.g
VB Code:
Sub GetFormData()
Dim DataLen As Long, sData As String, lBytesRead As Long, rc As Long
If UCase(Trim(Environ("REQUEST_METHOD"))) = "POST" Then
DataLen = Val(Environ("CONTENT_LENGTH"))
If DataLen > 0 Then
sData = String(DataLen, 0)
rc = ReadFile(hStdIn, ByVal sData, DataLen, lBytesRead, ByVal 0&)
sData = Left$(sData, lBytesRead)
[B] Open "log.txt" For Append As #29
Write #29, sData
Close #29[/B]
End If
End If
PairData sData
PairData Environ("QUERY_STRING")
End Sub
Now paste 70kb of data into the form field and submit it.
Depending on your server you wont necessarily have all the data in the log file.
Note that it is a string not a file upload.
This is because my application is an ActiveX control that collects lots of data from a measureing instrument and adds it all together as a string.
The Onclick command of the (HTML) button then passes this string value to the (HTML) form and submits it.
-
Feb 11th, 2005, 08:41 AM
#4
Re: HTML: application/x-www-form-urlencoded
Are you actually encoding the data in the url encoded format?
I.e: variable1=value1&variable2=value2
If you do not require your data to be in this format, then set the enctype atttribute on the form to text/plain or if it is binary data: application/octet-stream.
-
Feb 11th, 2005, 09:57 AM
#5
Thread Starter
Frenzied Member
Re: HTML: application/x-www-form-urlencoded
The data is expected in the url encoded format, Ill have to check whether it actually does get encoded properly.
Im not sure how that could have this effect though...
-
Feb 11th, 2005, 11:37 AM
#6
Re: HTML: application/x-www-form-urlencoded
Url encoded is designed to ctransport nam/value paris from form fields. Each input element in the form with the name is transferred along with its value in the form:
firstname=Joe&surname=Bloggs&age=16
Should the data contain any white space or the +/= character they are encoded using their ascii hexadecimal equivilent.
http://www.w3schools.com/html/html_ref_urlencode.asp
I am still not sure what you are doing. Are you using an HTML form to submit the data? If so then why don't you use a file upload?
If you are using an Active X control client side, then I would by pass the HTML form and submit the data driectly to the CGI script. Pasting 70KB of data into a text box crashes Internet Explorer and takes Firefox an eternity to send.
-
Feb 11th, 2005, 12:34 PM
#7
Thread Starter
Frenzied Member
Re: HTML: application/x-www-form-urlencoded
Looking at the data recieved, the name/value pairs are getting encoded correctly.
The client has a piece of Scientific Instumentation connected to the PC and the ActiveX control sends commands to set it up and read data back from it.
This means that the data is held in a string in the ActiveX control and is not actually a file until it reaches the server and is processed.
Im not actually pasting the data into a text box, but that seemed to be the easiest way to demonstrate without uploading the whole project.
There is a script on the web page which interacts with a hidden form to upload the data.
Code:
<SCRIPT LANGUAGE="VBSCRIPT" TYPE="text/vbscript">
<!--
sub JobDone(CurrentMode)
s=cstr(MyControl.Param5)
i=cstr(MyControl.Param6)
frm.Stage.value=i
frm.d.value=s
frm.submit
end sub
-->
</SCRIPT>
<FORM METHOD="POST" ACTION="mycgi.exe" NAME="frm" ENCTYPE="application/x-www-form-urlencoded">
<INPUT TYPE="HIDDEN" NAME="Stage" VALUE="100">
<INPUT TYPE="HIDDEN" NAME="d" VALUE="0">
<INPUT TYPE="hidden" NAME="Ident" VALUE="*IDENT*"></FORM>
Stage tells the CGI program which step in the process is being done.
d contains this massive long string of data
Ident is a unique identifier to locate the correct directory to store the files on the server
How would you submit the data to the CGI program directly from the ActiveX control?
-
Feb 14th, 2005, 08:41 PM
#8
Re: HTML: application/x-www-form-urlencoded
I did not actually try to mimic your error, but you might want to try to encode the data before you send it, like the Base64 encoding (wich was made specifically for http and email transfers)
Use the code I made in this thread:
http://www.vbforums.com/showthread.p...ghlight=encode
About 3 posts down
Use the Base64Encoding at client side (in your activex), and Base64Decoding to decode at server side
Last edited by CVMichael; Feb 14th, 2005 at 08:45 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|