Http post


#1

hi,

       Iam using Q2687 wavecom CPU . i want to transmit data to HTTP through POST method . Iam sending the data to server (tomcat) by using the following code.The HTTP session takes place correctly by connection to host and the open and write request are happened and bytes are written through wip_write but it is not received in the server. Can anyone reply.

/*

  • http_file.c
  • Created on: Feb 18, 2010
  •  Author: Administrator
    

*/

#include “adl_global.h” // Global includes
#include “wip_http.h” // WIP http services

/**************************************************************************/
/
Local variables /
/
**************************************************************************/
// HTTP defined strings set
// ------------------------

char trsbuf[]=“12345”;

const ascii * HTTP_STR_URL = “http://url”;
typedef struct
{
wip_channel_t CnxChannel; // session channel
wip_channel_t DataChannel; // data channel

u32 dataLength; // response data length

} http_ClientTestCtx_t;

http_ClientTestCtx_t http_ClientTestCtx;

//
/
Constants /
/
/

/**************************************************************************/
/
Local functions /
/
**************************************************************************/

/********************************************************************/
/
Function : http_ClientTestDataHandler /
/
-------------------------------------------------------------------------
/
/
Object : Handler for the HTTP data channel /
/
/
/
Returned : none /
/
/
/
/
/
--------------------±–±--±–±---------------------------------------
/
/
Variable Name |IN |OUT|GLB| Use /
/
--------------------±–±--±–±---------------------------------------
/
/
| | | | /
/
**************************************************************************/
static void http_ClientTestDataHandler( wip_event_t *ev, void *ctx)
{
ascii tmpbuf[256];
ascii Ptr_OnTrace[240];
int len, tmplen,BytesWritten;
s32 status;
http_ClientTestCtx_t *pHttpClientCtx =
(http_ClientTestCtx_t *) &http_ClientTestCtx;

switch(ev->kind)
{
case WIP_CEV_OPEN:
TRACE(( 4, “http_ClientTestDataHandler: WIP_CEV_OPEN\n” ));
adl_atSendResponse ( ADL_AT_UNS, “http_ClientTestDataHandler: Start\r\n” );

  // ready for getting response data
  pHttpClientCtx->dataLength  = 0;

//  BytesWritten = wip_write(ev->channel, trsbuf, sizeof(trsbuf));
  //TRACE((1,"BytesWritten=%d",BytesWritten));
  break;

case WIP_CEV_READ:
  TRACE(( 4, "http_ClientTestDataHandler: WIP_CEV_READ\n" ));
  adl_atSendResponse ( ADL_AT_UNS, "http_ClientTestDataHandler:read\r\n" );

// we must read all available data to trigger WIP_CEV_READ again
  tmplen = 0;
  while( (len = wip_read( ev->channel, tmpbuf, sizeof(tmpbuf)-1)) > 0) {
    tmpbuf[len] = 0;
   adl_atSendResponse ( ADL_AT_UNS, tmpbuf );
    tmplen += len;
  }
  TRACE(( 4, "http_ClientTestDataHandler: read %d bytes\n", tmplen ));
  // compute total length of response
  pHttpClientCtx->dataLength += tmplen;
  break;

case WIP_CEV_WRITE:
	adl_atSendResponse ( ADL_AT_UNS, "http_ClientTestDataHandler:write\r\n" );

	TRACE(( 4, "http_ClientTestDataHandler: WIP_CEV_WRITE\n" ));
	adl_atSendResponsePort ( ADL_AT_RSP, ADL_PORT_UART1, "\r\nhttp_ClientTestDataHandler: WIP_CEV_WRITE\r\n");
	BytesWritten = wip_write(ev->channel, trsbuf, sizeof(trsbuf));
	TRACE((1,"BytesWritten=%d",BytesWritten));
	//wm_sprintf("%s",trsbuf);

  break;

case WIP_CEV_PEER_CLOSE:
  TRACE(( 4, "http_ClientTestDataHandler: WIP_CEV_PEER_CLOSE\n" ));
  adl_atSendResponse ( ADL_AT_UNS, "\r\nhttp_ClientTestDataHandler: Done\r\n" );

  // end of data
  // show response information
  if( wip_getOpts( ev->channel,
        WIP_COPT_HTTP_STATUS_CODE, &status,
        WIP_COPT_HTTP_STATUS_REASON, tmpbuf, sizeof(tmpbuf),
        WIP_COPT_END) == OK) {
    ascii sbuf[16];
    adl_atSendResponse ( ADL_AT_UNS, "http_ClientTestDataHandler: Status=" );
    wm_sprintf( sbuf, "%d", status);
    adl_atSendResponse ( ADL_AT_UNS, sbuf);
    adl_atSendResponse ( ADL_AT_UNS, "\r\nhttp_ClientTestDataHandler: Reason=\"" );
    adl_atSendResponse ( ADL_AT_UNS, tmpbuf);
    adl_atSendResponse ( ADL_AT_UNS, "\"\r\n" );
    TRACE(( 4, "http_ClientTestDataHandler: Status=%d\n", status));
    wm_sprintf(Ptr_OnTrace, "http_ClientTestDataHandler: Reason=\"%s\"\n", tmpbuf);
    TRACE((4,Ptr_OnTrace));
  }
  if( wip_getOpts( ev->channel,
        WIP_COPT_HTTP_HEADER, "content-type", tmpbuf, sizeof(tmpbuf),
        WIP_COPT_END) == OK) {
        wm_sprintf(Ptr_OnTrace, "http_ClientTestDataHandler: Content Type=\"%s\"\n", tmpbuf);
        TRACE((4,Ptr_OnTrace));
  }
  TRACE(( 4, "http_ClientTestDataHandler: Response Length=%d bytes\n",
          pHttpClientCtx->dataLength ));

  // data channel must be closed
  wip_close( ev->channel);

  break;

case WIP_CEV_ERROR:
  TRACE(( 4, "http_ClientTestDataHandler: WIP_CEV_ERROR %d\n",
          ev->content.error.errnum));
  adl_atSendResponse ( ADL_AT_UNS, "http_ClientTestDataHandler: ERROR\r\n" );

  // connection to server broken
  wip_close( ev->channel);

  break;

default:
  TRACE(( 4, "http_ClientTestDataHandler: unexpected event: %d\n",
          ev->kind));
  break;

}
}

