PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

HTTP Multipart

Hello,
we need for our needs http requests. Until now we used simple get or post requests. As for that, we needed to encode request parameters only using ascii codes. To overcome this problems, we tried the multipart possibility.
Below the changed code sample

EHTTPRequest request("http://localhost/mod/o1.pl");
request.AddData("dt",(unsigned char *) aURL,data_out,NULL,"application/x-gzip");
ecd->net[0]->SendHTTPPostMultipart(&request;);
stack.Alloc(aPagesize);

data_out holding the parameters length
aURL holding the parameters in a char*.

Running the Apps on WinXP, is ok. Perl scripts confirm the data is sended correct.
But on UIQ the Apps crashes or generates no netEvents and on a WM5 it returns HSTATE_ERROR netEvent.

We didn't try the apps on gprs only on wlan.
Is this feature also needing the apps to be signed?
Hi Yucani,

Perhaps the problem is caused by unallocated pointers or something similar. Can you also show the code you use to set your aURL and data_out values?
yucani · 28 Jan 2008, 08:38 UTC — multipart
here the code (please understand, that we had to shorten internal parts)

Code:
bool ClassModHTTP::GetMask( // parameter for building
char URL[1000],buf[350],temp[64];
uint cmdlen;

.....
..... generating parameters in temp[64]

for(i=0;i<cmdlen;i++) { buf[i]=temp[i]; }
data_out=cmdlen; // is global to hold length of multipart message
return GetHTTP(buf,34000);
}

bool ClassModHTTP::GetHTTP(char *aURL,unsigned long aPagesize)
{
if(state == HSTATE_INIT) return false;
if(state == HSTATE_RECEIVING) return false;
if(state == HSTATE_EXECUTE) return false;

state=HSTATE_INIT;

EHTTPRequest request("http://localhost/mod/o1.pl");
request.AddData("dt",(unsigned char *) aURL,data_out,NULL,"application/x-gzip");
ecd->net[0]->SendHTTPPostMultipart(&request);
stack.Alloc(aPagesize);
return true;
}



apagesize is holding the size of memory allocated for the request.
state the HTTP state (class variable)
data_out (class variable ) holding length of multipart message
cmdlen is calculated in GetMask and then copied to data_out
Hi Yucani,

I think it's best to determine at which point your program crashes on the UIQ device, because that seems to be the best way to test for errors. Try commenting out the EDGELIB functions and see at which point the GetHTTP() function fails.

Perhaps it's also a good idea to make a small sample, using only one parameter with fixed size.
yucani · 29 Jan 2008, 10:05 UTC — multipart
as our http/net routines were not included were classmain was defined, but in a seperate module, we moved them back to ClassMain and the problem was solved.
Unfortunatly we do not have the time to find out why standard post and get worked well, but multipart not.


But definitly now Multipart requests are working on UIQ and PPC.