Building a Webserver; issues with the 404 header

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    Building a Webserver; issues with the 404 header

    Well, I'm not sure where to put this, but I figured people using ajax are more likely to run into these issues.

    I have been building my own webserver (don't ask, just trust me when I say I have to) from scratch.
    I have been using the RFCs to correctly generate response headers, particularly the status line:
    "HTTP/1.0 200 Ok "+crlf
    "HTTP/1.0 404 Not Found"+crlf

    Now when I use the XMLHttpRequest, it sees my "404" status code and "Not Found" line correctly.
    However, both firefox and IE don't believe the 404 and just make a blank page.

    I was under the assumption that the browsers would auto-generate a default error message page when it sees the 404 error. I am perfectly capable of creating a custom one to return, but I would prefer to save the overhead of sending more data if I could.

    I thought I should be able to send a fully qualified set of headers with the 404 status code and not have the browser just sit there blankly.

    Anyone have any ideas on this? Or should I just start making my own 404 page now?
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Plater.

    If you're building your own webserver, then the message has to come from somewhere. Either set up a 404 page and display that (preferred), or else hard-code the message into your app.

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      I was afraid of that. Thanks for the confirm.

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        No problem.

        Good luck with your project, and if you ever need anything, post back anytime :)

        Comment

        Working...