/********************************************************************/
/
Function : http_ClientTestCreate /
/
-------------------------------------------------------------------------
/
/
Object : HTTP get example /
/
/
/
Returned : none /
/
/
/
/
/
--------------------±–±--±–±---------------------------------------
/
/
Variable Name |IN |OUT|GLB| Use /
/
--------------------±–±--±–±---------------------------------------
/
/
| | | | /
/
**************************************************************************/
static s32 http_ClientTestCreate(void)
{
s32 ret = 0;

// HTTP Session creation
// ---------------------------
http_ClientTestCtx.CnxChannel = wip_HTTPClientCreateOpts(

                NULL,  // no handler
                NULL,  // no context

                // default headers
                WIP_COPT_HTTP_HEADER, "User-Agent", "WIPHTTP/1.0",

                WIP_COPT_END);

if (http_ClientTestCtx.CnxChannel == NULL)
{
TRACE(( 1, “cannot create http session channel\n” ));
adl_atSendResponse ( ADL_AT_UNS, “cannot create http session channel\r\n” );
ret = -1;
}
else
{
// HTTP GET command
// ---------------------------
http_ClientTestCtx.DataChannel = wip_getFileOpts(

                http_ClientTestCtx.CnxChannel,  // session channel

                HTTP_STR_URL,                   // requested URL

                http_ClientTestDataHandler,     // data handler
                &http_ClientTestCtx,            // context

                WIP_COPT_HTTP_METHOD,WIP_HTTP_METHOD_POST,

                // request headers
                WIP_COPT_HTTP_HEADER, "Accept",          "text/html",
                WIP_COPT_HTTP_HEADER, "Accept-Language", "fr, en",

                WIP_COPT_END);

if (http_ClientTestCtx.DataChannel == NULL)
{
  TRACE(( 1, "cannot create http data channel\n" ));
  adl_atSendResponse ( ADL_AT_UNS, "cannot create http data channel\r\n" );
  wip_close( http_ClientTestCtx.CnxChannel);
  ret =-1;
}

}

return(ret);
}

