I’ve been trying to send data to our Vodafone server with HTTP POST but i get the following response from the server:
http session channel created
[HTTP] new request GET weather.vodafonernd.com/post.php HTTP/1.1 @ 180ec7
a0
[HTTP] req parsed URL: /post.php at weather.vodafonernd.com
[HTTP] connect to host: weather.vodafonernd.com:80
HTTP data channel created
http_ClientTestDataHandler: Start
http_ClientTestDataHandler: WIP_CEV_WRITE
http_ClientTestDataHandler: 160 bytes written
http_ClientTestDataHandler: WIP_CEV_READ
http_ClientTestDataHandler: Status=400
http_ClientTestDataHandler: Reason=“Bad Request ( The HTTP request includes a no
n-supported header. Contact your ISA Server administrator. )”
[WIP] closing HTTP_DATA 0x180ec7a0
[HTTP] destroy request @ 180ec7a0
[WIP] closing HTTP_CONTROL 0x180ec560
[WIP] closing TCPCLIENT 0x180dcb80
The server says my HttP request includes a non-supported header but i followed the format specified in the Open AT IP dev. guide:
static s32 http_Client(void)
{
s32 ret = 0;
// HTTP Session creation
// ---------------------------
http_ClientTestCtx.CnxChannel = wip_HTTPClientCreate(
NULL, // no handler
NULL // no context
);
if (http_ClientTestCtx.CnxChannel == NULL)
{
TRACE(( 2, "cannot create http session channel\n" ));
//adl_atSendResponse ( ADL_AT_UNS, "cannot create http session channel\r\n" );
adl_atSendResponsePort ( ADL_AT_RSP, ADL_PORT_UART1, "\r\ncannot create http session channel\r\n");
ret = -1;
}
else {
adl_atSendResponsePort ( ADL_AT_RSP, ADL_PORT_UART1, "\r\nhttp session channel created\r\n");
// HTTP POST command
http_ClientTestCtx.DataChannel = wip_getFileOpts(
http_ClientTestCtx.CnxChannel, // session channel
HTTP_STR_URL, // URL to receive the data
http_ClientTestDataHandler, // data handler
&http_ClientTestCtx, // context
WIP_COPT_HTTP_METHOD, WIP_HTTP_METHOD_POST,
// request headers
WIP_COPT_HTTP_HEADER, "Host","weather.vodafonernd.com",
WIP_COPT_HTTP_HEADER, "Content-Type",":application/x-www-form-urlencoded",
WIP_COPT_HTTP_HEADER, "Accept",":text/html",
WIP_COPT_HTTP_HEADER, "User-Agent", "Weather", WIP_COPT_HTTP_HEADER, "Referer:","http://weather.vodafonernd.com/testpost.com",
WIP_COPT_END);
if (http_ClientTestCtx.DataChannel == NULL)
{
TRACE(( 2, "cannot create http data channel\n" ));
//adl_atSendResponse ( ADL_AT_UNS, "cannot create http data channel\r\n" );
adl_atSendResponsePort ( ADL_AT_RSP, ADL_PORT_UART1, "\r\ncannot create http data channel\r\n");
wip_close( http_ClientTestCtx.CnxChannel);
// ret =-1;
}
else
adl_atSendResponsePort ( ADL_AT_RSP, ADL_PORT_UART1, "\r\nHTTP data channel created\r\n");
}
return(ret);
}
How can i solve this problem ?