å½???ä½?ç½?? è½?»¶ä¸?è½?/a> > ç³»ç?å·¥å??/a> > HttpServer v1.0

HttpServer

  • 大å?ï¼?175K
  • è¯??ï¼?ç®?ä½?ä¸???
  • ç±»å???ç³»ç?å·¥å??/li>
  • ????ï¼???è´?/li>
  • ?¶é?´ï?2022-03-07
  • å®?ç½?ï¼?????/li>
  • ???ï¼?Windows10, Windows8, Windows7, WinVista, WinXP
  • å®??¨æ?æµ?ï¼?????ä»?/span>360??è¿??¾è???è¿???å±±é??è¿???????è¿?
8.8??

????��/p>

�??��/p>

??ä¸?è½½é???ä¸?è½½å???????50%

?¸å?³è½¯ä»?/p>

HttpServer???款ä?ä¸??????°é??ç½?½¯ä»¶ï???ä»???»¥??è¿?HttpServer??è´¹ç???¥ç?´æ?¥è?è¡?ä¸?äº?代ç??ï¼?ä»???让ä???»¥?´å???¹ä¾¿?°è?è¡?å¼???å·¥ä?ï¼?大大??é«?å·¥ä???????HttpServer客æ?·ç???»¥??è¿???ç½???件è?è¡????°è?ç½????ç½???件为HttpServer.ini??å¦???ä¸???å®?主页ï¼????¾ç¤ºweb???????件æ???ï¼????为ç???????件æ???¡å?¨ä½¿?¨ã????è¦????¨æ?·å¿«å¿???a href="/r/xzrj" target="_blank">ä¸?è½?/a>?§ï?

HttpServerè½?»¶ç®?ä»?

HttpServer????è¿?HttpServer.ini??件è?è¡????°é??ç½?????°æ?´å??丰å?ï¼?????½ä»¤è¡????°ç??è¡¥å????

HttpServer???°è???

???¨æ???¡å??? HttpServer.exe -W d:web -H index.html -P 80 -M 10000

-W ï¼? webç½?ç«?????å¸?è·??ï¼?å¦?ï¼?d:webï¼?å¦???è·??ä¸???空æ?¼ï???½¿?¨å??å¼??·ã??

HttpServerå®??¹ç??å¦?ä¸???å®?ï¼???ä¼??¨å??????¡è?è¡??????ä¸???å»?eb???ï¼?并以此为webç½?ç«??????

-H �web��??主页���index.html�

å¦???ä¸???å®?主页ï¼????¾ç¤ºweb???????件æ???ï¼????为ç???????件æ???¡å?¨ä½¿?¨ã??

-P ï¼? web???¡ç??ç«??£å?·ï?缺ç???¼ä¸º80??

-M ï¼???大并????ï¼?缺ç???¼ä¸º20000??

?¶å??????????å¸þ@?¼ï????°å??¨å??表示容è???使ç??ï¼?

-AllowUpload ï¼? 容è?ä¸?ä¼?