/*******************************************************************/
/
Function : appli_entry_point /
/
-------------------------------------------------------------------------
/
/
Object : Called once the WIP IP stack is fully initialized. /
/
This is the starting point of user applications. /
/
-------------------------------------------------------------------------
/
/
Variable Name |IN |OUT|GLB| Utilisation /
/
--------------------±–±--±–±---------------------------------------
/
/
| | | | /
/
--------------------±–±--±–±---------------------------------------
/
/***************************************************************************/
void appli_entry_point(void)
{
TRACE (( 1, “HTTP Client Service test application : Init” ));
adl_atSendResponse ( ADL_AT_UNS, “\r\nHTTP Client Service test application : Init\r\n” );

http_ClientTestCreate();
}


#2

After sending all your data, you need to call wip_shutdown() to tell the server that the data is complete.

See the WIP User Guide.


#3

hello awenil ,

         i have tried using wipshutdown after the bytes written, but again the data is not received in the server.

#4

You need to show the code that you are actually using - nobody can help to debug your code if we can’t see your code!

Show only the simplest, complete application that demonstrates the problem.

Please also remove commented-out sections.


#5

hello awenil ,

       i have used the same code above now including the wipshutdown option. Now iam getting the responses below but the server has not yet received my data.

#6

Did you solve the problem?? i have the same trouble and i cant get it running


#7

That is a Success repsonse form the server - so the HTTP request has worked!

If you still can’t find the data on your server, then you need to examine your server logs to see what happened to it…


#8

hi, i am using WMP 100 and i need to write in the inbuilt flash memory. how to do that, whether our Lua script will help that. pls explain


#9

What does that have to do with this thread about “HTTP POST” :question: :unamused:


#10

hi everyone

since /viewtopic.php?f=109&t=5430 lead me here, i think ill post here instead of opening “just another thread”

i want to send some data from the device to a server on the web - via http post :smiley:

this is how far i got till now

#include "adl_global.h"  // Global includes 
#include "wip_http.h"    // WIP http services

const ascii * HTTP_STR_URL = "http://url"; //the url isnt missing - dont want it to be "public"

typedef struct
{
	wip_channel_t CnxChannel;           // session channel
	wip_channel_t DataChannel;          // data channel

	u32           dataLength;           // response data length

} http_ClientTestCtx_t;

http_ClientTestCtx_t http_ClientTestCtx;

