put header "Status:400" fails

Are you using LiveCode to create server scripts or CGIs?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
KimD
Posts: 211
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

put header "Status:400" fails

Post by KimD » Wed Nov 20, 2019 12:39 am

I'm teaching myself to build a REST API using LC Server. I've got my prototype API running on hostm (which was very easy to get going). I'm testing using Postman. I've encountered a weird little problem.

The below works fine -
<?lc
put header "Status:428"
put "It all went South"
?>

Postman receives the status code 428 and "It all went south".

But if I substitute -
<?lc
put header "Status:400"
put "It all went South"
?>

Postman receives the status code 403 (Forbidden) and does NOT receive "It all went south".

I've tested about 5 other header status codes. They all worked.

I can easily work around this by putting a status code other than 400 (although none of the others accurately reflects the nature of the problem). I don't know if this is a LC issue or a hostm issue, but I thought that I'd try the forum first. Has anyone seen this before, or can you reproduce it, or is it definitely a hostm issue, or something else?

Thanks

Kim

sphere
Posts: 1116
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: put header "Status:400" fails

Post by sphere » Thu Nov 21, 2019 1:47 pm

I tested for you.

I get in both cases "It went south", so it works here.
No errors.

KimD
Posts: 211
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Re: put header "Status:400" fails

Post by KimD » Thu Nov 21, 2019 8:22 pm

Thanks for checking that. I'll try asking hostm.

Regards

Kim

KimD
Posts: 211
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Re: put header "Status:400" fails - CLOSED

Post by KimD » Fri Nov 22, 2019 2:44 am

Hostm got back to me (very quickly) with the following -

"We can confirm that the issue with status code 400 is not LiveCode-specific, as we’ve tested it with other server-side languages with the same result on our servers. It appears to be have something to do with LiteSpeed, the web server that we utilize, since the issue does not occur with the standard web server (Apache) that comes with cPanel."

SparkOut
Posts: 2406
Joined: Sun Sep 23, 2007 4:58 pm

Re: put header "Status:400" fails

Post by SparkOut » Fri Nov 22, 2019 9:17 am

<silly aside>What if you try Status:418?</silly aside>

Post Reply

Return to “CGIs and the Server”