雲端計算學習路線教程大綱課件:關於HTTP Server

千鋒雲端計算發表於2019-10-21

雲端計算學習路線教程大綱課件:關於HTTP Server:

雲端計算學習路線教程大綱課件:關於HTTP Server

========================================================

靜態元素: .html .img js css swf mp4

動態元素: .php .jsp .cgi .asp php SQL

Web Server:

Nginx(Tengine)、Apache、IIS

Web 中介軟體:

php: PHP-fpm、HHVM

jsp: Tomcat、JBOSS、Resin、IBM WebSphere

常見組合方式:

LNMP (Linux + Nginx + MySQL + PHP) //php-fpm程式

LAMP (Linux + Apache + MySQL + PHP) //php作為Apache的模組

Nginx + Tomcat //取代Apache與Tomcat結合

========================================================

server:

#coding=utf-8

from BaseHTTPServer import BaseHTTPRequestHandler

import cgi

class PostHandler(BaseHTTPRequestHandler):

def do_POST(self):

form = cgi.FieldStorage(

fp=self.rfile,

headers=self.headers,

environ={'REQUEST_METHOD':'POST',

'CONTENT_TYPE':self.headers['Content-Type'],

}

self.send_response(200)

self.end_headers()

self.wfile.write('Client: %sn ' % str(self.client_address) )

self.wfile.write('User-agent: %sn' % str(self.headers['user-agent']))

self.wfile.write('Path: %sn'%self.path)

self.wfile.write('Form data:n')

for field in form.keys():

field_item = form[field]

filename = field_item.filename

filevalue = field_item.value

filesize = len(filevalue)#檔案大小(位元組)

#print len(filevalue)

#print (filename)

with open(filename.decode('utf-8'),'wb') as f:

f.write(filevalue)

return

def StartServer():

from BaseHTTPServer import HTTPServer

sever = HTTPServer(("",8080),PostHandler)

sever.serve_forever()

if __name__=='__main__':

StartServer()

client:

#coding=utf-8

import requests

url = "

path = "/home/ly/ly.exe"

print path

files = {'file': open(path, 'rb')}

r = requests.post(url, files=files)

print (r.url)

print (r.text)


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69916964/viewspace-2660808/,如需轉載,請註明出處,否則將追究法律責任。

相關文章