static void http_ClientTestDataHandler( wip_event_t *ev, void *ctx)
{
	ascii tmpbuf[256];
	ascii Ptr_OnTrace[240];
	int len, tmplen, BytesWritten;
	static int offset = 0;
	s32 status;
	http_ClientTestCtx_t *pHttpClientCtx = (http_ClientTestCtx_t *) &http_ClientTestCtx;

	switch(ev->kind)
	{

	case WIP_CEV_WRITE:
		adl_atSendResponse ( ADL_AT_UNS, "http_ClientTestDataHandler:write\r\n" );

		wm_sprintf(tmpbuf,"varQ=outOfTheBox&varC=OutOfTheBoxToo");
		BytesWritten = wip_write( http_ClientTestCtx.DataChannel, tmpbuf, (strlen(tmpbuf)+1)-offset);
		if(BytesWritten < 0)
		{/* error */
			adl_atSendResponse ( ADL_AT_UNS, "an error occured while sending the data :(");
			return;
		}
		offset += BytesWritten; /* Update the number of bytes sent. */
		if( offset == strlen(tmpbuf)+1)
		{ /* All of [buffer] has been sent */
			adl_atSendResponse( ADL_AT_UNS,  "\r\nhttp_ClientTestDataHandler: bytes have been written\r\n");
		}
		wip_shutdown( http_ClientTestCtx.DataChannel,FALSE,TRUE);
		adl_atSendResponse( ADL_AT_UNS,  "the wip_shutdown does work");
		adl_memRelease (tmpbuf);
		adl_atSendResponse( ADL_AT_UNS,  "the memRelease does work");

		break;


	case WIP_CEV_OPEN:
		TRACE(( 4, "http_ClientTestDataHandler: WIP_CEV_OPEN\n" ));
		adl_atSendResponse ( ADL_AT_UNS, "http_ClientTestDataHandler: Start\r\n" );

		// ready for getting response data
		pHttpClientCtx->dataLength  = 0;

		break;

	case WIP_CEV_READ:
		TRACE(( 4, "http_ClientTestDataHandler: WIP_CEV_READ\n" ));

		// we must read all available data to trigger WIP_CEV_READ again
		tmplen = 0;
		while( (len = wip_read( ev->channel, tmpbuf, sizeof(tmpbuf)-1)) > 0) {
			tmpbuf[len] = 0;
			adl_atSendResponse ( ADL_AT_UNS, tmpbuf );
			tmplen += len;
		}
		TRACE(( 4, "http_ClientTestDataHandler: read %d bytes\n", tmplen ));
		// compute total length of response
		pHttpClientCtx->dataLength += tmplen;
		break;

	case WIP_CEV_PEER_CLOSE:
		TRACE(( 4, "http_ClientTestDataHandler: WIP_CEV_PEER_CLOSE\n" ));
		adl_atSendResponse ( ADL_AT_UNS, "\r\nhttp_ClientTestDataHandler: Done\r\n" );

		// end of data
		// show response information
		if( wip_getOpts( ev->channel,
				WIP_COPT_HTTP_STATUS_CODE, &status,
				WIP_COPT_HTTP_STATUS_REASON, tmpbuf, sizeof(tmpbuf),
				WIP_COPT_END) == OK) {
			ascii sbuf[16];
			adl_atSendResponse ( ADL_AT_UNS, "http_ClientTestDataHandler: Status=" );
			wm_sprintf( sbuf, "%d", status);
			adl_atSendResponse ( ADL_AT_UNS, sbuf);
			adl_atSendResponse ( ADL_AT_UNS, "\r\nhttp_ClientTestDataHandler: Reason=\"" );
			adl_atSendResponse ( ADL_AT_UNS, tmpbuf);
			adl_atSendResponse ( ADL_AT_UNS, "\"\r\n" );
			TRACE(( 4, "http_ClientTestDataHandler: Status=%d\n", status));
			wm_sprintf(Ptr_OnTrace, "http_ClientTestDataHandler: Reason=\"%s\"\n", tmpbuf);
			TRACE((4,Ptr_OnTrace));
		}
		if( wip_getOpts( ev->channel,
				WIP_COPT_HTTP_HEADER, "content-type", tmpbuf, sizeof(tmpbuf),
				WIP_COPT_END) == OK) {
			wm_sprintf(Ptr_OnTrace, "http_ClientTestDataHandler: Content Type=\"%s\"\n", tmpbuf);
			TRACE((4,Ptr_OnTrace));
		}
		TRACE(( 4, "http_ClientTestDataHandler: Response Length=%d bytes\n",
				pHttpClientCtx->dataLength ));

		// data channel must be closed
		wip_close( ev->channel);

		break;

	case WIP_CEV_ERROR:
		TRACE(( 4, "http_ClientTestDataHandler: WIP_CEV_ERROR %d\n",
				ev->content.error.errnum));
		adl_atSendResponse ( ADL_AT_UNS, "http_ClientTestDataHandler: ERROR\r\n" );

		// connection to server broken
		wip_close( ev->channel);

		break;

	default:
		TRACE(( 4, "http_ClientTestDataHandler: unexpected event: %d\n",
				ev->kind));
		break;
	}
}


