Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: MarkTTU on May 13, 2019, 06:34:26 PM

Title: HTTPCMD
Post by: MarkTTU on May 13, 2019, 06:34:26 PM
Trying to make use of the new HTTPCMD to interact with an API on a remote server. I've managed to build my JSON string successfully (proved by copy/pasting the string from Do-more into Postman) and I seem to communicate with the remote server ok, but I can't actually get it to work. Error response from the remote server is:

Code: [Select]
HTTP/1.1 411 Length Required

Content-Type: text/html; charset=us-ascii..Server: Microsoft-HTTPAPI/2.0..Date: Mon, 13 May 2019 22:23:19 GMT..Connection: close..Content-Length: 344....

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">..
<HTML>
<HEAD>
<TITLE>Length Required</TITLE>..
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii">
</HEAD>..
<BODY>
<h2>Length Required</h2>..
<hr>
<p>HTTP Error 411. The request must be chunked or have a content length.</p>..
</BODY>
</HTML>..

Looks to me like the BRX isn't sending the length of the request in the HTTP header, but I don't see any way to add that to the things that need to be sent. Am I missing something?
Title: Re: HTTPCMD
Post by: BobO on May 13, 2019, 07:54:04 PM
"Content-Length:" only applies to the request body, which generally only relates to PUT or POST. When you specify a request body we do send the length.
Title: Re: HTTPCMD
Post by: MarkTTU on May 13, 2019, 08:47:41 PM
Hmm... I must be missing something then. This should be sending the content length, right?
Title: Re: HTTPCMD
Post by: BobO on May 13, 2019, 08:56:50 PM
Hmm... I must be missing something then. This should be sending the content length, right?

I would think so, yes. I'll email you.

Title: Re: HTTPCMD
Post by: MarkTTU on May 13, 2019, 09:13:36 PM
Thanks Bob. I'll be on the lookout for your email.

For what it's worth I was able to get the API call to work by manually writing the content length and content-type headers. Oddly if I put the content type where it belongs in the instruction my API would fail because it didn't get the content type.