[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: receiving http Post/Push data


On Tue, 9 Jul 2024 at 09:59, Bruce Steers <bsteers4@xxxxxxxxx> wrote:

>
>
> On Mon, 8 Jul 2024 at 21:15, T Lee Davidson <t.lee.davidson@xxxxxxxxx>
> wrote:
>
>> On 7/8/24 12:26, Bruce Steers wrote:
>> >
>> > I have in my gambas program a method that connects to a url that is a
>> gb.web cgi script
>> >
>> > this url when opened checks the QUERY_STRING and returns data depending
>> on the arg.
>> >
>> > but i also want to upload some text data to it.
>> >
>> > I have this function...
>> > Public Sub btnUpload_Click()
>> >
>> >    Dim sRes As String
>> >    Dim s As String = File.LoadArchive(File.SetExt(ESettings.Path,
>> "zx"), True)
>> >
>> >    With $hTp = New HttpClient As "HTP"
>> >      .URL = $sHost &/ $sScoreAppPath & "?submit"
>> >      .Post("text/plain", s)
>> >     ' .Push("text/plain", s)  ' tried this way too
>> >    End With
>> >
>> > End
>> >
>> > Then on the server-side the cgi-script runs and it detects the "submit"
>> but i cannot figure out how to access the sent data on
>> > the server.
>> > I looked at all the CGI[Key] keys, it's not there , Content-Length: is
>> filled and correct but wheres the text data that was sent?
>> >
>> > Cheers for any advice
>> > BruceS
>> >
>> >
>>
>> Request.Post ?
>>
>> "Request.Post only deals with application/x-www-form-urlencoded and
>> multipart/form-data" content type.
>>
>> For other content type (like application/json), you must read it manually
>> from the standard input."
>>
>> So you'll need to set the content-type to one of the above, when sending
>> the Post, to read it in Request.Post, or
>> sPostData = Read #File.In Request.ContentLength '(I think.)
>>
>>
>> --
>> Lee
>>
>
> Yep , Request.class , that was what i was missing , thanks T :)
>

Hmm i found Request.Post.Contents to be truncated.  (using
multpart/form-data)
Is it actually multiple parts? so i only got half the text or is there a
size limit?  , ContentLength was 47336 chars

sData = Read Request.ContentLength  works perfectly though :)

Thanks again.

Follow-Ups:
Re: receiving http Post/Push dataBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
References:
receiving http Post/Push dataBruce Steers <bsteers4@xxxxxxxxx>
Re: receiving http Post/Push dataT Lee Davidson <t.lee.davidson@xxxxxxxxx>
Re: receiving http Post/Push dataBruce Steers <bsteers4@xxxxxxxxx>