static s32 http_ClientTestCreate(void)
{
	s32 ret = 0;

	// HTTP Session creation
	// ---------------------------
	http_ClientTestCtx.CnxChannel = wip_HTTPClientCreateOpts(

			NULL,  // no handler
			NULL,  // no context

			// default headers
			WIP_COPT_HTTP_HEADER, "User-Agent", "WIPHTTP/1.0",

			WIP_COPT_END);

	if (http_ClientTestCtx.CnxChannel == NULL)
	{
		TRACE(( 1, "cannot create http session channel\n" ));
		adl_atSendResponse ( ADL_AT_UNS, "cannot create http session channel\r\n" );
		ret = -1;
	}
	else
	{
		// HTTP GET command
		// ---------------------------
		http_ClientTestCtx.DataChannel = wip_getFileOpts(

				http_ClientTestCtx.CnxChannel,  // session channel

				HTTP_STR_URL,                   // requested URL

				http_ClientTestDataHandler,     // data handler
				&http_ClientTestCtx,            // context

				WIP_COPT_HTTP_METHOD, WIP_HTTP_METHOD_POST, //HTTP-Post Aufruf...


				// request headers
				WIP_COPT_HTTP_HEADER, "Accept",          "text/html",
				WIP_COPT_HTTP_HEADER, "Accept-Language", "fr, en",

				WIP_COPT_END);

		if (http_ClientTestCtx.DataChannel == NULL)
		{
			TRACE(( 1, "cannot create http data channel\n" ));
			adl_atSendResponse ( ADL_AT_UNS, "cannot create http data channel\r\n" );
			wip_close( http_ClientTestCtx.CnxChannel);
			ret =-1;
		}
	}

	return(ret);
}

void appli_entry_point(void)
{
	TRACE (( 1, "HTTP Client Service test application : Init" ));
	adl_atSendResponse ( ADL_AT_UNS, "\r\nHTTP Client Service test application : Init\r\n" );

	http_ClientTestCreate();
}

which leads to this output:

