Improvement to my swat *.txt fix.

Ron Alexander rcalex at home.com
Tue Sep 5 15:02:54 GMT 2000


It was pointed out to me that my original fix to this section of code from
cgi.c/cgi_download might be improved by inverting the order of tests that I
had originally (default case was text/html).

This version should handle any non html file properly as plain text. (the
changes are marked as !!!!!)

The other thing I added was a test for .htm since there was 1 file with that
type ion the faq dir. (marked as <<<<<)

Again, since I am a Stratus VOS person and not *nix I do not know (yet) how
to submit this properly. I do see that my last version made it into the CVS
tree and do appreciate the assistance.

I do have a Linux box in my office. What I need is a recommended reading
list that will give me the skills required to perform maintenance on the
Samba code and documentation in the prescribed manner.


  printf("HTTP/1.0 200 OK\r\n");
  if ((p=strrchr(file,'.'))) {
    if (strcmp(p,".gif")==0) {
      printf("Content-Type: image/gif\r\n");
    } else if (strcmp(p,".jpg")==0) {
      printf("Content-Type: image/jpeg\r\n");
    } else if (strcmp(p,".html")==0) {			!!!!!!!!!!!!! better order ?
      printf("Content-Type: text/html\r\n");		!!!!!!!!!!!!!
    } else if (strcmp(p,".htm")==0) {			<<<<<<<<<<<<<<<<<< Additional
      printf("Content-Type: text/html\r\n");		<<<<<<<<<<<<<<<<<< test
    } else								!!!!!!!!!!!!! Any NON html
      printf("Content-Type: text/plain\r\n");		!!!!!!!!!!!!! should now be
formatted ok
  }

Regards,
Ron Alexander





More information about the samba-technical mailing list