Thread: Protocol Requests

  1. #1
    Super Moderator
    Join Date
    Sep 2001

    Protocol Requests

    I'm writing a program for a small server (at least it started out small, but it's been going a lot better than I expected), and I'm adding support for more than just HTTP. I'm also gonna add CGI, etc... but before I do that, I need to build some precautions into the HTTP code so that it won't be too much of an upgrade to add things like FTP. HTTP request lines are of the form
    (METHOD) (Encoded URL) (HTTP/1.?), so you can't quite easily write code to split this up using " " as a delimiter and make a 3-element array, and then get the protocol name from array[2]. Now do other protocol's requests follow the same pattern? I would've looked this up on but I could find much about FTP at all. (I'm also assuming that it is even possible to have a server function in both FTP and HTTP capacities, so if it isn't, please let me know before I make an even bigger fool of myself).

  2. #2
    Join Date
    Nov 2003
    Doesn't ftpd (or your ftp server whatever your OS may be) work for you?

    Why do you want to reinvent the wheel?

  3. #3
    Griz803 Griz803's Avatar
    Join Date
    Jun 2004
    Well, if no one ever reinvented the wheel, we'd all be riding on wooden spokes with iron tires... that'd really stink on an SUV

    Sorry to intrude, just couldn't pass up the wheel thing.

  4. #4
    Me -=SoKrA=-'s Avatar
    Join Date
    Oct 2002
    It is indeed possible to have a server that accepts both FTP and HTTP protocols.
    The problem is that it would be hell to maintain. You shouldn't have to differenciate(sp?) between FTP and HTTP requests because each one uses a different port. Therefore you should spawn a child or call the code that deals with FTP.
    SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
    I say what I say, I mean what I mean.
    IDE: emacs + make + gcc and proud of it.

  5. #5
    Super Moderator
    Join Date
    Sep 2001
    Ah! The port - thanks. Didn't think of that.

    And jim - I'm sorry, I couldn't resist, but I just did a very sarcastic post on the C++ board (check it out - and I'm on a roll, but for anybody who's seen RocketMan:

    Wheel reinvention is my Chinese Neighbor's middle name!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  2. Timing HTTP GET requests
    By traef06 in forum C Programming
    Replies: 9
    Last Post: 09-08-2008, 09:33 PM
  3. Writing all HTTP requests from a website to a log file
    By goomyman in forum C# Programming
    Replies: 1
    Last Post: 07-29-2005, 09:18 AM
  4. Networking Protocol
    By Hunter2 in forum Networking/Device Communication
    Replies: 14
    Last Post: 12-11-2003, 04:51 PM
  5. help on protocol
    By Prasad kulkarni in forum C Programming
    Replies: 3
    Last Post: 10-20-2002, 08:54 AM