atatatat
OK
OK
OK
OK
OK
+WIND: 3
at+wopen=1
OK
+WIND: 1
+WIND: 7
+WIND: 4
[GPRS]: open: -> DISCONNECTED
[GPRS]: start: -> CONNECTING
[GPRS]: GPRS EVENT SETUP OK (cid=1): GPRS activate
[GPRS]: GPRS EVENT: 27 (cid=1)
[GPRS]: GPRS EVENT ACTIVATE OK (cid=5)
[GPRS]: GPRS: -> CONNECTED
HTTP Client Service test application : Init
PARSE_URL STEP3[HTTP] req parsed URL: /test at url
[HTTP] new request GET http://url/test HTTP/1.1 @ 180c4184
[HTTP] connect to host: url:80
[WIP] new TCPCLIENT 0x180c3444
[req_event] WIP_CEV_OPEN
[req_event] WIP_CEV_WRITE
http_ClientTestDataHandler: Start
http_ClientTestDataHandler:write
http_ClientTestDataHandler: bytes have been written
the wip_shutdown does wor
+WIND: 3
+WIND: 1
+WIND: 7
+WIND: 4
[GPRS]: open: -> DISCONNECTED
[GPRS]: start: -> CONNECTING
[GPRS]: GPRS EVENT SETUP OK (cid=1): GPRS activate
[GPRS]: GPRS EVENT: 27 (cid=1)
[GPRS]: GPRS EVENT ACTIVATE OK (cid=5)
[GPRS]: GPRS: -> CONNECTED
HTTP Client Service test application : Init
PARSE_URL STEP3[HTTP] req parsed URL: /test at url
[HTTP] new request GET http://url/test HTTP/1.1 @ 180c4164
[HTTP] connect to host: url:80
[WIP] new TCPCLIENT 0x180c3424
[req_event] WIP_CEV_OPEN
[req_event] WIP_CEV_WRITE
http_ClientTestDataHandler: Start
http_ClientTestDataHandler:write
http_ClientTestDataHandler: bytes have been written
the wip_shutdown does work
+WIND: 3
+WIND: 1
+WIND: 7
+WIND: 4
[GPRS]: open: -> DISCONNECTED
[GPRS]: start: -> CONNECTING
[GPRS]: GPRS EVENT SETUP OK (cid=1): GPRS activate
[GPRS]: GPRS EVENT: 27 (cid=1)
[GPRS]: GPRS EVENT ACTIVATE OK (cid=5)
[GPRS]: GPRS: -> CONNECTED
HTTP Client Service test application : Init
PARSE_URL STEP3[HTTP] req parsed URL: /test at url
[HTTP] new request GET http://url/test HTTP/1.1 @ 180c4164
[HTTP] connect to host: url:80
[WIP] new TCPCLIENT 0x180c3424
[req_event] WIP_CEV_OPEN
[req_event] WIP_CEV_WRITE
http_ClientTestDataHandler: Start
http_ClientTestDataHandler:write
http_ClientTestDataHandler: bytes have been written
the wip_shutdown does wor
+WIND: 3
+WIND: 1
+WIND: 7
+WIND: 4
[GPRS]: open: -> DISCONNECTED
[GPRS]: start: -> CONNECTING
[GPRS]: GPRS EVENT SETUP OK (cid=1): GPRS activate
[GPRS]: GPRS EVENT: 27 (cid=1)
[GPRS]: GPRS EVENT ACTIVATE OK (cid=5)
[GPRS]: GPRS: -> CONNECTED
HTTP Client Service test application : Init
PARSE_URL STEP3[HTTP] req parsed URL: /test at url
[HTTP] new request GET http://url/test HTTP/1.1 @ 180c4164
[HTTP] connect to host: url:80
[WIP] new TCPCLIENT 0x180c3424
[req_event] WIP_CEV_OPEN
[req_event] WIP_CEV_WRITE
http_ClientTestDataHandler: Start
http_ClientTestDataHandler:write
http_ClientTestDataHandler: bytes have been written
the wip_shutdown does wor
+WIND: 3
+WIND: 1
+WIND: 7
+WIND: 4
[GPRS]: open: -> DISCONNECTED
[GPRS]: start: -> CONNECTING
[GPRS]: GPRS EVENT SETUP OK (cid=1): GPRS activate
[GPRS]: GPRS EVENT: 27 (cid=1)
[GPRS]: GPRS EVENT ACTIVATE OK (cid=5)
[GPRS]: GPRS: -> CONNECTED
HTTP Client Service test application : Init
PARSE_URL STEP3[HTTP] req parsed URL: /test at url
[HTTP] new request GET http://url/test HTTP/1.1 @ 180c4164
[HTTP] connect to host: url:80
[WIP] new TCPCLIENT 0x180c3424
[req_event] WIP_CEV_OPEN
[req_event] WIP_CEV_WRITE
http_ClientTestDataHandler: Start
http_ClientTestDataHandler:write
http_ClientTestDataHandler: bytes have been written
the wip_shutdown does work
+WIND: 3
+WIND: 1
+WIND: 7
+WIND: 4
[GPRS]: open: -> DISCONNECTED
[GPRS]: start: -> CONNECTING

i think my wip_shutdown() call is kinda wrong, but i cant see the error at all. It seems (to me) that it RESTARTS the programm instead of signalling the end of data transfer to the server.


#11

okay, maybe the error occurs somewhere else…

after having another look into the wip_open_at…guide ive seen that wip_shutdown also has a return value

but the little change to

if(wip_shutdown(http_ClientTestCtx.DataChannel ,FALSE, TRUE) == 0){
			adl_atSendResponse( ADL_AT_UNS,  "the wip_shutdown does work");
		}

leads ALSO to

http_ClientTestDataHandler: bytes have been written
the wip_shutdown does wor
+WIND: 3
+WIND: 1
+WIND: 7

