Results 1 to 4 of 4

Thread: Max Length

  1. #1

    Thread Starter
    Frenzied Member agmorgan's Avatar
    Join Date
    Dec 2000
    Location
    Lurking
    Posts
    1,383

    Resolved Max Length

    Im collecting data using an ActiveX control then sending it to my server program using the following on my web page.
    Code:
    <form
    action="../test.exe"
    method="POST" enctype="application/x-www-form-urlencoded"
    name="frm">
        <input type="hidden" name="Stage" value="100"><input
        type="hidden" name="c" value="1"><input type="hidden"
        name="ic" value="0"><input type="hidden" name="r" value="0"><input
        type="hidden" name="d" value="0"><input type="hidden"
        name="Ident" value="575182221677">
    </form>
    Are there any length limitations of
    Code:
    method="POST" enctype="application/x-www-form-urlencoded"
    My program crashes when I have too much data and I am trying to track down the problem.
    VBScript only has Variant type so if I was counting the length of a very long string it should automatically default to Long shouldnt it?

  2. #2

    Thread Starter
    Frenzied Member agmorgan's Avatar
    Join Date
    Dec 2000
    Location
    Lurking
    Posts
    1,383

    Re: Max Length

    After some more reading, it appears that GET is limited but POST is not.

    I have tracked the crash down to the POST data not being fully read.
    What reason could I have for my buffer not to read the entire string?
    It seems to either be a time issue (not enough time to fill the buffer) or a length issue (too much data).
    VB Code:
    1. Declare Function ReadFile Lib "kernel32" _
    2.     (ByVal hFile As Long, _
    3.     lpBuffer As Any, _
    4.     ByVal nNumberOfBytesToRead As Long, _
    5.     lpNumberOfBytesRead As Long, _
    6.     lpOverlapped As Any) As Long
    7.  
    8. Sub GetFormData()
    9. '====================================================
    10. ' Get the CGI data from STDIN and/or from QueryString
    11. ' Store name/value pairs
    12. '====================================================
    13. Dim sBuff      As String    ' buffer to receive POST method data
    14. Dim rc         As Long      ' return code
    15.  
    16. ' Method POST - get CGI data from STDIN
    17. ' Method GET  - get CGI data from QueryString environment variable
    18. '
    19. If CGI_RequestMethod = "POST" Then
    20.    sBuff = String(lContentLength, Chr$(0))
    21.    rc = ReadFile(hStdIn, ByVal sBuff, lContentLength, lBytesRead, ByVal 0&)
    22.    sFormData = Left$(sBuff, lBytesRead)
    23.    
    24.    ' Make sure posted data is url-encoded
    25.    ' Multipart content types, for example, are not necessarily encoded.
    26.    '
    27.    If InStr(1, CGI_ContentType, "www-form-urlencoded", 1) Then
    28.       StorePairs sFormData
    29.    End If
    30.      
    31. Else
    32.     'StorePairs CGI_QueryString
    33.     Call rep_error(16, "CGI Form Problem")
    34.     End
    35. End If
    36.  
    37. End Sub
    im at a loss

  3. #3

    Thread Starter
    Frenzied Member agmorgan's Avatar
    Join Date
    Dec 2000
    Location
    Lurking
    Posts
    1,383

    Re: Max Length

    hmm starting to think that it might be a server issue
    http://support.microsoft.com/default...;EN-US;q260694

    or maybe a max size of data on a form
    http://support.microsoft.com/default...=kb;EN;q273482

    Im not entirely sure what to do about it though

  4. #4

    Thread Starter
    Frenzied Member agmorgan's Avatar
    Join Date
    Dec 2000
    Location
    Lurking
    Posts
    1,383

    Re: Max Length

    Thats the trouble with legacy code.
    Some of the libraries are not up to date!
    The Do Loop fixed it!
    You dont know how long this has been bugging me!
    VB Code:
    1. Sub GetFormData()
    2. '====================================================
    3. ' Get the CGI data from STDIN and/or from QueryString
    4. ' Store name/value pairs
    5. '====================================================
    6. Dim sBuff      As String    ' buffer to receive POST method data
    7. Dim rc         As Long      ' return code
    8.  
    9. ' Method POST - get CGI data from STDIN
    10. ' Method GET  - get CGI data from QueryString environment variable
    11. '
    12. If CGI_RequestMethod = "POST" Then
    13.    sBuff = String(lContentLength, Chr$(0))
    14. [B]   Do While Len(sFormData) < lContentLength
    15.       rc = ReadFile(hStdIn, ByVal sBuff, lContentLength, lBytesRead, ByVal 0&)
    16.       sFormData = sFormData & Left$(sBuff, lBytesRead)
    17.    Loop[/B]
    18.    
    19.    ' Make sure posted data is url-encoded
    20.    ' Multipart content types, for example, are not necessarily encoded.
    21.    '
    22.    If InStr(1, CGI_ContentType, "www-form-urlencoded", 1) Then
    23.       StorePairs sFormData
    24.    End If
    25.      
    26. Else
    27.     'StorePairs CGI_QueryString
    28.     Call rep_error(16, "CGI Form Problem")
    29.     End
    30. End If
    31.  
    32. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width