× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Good question. I'm hard-coding the content-type in my RPG code. I assume that's related to the unprintable characters at the beginning of my payload. I guess those characters may be the image the content-type is referring to. I have no idea where either are coming from.

Thanks



-----Original Message-----
From: B Stone [mailto:bvstone@xxxxxxxxx]
Sent: Friday, May 24, 2019 11:19 AM
To: Web Enabling the IBM i (AS/400 and iSeries) <web400@xxxxxxxxxxxxxxxxxx>
Subject: Re: [WEB400] Garbage in HTTP response

Why is it using this:

Content-Type: image/x-portable-graymap


Bradley V. Stone
www.bvstools.com
MAILTOOL Benefit #10 <https://www.bvstools.com/mailtool.html>: Resend Emails - When emails are sent using MAILTOOL Plus or another addon, those emails are logged and you have the ability to resend them one by one, or as a batch (ie, all unsent emails at once).

On Fri, May 24, 2019 at 10:43 AM Justin Taylor <JUSTIN@xxxxxxxxxxxxx> wrote:

I have a CGI webservice written in RPG that returns JSON. It
processes about 200 requests a day and has been in production for a couple of weeks.
I have one request that consistently returns strange garbage at the
beginning of the response. So far, I’ve only seen a single request
that does this. I can’t see anything unusual about this request.
I’ve debugged the RPG code, and it looks to be functioning correctly.

Any suggestions on where to look now? TIA


Here is what a normal response looks like:
HTTP/1.1 200 OK
Date: Fri, 24 May 2019 15:05:38 GMT
Server: Apache
Content-Type: application/json; charset=utf-8
Content-Length: 80297

{json_data_here}



Here is what the bogus response consistently shows:
HTTP/1.1 200 OK
Date: Fri, 24 May 2019 15:27:05 GMT
Server: Apache
Content-Type: image/x-portable-graymap
Content-Length: 91261


`鉗@ K @@Ö @M ]@ ` @ɇ @ׁ @@ ` ` % @兙 @ K
@M ~ m k䣆 ~ kȤ Ɖ ~ k @ ]%%י @ z@a
a ` ` ` m m K %%ŧ
@@ K %ŧ @@ K %ŧ @@ K %ŧ @@
K %ŧ @@ ä K %%ť @ @֒%%Ɖ z@
%≩ z@@@@@@@ %Ö z@ %⣁ z@ @
%Ö ` z@ a ^@ ~ `
%
%{json_data_here}



RPG snippet:
yajl_genOpen(*off);
yajl_beginObj();
yajl_addChar('' : );
yajl_addCharPtr('' : :);

yajl_endObj();

yajl_copyBuf( 1208
: %addr(lJsonData)
: %size(lJsonData)
: lLength );

yajl_genClose();

lDataOut = 'Status: 200 OK'
+ CRLF
+ 'Content-type: application/json; charset=utf-8'
+ CRLF + CRLF
+ lJsonData
+ CRLF
;
lLength = %len(%trimr(lDataOut));

QtmhWrStoutAPI(lDataOut :lLength :QUSEC);
If QUSEI = *blank;
Else;
Endif;
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing list To post a message email: WEB400@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxxxxxxxx Before posting, please
take a moment to review the archives at
https://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.