Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Cloud Computing Learning Route course syllabus Courseware: about HTTP Server

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

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)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report