PxPlus User Forum

Main Board => Discussions => Web Services => Topic started by: Stéphane Devouard on September 21, 2025, 03:44:06 AM

Title: PxPlus pipe issue on Windows with curl
Post by: Stéphane Devouard on September 21, 2025, 03:44:06 AM
Hello

Trying to help Henderson with his HTTP POST issue, I suggested using curl from PxPlus as an alternate solution

Trying this dummy API from Powershell, we get what we expect :

╭─� pwsh � ~ �                                                                                                      � � 09:11:15 �
╰─❯ curl -s https://jsonplaceholder.typicode.com/posts/1
{
  "userId": 1,
  "id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}


Using a pipe from PxPlus for Windows, we miss the last line of the JSON response :

->open(1)"<curl -s https://jsonplaceholder.typicode.com/posts/1"
->?rcd(1)
{
->?rcd(1)
  "userId": 1,
->?rcd(1)
  "id": 1,
->?rcd(1)
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehe
nderit",
->?rcd(1)
  "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nr
eprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem evenie
t architecto"
->?rcd(1)
Error #2: END-OF-FILE on read or File full on write
Last IO to <curl -s https://jsonplaceholder.typicode.com/posts/1, channel 1
->


The same code on a PxPlus Ubuntu (WSL) works as expected :

PxPlus-2025 Demo (Ver:22.00/UNIX-Linux-Ubuntu) Serno:2200-664-0799999
(c) Copyright 2005-2025 PVX Plus Technologies Ltd. (All rights reserved)
  Website: http://www.pvxplus.com
->
->open(1)"<curl -s https://jsonplaceholder.typicode.com/posts/1"
->?rcd(1)
{
->?rcd(1)
  "userId": 1,
->?rcd(1)
  "id": 1,
->?rcd(1)
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
->?rcd(1)
  "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
->?rcd(1)
}
->?rcd(1)
Error #2: END-OF-FILE on read or File full on write
Last IO to <curl -s https://jsonplaceholder.typicode.com/posts/1, channel 1
->

Looks like a problem in the pipe interface on Windows only
Title: Re: PxPlus pipe issue on Windows with curl
Post by: Mike King on September 21, 2025, 02:13:13 PM
The issue might be a missing end of line terminator in the data.

Using RCD the system assumes the input contains a proper end of line terminator which is 0A on Linux, but 0D 0A on Windows.  If there is no terminator an error may be generated since the pipe will return EOF status and the record will be considered incomplete.

Try using a read record with a SIZ= small TIM= value to see what CURL is actually returning.
Title: Re: PxPlus pipe issue on Windows with curl
Post by: Stéphane Devouard on September 22, 2025, 08:48:20 AM
Hi Mike

Bingo, the end-of-line terminator is the issue

The code below seems to resolve the problem and works correctly both on Windows and Linux

->open(1)"<curl -s -w ""\n"" https://jsonplaceholder.typicode.com/posts/1"
->?rcd(1)
{
->?rcd(1)
  "userId": 1,
->?rcd(1)
  "id": 1,
->?rcd(1)
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehe
nderit",
->?rcd(1)
  "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nr
eprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem evenie
t architecto"
->?rcd(1)
}
->?rcd(1)
Error #2: END-OF-FILE on read or File full on write
Last IO to <curl -s -w "\n" https://jsonplaceholder.typicode.com/posts/1, channe
l 1
->

Thanks for the clarification