Gemini proxy image display
Mr. Leveck
leveck at leveck.us
Thu Sep 10 20:08:27 BST 2020
On 9/10/20 11:50 AM, Mr. Leveck wrote:
> On 9/10/20 11:38 AM, Charles E. Lehner wrote:
>> Mr. Leveck,
>>
>> I looked into it more, comparing this broken image:
>> https://leveck.us/gemini/1436.ninja/the_servers.png
>>
>> with the good original:
>> gemini://1436.ninja/the_servers.png
>>
>> The proxied one has this header "<!-- GEMINI! --><!--
>> 1436.ninja/the_servers.png --><!-- 192.168.0.45 -->". That breaks the
>> image. Also, in the content at byte 24576 (0x6000), the files diverge.
>> The proxied one seems to restart sending the PNG image there, with
>> some bytes missing. Maybe a variable is incorrectly set in your code?
>>
>> Charles
This led me to it. Thank you very much!
New code:
status = stream_get_line($socket,512,"\r\n");
content = stream_get_contents($socket);
The first line strips off 512 bytes, or until \r\n is encountered. The
second is much better for my intended use than fread at acquiring the
rest. Binary files now work.
Now I need to iron out some other things like relative URLs...
--
jynx
gopher://1436.ninja
gemini://1436.ninja/
https://leveck.us
More information about the Gemini
mailing list