📄 mimetype.h
字号:
/* Monkey HTTP Daemon v0.1.1 by EdsipeR (edsiper@linux-chile.org) * -------------------------------------------------------------- * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ int find_mimetype(char aux_request[1024], char content_type[255]) { int i,j; char name[255],type[255]; j=strlen(aux_request)-1; /* Tipo de archivo */ while(aux_request[j]!='.' && j>=0) j--; for(i=0; i<=strlen(aux_request) ;i++) { name[i]=aux_request[j+1]; j++; } name[strlen(name)]='\0'; strcpy(type,"text/plain"); cmpmime(name,type); type[strlen(type)]='\0'; sprintf(content_type,"Content-Type: %s\n\n",type); content_type[strlen(content_type)]='\0'; return;}int cmpmime (char name[255], char type[255]) { aux_mime=first_mime; while(aux_mime!=NULL) { if(strcmp(aux_mime->name,name)==0) { strcpy(type,aux_mime->type); break; } else aux_mime=aux_mime->next; } return;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -