Plan 9 from Bell Labs’s /usr/web/sources/patch/sorry/htfilefs/notes

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Thu Sep 15 10:46:05 EDT 2005 rsc
    This is neat.  Some suggested changes (and then please resubmit):
    
     - Don't indent case statements inside switch or inside ARGBEGIN.
     - Don't use _ in names.
     - Use "continue" instead of goto nothingtodo.
     - Use "for(;;)" instead of "while(1)".
     - Rename demiseblock to deleteblock or dropblock
       (demise is not a verb.)
     - Do not put braces around single statements in if or else.
     - Rename the program to httpfile.
     - Don't post a service by default.  (srvname = nil)
       Mount on . by default.
     - Spell mntpt mtpt.
     - Why are you going through all the trouble of estrduping port and get?
       Just use the plain strings.
     - Your name parsing is really complicated and does the same thing about
       four times in a row.  Can't you just use:
    	get = strchr(host, '/');
    	if(get)
    		*get++ = 0;
    	else
    		get = "/";
    	
    	port = strchr(host, ':')
    	if(port)
    		*port++ = 0;
    	else
    		port = usetls ? "https" : "http";
     - You should be using cistrncmp instead of strncmp to look for https/http.
     - Your while loop in findblock should be a for loop.  Ditto findreq.
     - Your takedown function doesn't do anything useful.  Srv.end only gets
       called once the connection has been hung up, so replies to messages
       won't actually go anywhere.
     - Alphabetize your options-with-arguments in usage().
    
    Thanks.
    Russ


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.