Get the App
SLTechnology News&Howtos  ›  Servers  › 

Cloud Computing Learning Route course syllabus Courseware: about HTTP Server

Shulou Source: shulou.com Published: 2022-06-02 09:46:07 09月24日 Update

Cloud Computing Learning Route course outline Courseware: about HTTP Server:

=

Static element: .html .img js css swf mp4

Dynamic element: .php .jsp .cgi .asp php SQL

Web Server:

Nginx (Tengine), Apache, IIS

Web middleware:

Php: PHP-fpm 、 HHVM

Jsp: Tomcat 、 JBOSS 、 Resin 、 IBM WebSphere

Common combinations:

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

LAMP (Linux + Apache + MySQL + PHP) / / php as the module of Apache

Nginx + Tomcat / / replace Apache and combine with 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) # File size (in bytes)

# 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 = "http://172.16.1.101:8080"

Path = "/ home/ly/ly.exe"

Print path

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

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

Print (r.url)

Print (r.text)

Tags: Elements syllabus tutorials courseware routes learning middleware dynamic size bytes common files methods modules processes static combinations Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MySQL OPPO Reno Shulou Information Linux