# Wip\_write problem over HTTP

**URL:** <https://forum.sierrawireless.com/t/wip-write-problem-over-http/4518>\
**Category:** Open AT\
**Created:** [June 18, 2010, 12:08pm UTC](https://forum.sierrawireless.com/t/wip-write-problem-over-http/4518 "2010-06-18T12:08:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gava100](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@gava100](https://forum.sierrawireless.com/u/gava100)\
**Post date:** [June 18, 2010, 12:08pm UTC](https://forum.sierrawireless.com/t/wip-write-problem-over-http/4518/1 "2010-06-18T12:08:53Z")

</div>

Hello all,

I’m trying to send data via HTTP POST through wip\_write and all the time it’s adding 2 bytes as the size of the buffer (payload) transmitted,  
causing the HTTP Server to refuse the request due to Malformat Package because the Content-Length does not match the payload.  
See the dump bellow and note the 5f (95 decimal) at the beginning of the body.

I’m testing a wip\_write command with an HTTP POST and I get an error. The submit content is this:

POST /HelloWMP/HelloServlet HTTP/1.1  
Host: myserver.com.br:8088  
Transfer-Encoding: chunked  
User-Agent: WIPHTTP/1.0  
Content-Type: application/x-www-form-urlencoded  
Content-Length: 95

5f  
p1=This is a big message that I want to send using the wip\_write command via POST http method!

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [June 18, 2010, 12:46pm UTC](https://forum.sierrawireless.com/t/wip-write-problem-over-http/4518/2 "2010-06-18T12:46:36Z")

</div>

> [@WIP HTTP POST problems](https://forum.sierrawireless.com/t/wip-http-post-problems/4220/4):
>
> It is working perfectly correctly & normally - that’s what “chunked” encoding means! 8)

> [@gava100](#):
>
> the HTTP Server to refuse the request due to Malformat Package because the Content-Length does not match the payload.

Content-Length should not be used with “chunked” encoding - are you adding that yourself?

---

<div class="post-metadata">

**Author:** ![gava100](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@gava100](https://forum.sierrawireless.com/u/gava100)\
**Post date:** [June 18, 2010, 2:43pm UTC](https://forum.sierrawireless.com/t/wip-write-problem-over-http/4518/3 "2010-06-18T14:43:07Z")

</div>

Hello,

No. What I’m using is this:

```auto
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, "Content-Type",
    "application/x-www-form-urlencoded", WIP_COPT_END);
```

> [@awneil](#):
>
> [WIP HTTP POST problems - #4 by awneil](https://forum.sierrawireless.com/t/wip-http-post-problems/4220/4)
> 
> > [@gava100](#):
> >
> > the HTTP Server to refuse the request due to Malformat Package because the Content-Length does not match the payload.
> 
> Content-Length should not be used with “chunked” encoding - are you adding that yourself?

---

<div class="post-metadata">

**Author:** ![gava100](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@gava100](https://forum.sierrawireless.com/u/gava100)\
**Post date:** [June 23, 2010, 12:14pm UTC](https://forum.sierrawireless.com/t/wip-write-problem-over-http/4518/4 "2010-06-23T12:14:49Z")

</div>

Hello,

We found the problem. Actually the data transmitted over HTTP is chunked by default. As you said, we removed the Content-Length header and shutdown the connection after the buffer size was totally transmitted in a way that the HTTP Server was able to decode the chunked data.

Thanks for your help.

Regards

Rafael

> [@awneil](#):
>
> [WIP HTTP POST problems - #4 by awneil](https://forum.sierrawireless.com/t/wip-http-post-problems/4220/4)
> 
> > [@gava100](#):
> >
> > the HTTP Server to refuse the request due to Malformat Package because the Content-Length does not match the payload.
> 
> Content-Length should not be used with “chunked” encoding - are you adding that yourself?

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [June 23, 2010, 12:24pm UTC](https://forum.sierrawireless.com/t/wip-write-problem-over-http/4518/5 "2010-06-23T12:24:49Z")

</div>

> [@gava100](#):
>
> we removed the Content-Length header

So you were adding it, then?