-CacheM ï¼?使ç?¨ç?å­?(?·ä????è§?ä¸?????"UseCacheMem"å­?æ®?

-CacheC ï¼? 使ç?¨ç?å­?(?·ä????è§?ä¸?????"UseCacheClass"å­?æ®?

缺ç???¼æ????ï¼?å¦???该å?½ä»¤???°ä???å®?ï¼????¡å?¨ä½¿?¨ç??é»?认å???°ã??

HttpServerä¹???»¥??è¿???ç½???件è?è¡????°è?ç½????ç½???件为HttpServer.ini??

HttpServerè½?»¶????/h3>

WebPath ï¼? webç½?ç«?????å¸?è·??ï¼?ç­???äº??½ä»¤è¡?????quot;-W"??

HomePageï¼?webç½?ç«???主页ï¼?ç­???äº??½ä»¤è¡?????quot;-H"??

Portï¼? web???¡ç??ç«??£å?·ï?ç­???äº??½ä»¤è¡?????quot;-P"??

TimeOutï¼? è¶??¶ï???ä½?ç§?ï¼?缺ç???¼ä¸º60ç§???

MaxConnï¼? ??大并???°ï?ç­???äº??½ä»¤è¡?????quot;-M"ï¼?缺ç???¼ä¸º20000??

PostDataPathï¼? ä¸?ä¼??°æ????ä¿?å­?è·??ï¼?缺ç???¼ä¸ºå½????¨æ?·ç??temp?????

1??HttpServerå®??¹ç??使ç?¨å?ºæ???ï¼??¨æ?·å?¨ä?ä¼???件æ?¶ï?ä¸?ä¼???件ä?å­???临æ?¶è·¯å¾?;

2??使ç?¨å?ºæ???ï¼?post请æ??¶ï?å¦????¨æ??ost?°æ???大ï?è¶?è¿?"MaxPostCacheFileSize"å­?段æ??å®??????¼ï? ??è½?¸º??件å?????²æ???å­?使ç?¨è?å¤?

MaxPostCacheFileSizeï¼? POST请æ??¶ï??¥æ??OST?°æ??acheç¼?å­?????大å?¼ï?å¦???è¶?è¿?该å?¼ï???å°?ç¼?å­?è½??为æ??件ï???ä½?为å???BYTE;

MaxUploadFileSizeï¼???大ä?ä¼???件尺寸ï???ä½?Må­???ï¼?缺ç???¼ä¸º2G??

UseCacheMemï¼????þ?½¿?¨ç?å­?ï¼?缺ç???¼ä¸º0ï¼?表示ä¸?使ç?¨ã?? å¦?使使?¨ç?å­?ï¼??????¡å?¨ä??¨ç©º?´æ?¢æ?¶é?´ï?é¢???å¼?è¾??¥å¹²è¿?ç»???大å??å­???ï¼?并é??è½?alloc??free?½æ?°ï??¨é???å¼?è¾???大å??å­???ä¸???¾å???¨ç????ç¢?????????å­?ï¼?ä»?????å°??¨é?并å??ä¸?é¢?ç¹????³è?????æ¯???å­?导è?´ç????åºþ@??? ¬??

UseCacheClassï¼????þ?½¿?¨ç???ä½?(struct/class)ç¼?å­?ï¼?缺ç???¼ä¸º0ï¼?表示ä¸?使ç?¨ã?? å¦?使ç?¨è??¼ï??????¡å?¨ä??¨ç©º?´æ?¢æ?¶é?´ï??³ï??¹æ??axConn??å®???并å???°ï?é¢???å¼?è¾??ºæ??å®?????å­?空é?´ï? å¦???MaxConnä¸?ä¸?ï¼???ä¼?å¼?è¾?对å?2ä¸?ä¸????ä½?(struct/class)?¨ä?ä¿?å­?HTTPä¼?è¯??¶ç??ä¸?ä¸???(ext)?°æ???? ??ä¸?ï¼?该å?¼ä???¸ºäº???å°??¨é?并å??ä¸?é¢?ç¹????³è?????æ¯???å­?导è?´ç????åºþ@??? ¬??

UseMappingFileï¼? ???þ?½¿??apping File?¹å?访é???????件ï?缺ç???¼ä¸º1ï¼?表示使ç?¨ã??

AccessControlAllowOriginï¼? ???þ@?许跨??ï¼?缺ç????ï¼?表示容è???

PrintMessageï¼????þ@?¨æ?§å?¶å?°è???TTP请æ?ï¼?缺ç????ï¼?表示????/a>è¾??ºã??

æ³?? é«?并å???¶å?¡å??³é???§å?¶å?°è???!!

AllowUploadï¼????þ@?许ä?ä¼?ï¼?缺ç???¼ä¸º0ï¼?表示ä¸?容è???

AllowCacheFileï¼????þ@?许æ??件ç?å­?ï¼?缺ç???¼ä¸º1ï¼?表示容è?ï¼?该å?¼æ?????¶ï?ä¼?对æ??件è?è¡?ç¼?å­?ï¼??¿å??é¢?ç¹???è¿?è¡?ç£?????件æ??ä½???

MaxCacheFileSizeï¼???大ç?å­?????件尺寸ï?缺ç???¼ä¸º5(??ä½?M)ï¼?å°?äº?该å?¼ç????件ä???è½½å?°å??å­?ä¸????ç»?????ä¸???ä»?ç£???ä¸?????????´æ?¥è???å­???

HttpServerç±»å??设置

??è¿?ContentType.ini该é??ç½???件ï??¨æ?·å??·»????å®???件类????Content-Typeç±»å??ï¼?å½?æµ?è§???/a>ä»????¡å?¨è?????件æ?¶ï?

???¡å?¨ä??¹æ?????ç½???件è?????å®???Content-Typeç»?æµ?è§??¨ã??

??ç½??¼å?为å?ä¸?ï¼?.??件æ?©å???:Content-Type

.mp4:video/mp4ï¼?表示å¦?????p4??件ï???Content-Typeä¸?ideo/mp4??

.cc:text/plainï¼?表示å¦?????c??件ï???ent-Typeä¸?ext/plain??

HttpServerç½??³è?ç½?/p>

CGIç½??³è?ç½???GI.xml??件中???????¹å???å¦?ä¸?ï¼?

pathï¼?CGIç½??³æ??件æ???¨ç?????ï¼?è¿??????¨è·¯å¾?ï¼?该路å¾?ä¸?ä¸?å®??¨å??å¸???web???ä¸?(ä¸???eb???ä¸?ä¼??´å?????

timeoutï¼??§è?ç½??³ç?åº???è¶??¶ï???ä½?ç§?ï¼?缺ç???¼ä¸º10ç§?ï¼??²æ?????ç½??³ç?åº?ä¸????ºï????¿æ?¶é?´ä????ºã??

cgiï¼?å­????¹ï?æ¯?ä¸?giå­????¹ä»£è¡¨ä?ä¸?GIç½??³ç±»????

cgi/nameï¼?è¯?GI???¹å??称ï?æ¯?å¦?pythonï¼?表示è¯?GIä¸???ç½??³æ??件æ??ython??????

cgi/exeï¼??§è?该è??????åº??¨ç?åº??¨è·¯å¾?ï¼?å¦?ï¼?c:python25python.exe??

cgi/actionï¼???åº???ç½??该è???¹ä»£è¡¨ä?ä¸???è¦?å¤?????Http请æ??½ä»¤(?¨æ???¡ç???为ä?ä¸????ï¼?该è???¹æ??两个å­?段ï?å¦?ä¸?ï¼?

cgi/action/appnameï¼?urlä¸???请æ??½ä»¤(åº??¨å??)ï¼?å¦?ï¼?python/test1.do

cgi/action/filenameï¼?å¤???ä¸?è¿°è?æ±?????件ï?å¦?ï¼?test1.pyï¼?该æ??件å?é¡»å?¨ä?è¿?ath???¹æ??å®??????ä¸???

说æ??ï¼?å½??¨æ?·å???? http://server:port/python/test1.do请æ??¶ï?ç½??³ä??§è?test1.py?????并å??????§è???ç»???è¿???ç»?æµ?è§??¨ã??

1??QUERY-SRING?°æ????ä¼???

python/test1.do?key1=value1&key2=value2

"key1=value1&key2=value2"ä¼???è¿??½ä»¤è¡????°ç???¹å?ä¼???ç»?è°??¨è????

pythonä¸?¸ºï¼?sys.argv[1]ï¼?è¯þA?æ¡?ä¾?ï¼?test2.py??

2??POST-DATA?°æ????ä¼???

POST?°æ????ä¼?????è¿?读å????????è¾??¥è?·å??ï¼?pythonä¸?¸ºï¼?sys.stdin.readline()ï¼?è¯þA?æ¡?ä¾?ï¼?test1.py??

注æ??ï¼?

1??HttpServer没æ????è¿?????????¥ä???QUERY-STRING;

2??CGIç½??³æ?°æ??????¶ï????¡å?¨ä????¨æ·»??Content-Lengthå­?æ®??¹æ??????°æ????rnrn???¥è?ç®?HTTP??åº?头å????åº?ä½????????¿åº¦);

3??å¦???CGIç½??³è????°æ??¸­æ²¡æ??"rnrn"?¥å????TTP??åº?头å????åº?ä½?ï¼??????¡å?¨ä?认为??åº??°æ????????ï¼?并è???¨æ·»??ç±»å??为â??text/plain??????åº?头ï?并è???ç»?æµ?è§???

?¨æ?·å???¹æ????è¦???ç½??ä¸?giå­????¹ï??¨ä?å¤???ä¸???ç±»å????ç½??³ç?åº?(???????? cgi??ç½???ä¿??????¹æ??两个ï¼?ä¸?ä¸???atï¼?ä¸?ä¸???xe??对ä?windowsä¸???bat?¼å???????件ï??????è¦???å®??§è?ç¨?åº?ï¼?????xe??件ä?????

?¹å?»æ?å¤?ä¸?è½½ï?ç½??³æ?ä¾???件å??gi-bin???ä¸?/p>

ç½??³é??ç½???件å?ä¸?ï¼?

python ç½??³æ??件æ?ä¾?ï¼?

BAT?¹å???ç½??³æ??件æ?ä¾?ï¼?

exeç½??³æ??件æ?ä¾?ï¼?

HttpServer??ç½??ä¼??¥å??/p>

?¥å?£å??称ï?command/upload.do

使ç??ost?½ä»¤ï¼??????件ä?ä¼???eb??å¸??????

å¦???è¦?å°???件ä?ä¼???eb?????å­????ä¸??????è¿?path???°æ??å®?ï¼?å¦?ä¸?

command/upload.do?path=subfolderï¼?subfolder为ç?¸å?äº?web???ä¸???å­??????

HttpServer?´æ?°æ?¥å?

ç»????´å?ºä?ï¼?

BUG?»æ??è¸?/p>

?¸å?³æ??ç«?

    �??��/p>

    0?¡è?è®?/p>

      ??ç±»å??è¡?/p>

      ???ºè½¯ä»?/a> 游æ??大å?? 驱å?¨ç?åº? ?¶å?è½?»¶ ??æ¯?å®???/a> å¤?åª?ä½?ç±?/a> ?¾å½¢?¾å?? ??天软ä»?/a> åº??¨è½¯ä»?/a> ç³»ç?å·¥å??/a> ç½?ç»?è½?»¶

      ???¨å????