which leaves me confused behind, cause the other things in the write event are all checked on occuring errors and a look to the output says that they are working
:question: :question: :question:


#12

funny thing…

after a bit of playing with the code, the code is like at the start…

case WIP_CEV_WRITE:

		adl_atSendResponse ( ADL_AT_UNS, "http_ClientTestDataHandler:write\r\n" );

		wm_sprintf(tmpbuf,"Q=outOfTheBox");
		BytesWritten = wip_write( http_ClientTestCtx.DataChannel, tmpbuf, (strlen(tmpbuf)+1)-offset);
		if(BytesWritten < 0)
		{/* error */
			adl_atSendResponse ( ADL_AT_UNS, "an error occured while sending the data :(");
			return;
		}
		offset += BytesWritten; /* Update the number of bytes sent. */
		if( offset == strlen(tmpbuf)+1){ /* All of [buffer] has been sent */
			adl_atSendResponse( ADL_AT_UNS,  "\r\nhttp_ClientTestDataHandler: bytes have been written\r\n");
		}

		if(wip_shutdown(http_ClientTestCtx.DataChannel ,FALSE, TRUE) == 0){
			adl_atSendResponse( ADL_AT_UNS,  "the wip_shutdown does work");
		}else{
			adl_atSendResponse(ADL_AT_UNS, "an error occured for wip_shutodwn()");
		}

		break;

but it seems to work (-> i get the http code 200)
i just hope that whatever happend wont undo… :unamused:

but on the server side the post-var “Q” is null… and i cant find the value somewhere else in the accessable parameters…

so i guess

wm_sprintf(tmpbuf,"Q=outOfTheBox");
		BytesWritten = wip_write( http_ClientTestCtx.DataChannel, tmpbuf, (strlen(tmpbuf)+1)-offset);

is somehow wrong?


#13

is there no one reading in this forum who has this working? :frowning:

well, im a bit closer to getting it running…
i added the content header fields into the Datachannel

http_ClientTestCtx.DataChannel = wip_getFileOpts(

				http_ClientTestCtx.CnxChannel, // session channel

				HTTP_STR_URL, // requested URL

				http_ClientTestDataHandler, // data handler
				&http_ClientTestCtx, // context

				WIP_COPT_HTTP_METHOD,WIP_HTTP_METHOD_POST,

				// request headers
				WIP_COPT_HTTP_HEADER, "Accept", "text/html",
				WIP_COPT_HTTP_HEADER, "Accept-Language", "fr, en",
				WIP_COPT_HTTP_HEADER, "Content-Length", "24",
				WIP_COPT_HTTP_HEADER, "Content-Type", "application/x-www-form-urlencoded",
				WIP_COPT_END);

and i send the data via

wm_sprintf(tmpbuf, "search=Katzen&go=Artikel");
		BytesWritten = wip_write( http_ClientTestCtx.DataChannel, tmpbuf, (strlen(tmpbuf)+1)-offset);

to the server…
BUT…
if i send 1 parameter that 1 parameter is avaiable
if i send 2 parameter those 2 parameters are avaiable
if i send 3 parameters only paramter 2 and 3 are avaiable :open_mouth:
if i send 4 parameters only parameter 4 is avaible :open_mouth:
if i send 5 paramters, parameter 2 is missing :frowning:

ofcause i set the content length in the headerfield to the length of the parameterstring… but what exactly is happening here :question: :question: :question: :question:


#14

okay, it was a pretty funny bug on the server…
it works :smiley:


#15

Hi,

I am facing exactly the same problem on http post as described here and have been struggling on it for some time. I shall be extremely thankful if you let me know about the bug on the server. It will indeed save me a lot of efforts.


#16

hi
i´m sorry, but in my documentation is no hint of what ive done and its allready to far in the past.

but if i remember correctly, a fishy way of calling the vars leeded to that error and it was defenitly in my sourcecode from the server application and not in the GAE (Google PaaS) itself.


#17

Well, if you remember anything more about this afterwards, do post it. Thank you very much.