I'm in the process of writing KNet v2.0 - a webserver. The original incarnations (v1.0-1.04c) were based around the Atomic Webserver example. I've decided to pull away from this and start afresh, but I have been using some of the methods Atomic uses.
I wanted to include 404 headers, but whenever I try to send one my browser just hangs and doesn't come up with a 404 header. Sometimes I get a 'an attempted read to/write to error from which that process isn't allowed' error.
Here's my header:
Code: Select all
Procedure.l Build404Header(*Buffer)
Length = PokeS(*Buffer,"HTTP/1.1 404 Not Found"+EOL$) *Buffer+Length
Length = PokeS(*Buffer,"Server: "+#Server+" "+#Version+EOL$) *Buffer+Length
;Date.s=CurrentDate() Need my fuction for that - takes up a lot of room
Length = PokeS(*Buffer,"Date: "+Date+EOL$)
*Buffer+Length
Length = PokeS(*Buffer,"Content-Length: 0"+EOL$) : *Buffer+Length
Length = PokeS(*Buffer,"Content-Type: text/html"+EOL$) : *Buffer+Length
Length = PokeS(*Buffer, EOL$) : *Buffer+Length
ProcedureReturn *Buffer
EndProcedure
And here's the code I'm sending it with:
Code: Select all
*Header404=AllocateMemory(500)
*HeaderOffset=Build404Header(*Header404)
SendNetworkData(ID,*Header404,*HeaderOffset)
FreeMemory(*Header404)
(I'll be relasing the full source once it works

