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cgi?requestType=3Dregister&name;=3Dusername&address;= =3Dip=B5=D8=D6=B7:=B6=CB=BF=DA=BA=C5 >=20 > =D7=A2=B2=E1=B3=C9=B9=A6=BA=F3=A3=AC=B5=C3=B5=BD=C8=E7=CF=C2XML=BB=D8=B8= =B4 >> RegisterReply >true >Tue 8 Mar, 2005 11:01:02 > >=20 > =CD=A8=B9=FDhttp://Server/~brooks/682/peerdb.cgi?requestType=3Dunregister= &name;=3D > =BF=C9=D2=D4=D4=DAAddress Server=C0=EF=D7=A2=CF=FA >=20 > Address Server=BB=B9=D6=A7=B3=D6=D5=E2=D1=F9=B5=C4=B2=D9=D7=F7 > http://server/peerdb.cgi?requestType=3DfindAllPeers > =BF=C9=D2=D4=B2=E9=D1=AF=B5=BD=CB=F9=D3=D0=D4=DA=CF=DF=B5=C4Peers >=20 > =B5=C3=B5=BD=C8=E7=CF=C2XML=BB=D8=B8=B4 >> UserListReply >true >Tue 8 Mar, 2005 11:01:02 >> > liudehua > 192.3.55.6:8000 > >> zhangxueyou > 133.66.197.2:8000 > >> guofucheng > 132.6.55.1:8000 > > > >=20 > =B5=B1=D3=C3=BB=A7=CF=EB=B2=E9=D1=AF=B8=E8=C7=FA=B5=C4=CA=B1=BA=F2 > =B7=A2=CB=CD=C8=E7=CF=C2=C7=EB=C7=F3=B8=F8=CB=F9=D3=D0=D4=DA=CF=DF=B5=C4P= eers > http://otherpeers:port?requestType=3Dsearch&field;=3Dartist&keyword;=3Dzhou= jielun >=20 > Peers=BD=D3=B5=BD=D5=E2=D1=F9=B5=C4=C7=EB=C7=F3=BA=F3=A3=AC=D2=AA=B4=D3= =D7=D4=BC=BA=B5=C4XML=CA=FD=BE=DD=BF=E2=C0=EF=B2=E9=D1=AF=CA=C7=B7=F1=D3=D0= =B7=FB=BA=CF=CC=F5=BC=FE=B5=C4=B8=E8=C7=FA=A3=AC=B2=A2=B8=F8=D3=EB=CF=C2=C3= =E6=B8=F1=CA=BD=B5=C4XML=BB=D8=B8=B4=A1=A3 >=20 > =B4=CBXML=CA=FD=BE=DD=BF=E2=B2=BB=D2=AA=C7=F3=C4=DC=CD=A8=B9=FDClient=B8= =FC=D0=C2=A3=AC=D2=B2=BE=CD=CA=C7=CB=B5=D4=DA=D2=BB=BF=AA=CA=BC=BD=A8=BA=C3= =D2=BB=B8=F6=D5=E2=D1=F9=B5=C4=CA=FD=BE=DD=BF=E2=A3=AC=B7=C5=C9=CF=BC=B8=B8= =F6=B8=E8=BE=CDOK=C1=CB=A3=AC=B8=F1=CA=BD=D2=B2=B2=BB=D3=C3=B8=FA=CF=C2=C3= =E6=B5=C4XML=D2=BB=D6=C2=A3=AC=B5=BD=CA=B1=BA=F2=CD=A8=B9=FDXSLT=D7=AA=BB= =BB=D2=BB=CF=C2=BE=CDOK >=20 >> SearchReply >true >Tue 8 Mar, 2005 11:01:02 > >> > Police Truck >Dead Kennedys >Give Me Convenience Or Give Me Death >Punk >http://111.111.111.111:8080/123.mp3 > >16433776 >Mon 7 Mar, 2005 11:01:02 >dfsdfsdfsfdfsddfs > > ... > > > >=20 > =B7=A2=B3=F6=B2=E9=D1=AF=C7=EB=C7=F3=B5=C4Peers=B0=D1=B5=C3=B5=BD=B5=C4XM= L=B7=AD=D2=EB=B3=F6=C0=B4=B8=F8=D3=C3=BB=A7=D4=C4=B6=C1=A3=AC=D3=C3=BB=A7= =D1=A1=D4=F1=CF=C2=D4=D8=C4=C4=CA=D7=B8=E8=C7=FA >=20 > =D3=C3=BB=A7=BE=F6=B6=A8=CF=C2=D4=D8=BA=F3=A3=ACPeer=B8=F9=BE=DD=C9=CF=C3= =E6XML=C0=EF=B5=C4URL=A3=AC=B7=A2=B3=F6HTTP GET=C7=EB=C7=F3=A1=A3=D4=B6=B7= =BDPeer=CF=EC=D3=A6=B4=CB=C7=EB=C7=F3=A3=AC=B0=D1=CE=C4=BC=FE=B4=AB=B9=FD= =C8=A5=A1=A3 >=20 > =BB=F9=B1=BE=B5=C4=B9=A6=C4=DC=D2=AA=C7=F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C=D3=A6=D7=A2=B2=E1=BA=CD=B2=E9=D1=AF=C7=EB=C7=F3=B5= =C4=BD=C5=B1=BE=20 > =D2=BB=B8=F6=BD=C5=B1=BE=A3=AC=C4=A3=C4=E2peers=C0=B4=CF=EC=D3=A6=B2=E9= =D1=AF=B8=E8=C7=FA=B5=C4=C7=EB=C7=F3=B2=A2=B8=F8=B3=F6XML=A1=A3=20 > =BB=B9=D3=D0=D2=BB=B8=F6Web Service=B5=C4=CA=BE=C0=FD=B4=FA=C2=EB=20 > =20 > =20 > Peerdb.cgi=20 > =20 > #!/usr/bin/python=20 > =20 > ### a simple cgi script to manage registration of peers. > ### requestTypes: register, findAllPeers, unregister=20 > =20 > from xml.dom.ext import PrettyPrint > from xml.dom import minidom > import sys > import sys, cgi, time > import cgitb; cgitb.enable()=20 > =20 > =20 > def registerUser(form) : > username =3D form['name'].value > useraddr =3D form['address'].value=20 > =20 > users =3D minidom.parse('./userdb.xml')=20 > =20 > usernode =3D users.createElement('user') > namenode =3D users.createElement('name') > addrnode =3D users.createElement('address') > namenode.appendChild(users.createTextNode(username)) > addrnode.appendChild(users.createTextNode(useraddr)) > usernode.appendChild(namenode) > usernode.appendChild(addrnode)=20 > =20 > toplevel =3D users.getElementsByTagName('users')[0] > toplevel.appendChild(usernode)=20 > =20 > f =3D file('./userdb.xml','w') > f.write(users.toxml()) > f.close()=20 > =20 > str =3D > "\n > str +=3D "RegisterReply \ntrue \n"" + time.strftime("%a, %d %b %Y %H:%M:%S", > time.localtime()) > str =3D str + "\n\n"=20 > =20 > print str=20 > =20 > def findAllPeers(form) :=20 > =20 > users =3D minidom.parse('./userdb.xml') > replyNode =3D users.createElement('reply') > typeNode =3D users.createElement('type') > typeNode.appendChild(users.createTextNode('UserListReply')) > statusNode =3D users.createElement('success') > statusNode.appendChild(users.createTextNode('true')) > dateNode =3D users.createElement('dateTime') > dateNode.appendChild(users.createTextNode(time.strftime("%a, %d %b %Y > %H:%M:%S", time.localtime()))) > replyNode.appendChild(typeNode) > replyNode.appendChild(statusNode) > replyNode.appendChild(dateNode)=20 > =20 > oldroot =3D users.getElementsByTagName('users')[0] > replyNode.appendChild(oldroot)=20 > =20 > print replyNode.toxml()=20 > =20 >=20 > def unregisterUser(form) :=20 > =20 >=20 > username =3D form['name'].value > users =3D minidom.parse('./userdb.xml') > u =3D users.getElementsByTagName('name') > for item in u : > if item.firstChild.data.strip() =3D=3D username.strip() : > #print item.firstChild.data.strip() > toplevel =3D users.getElementsByTagName('users')[0] > toplevel.removeChild(item.parentNode)=20 > =20 > f =3D file('./userdb.xml','w') > f.write(users.toxml()) > f.close()=20 > =20 > str =3D > "\n > str +=3D "RegisterReply \ntrue \n"" + time.strftime("%a, %d %b %Y %H:%M:%S", > time.localtime()) > str =3D str + "\n\n"=20 > =20 > print str=20 > =20 >=20 > =20 > form=3Dcgi.FieldStorage() > =20 > print 'Content type: text/xml' > print=20 > =20 >=20 > request =3D form["requestType"].value=20 > =20 > if request =3D=3D 'register' : > registerUser(form); > elif request =3D=3D 'findAllPeers' : > findAllPeers(form)=20 > elif request =3D=3D 'unregister' : > unregisterUser(form)=20 > =20 > =20 > =20 > testSearch.cgi=20 >=20 > =20 > #!/usr/bin/python=20 > =20 > ### a simple cgi script to allow testing of search queries=20 > =20 >=20 > from xml.dom.ext import PrettyPrint > from xml.dom import minidom > import sys > import sys, cgi, time > import cgitb; cgitb.enable()=20 > =20 > form=3Dcgi.FieldStorage()=20 > =20 > field=3Dform['field'].value > keyword=3Dform['keyword'].value=20 > =20 > songs =3D minidom.parse('./sampleDB/music.xml') > nodes =3D songs.getElementsByTagName(field)=20 > =20 > print 'Content type: text/xml' > print=20 > =20 >=20 > results =3D [] > for node in nodes : > if node.firstChild.data =3D=3D keyword: > results.append(node.parentNode)=20 > =20 >=20 > replyNode =3D songs.createElement('reply') > typeNode =3D songs.createElement('type') > typeNode.appendChild(songs.createTextNode('UserListReply')) > statusNode =3D songs.createElement('success') > statusNode.appendChild(songs.createTextNode('true')) > dateNode =3D songs.createElement('dateTime') > dateNode.appendChild(songs.createTextNode(time.strftime("%a, %d %b %Y > %H:%M:%S", time.localtime())))=20 > =20 > songNode =3D songs.createElement('songs') > for item in results : > songNode.appendChild(item) > replyNode.appendChild(typeNode) > replyNode.appendChild(statusNode) > replyNode.appendChild(dateNode) > replyNode.appendChild(songNode)=20 > =20 > print replyNode.toxml()=20 > =20 > =20 > =20 > =D7=EE=BA=F3=D2=BB=B6=CE=CA=C7HTTP =C7=EB=C7=F3=B5=C4=B4=FA=C2=EB=20 > =20 >=20 > Here is a simple program that processes HTTP requests, checks to see if t= he > request has parameters attached, and then returns 'hello world' to the > client.=20 >=20 > In Python, you provide the BaseHTTPServer class with a handler that is > responsible for servicing GET and POST requests. (we are only dealing wit= h > GET in this project.) It should inherit from both CGIHTTPRequestHandler a= nd > object. (see the comment for an explanation of this.)=20 >=20 > do_GET is invoked by the BaseHTTPServer whenever a GET request is receive= d. > This is where you'll do your work. If you like, you can invoke a separate > CGI script at this point.=20 >=20 > The first thing to notice is that this DOES NOT work the way that the cgi > module does. In particular, stdout is not redirected back to the client. > Instead, self.wfile is returned to the client. So, to send back a file, u= se > self.copyfile, which is inherited from BaseHTTPRequestHandler.=20 >=20 > Also, in this code, I want to send back a string, rather than a file. I > could write the data out to a temp file, but that's messy, so I use the > StringIO class. It provides a String that has an associated file handle, = so > it can be manipulated just like a file. In this case, I write to the stri= ng, > then use seek to reset the file pointer, then self.copyfile to move the > 'file contents' onto the output stream.=20 >=20 > self.path includes everything in the URL after the hostname and port. Thi= s > is where you will extract arguments.=20 >=20 > Note that, if path doesn't contain a '?', I call the superclass' do_GET > method. The syntax for doing this is a little odd. super takes the name o= f a > type and the object to be referenced, and returns a new object of the > superclass' type. In order for this to work, you must (indirectly) inheri= t > from object.=20 >=20 > self.send_header() can be used to send back any necessary HTTP headers. T= ake > a look at the BaseHTTPRequestHandler (in BaseHTTPServer) and the > CGIHTTPRequestHandler (in CGIHTTPServer) for more usage.=20 >=20 > saddr is the host, port tuple ('' is localhost) - when starting an > HTTPServer, you should provide a saddr and a handler.=20 >=20 > import SimpleHTTPServer, BaseHTTPServer, httplib > from CGIHTTPServer import CGIHTTPRequestHandler > from StringIO import StringIO >=20 >=20 > =20 > ### in order for super() to work, myHandler must be a 'new-style object' > ### old-style objects work like objects in C++ - they ae a classobj, rath= er > ### than a type. They are not required to have a superclass. > ### although myHandler has a superclass, apparently CGIHTTPRequestHandler > ### does not derive from object. > ### To get new-style class behavior, we also derive from object. A strang= e > ### hack to preserve both methods of OO ... >=20 > class myHandler(CGIHTTPRequestHandler,object) : > def do_GET(self) : > if self.path.find('?') > 0 :=20 > args =3D self.parsePath(self.path) > print args > print 'doing get' > f=3DStringIO() > f.write('hello wold') > self.send_header("Content-type", "text/html") > self.send_header("Content-Length", 11) > self.end_headers() > f.seek(0) > self.copyfile(f, self.wfile) > else : > super(myHandler,self).do_GET() >=20 > def parsePath(self, pathString) : > args =3D pathString.split('?')[1] > pairs =3D [s.split('=3D') for s in args.split('&')] > pairDict =3D {} > for item in pairs : > pairDict[item[0]] =3D item[1] > return pairDict >=20 >=20 > saddr=3D("",8000) > m=3DBaseHTTPServer.HTTPServer(saddr, myHandler) > m.serve_forever() >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 > =20 --=20 [Time is unimportant, only life important!]
2005年04月07日 星期四 10:52
=D0=BB=D0=BB=C4=E3=B5=C4=BB=D8=B8=B4 =B2=BB=B9=FD=CE=CA=CC=E2=C9=D4=CE=A2=D3=D0=D0=A9=C6=AB=B2=EE=A1=A3P2P=B5=C4= =B8=C5=C4=EE=CA=C7=C3=BB=CE=CA=CC=E2=B5=C4=A1=A3=A3=BA=A3=A9 =C4=C7=B8=F6=CB=F9=CE=BD=B5=C4Address Server=C6=E4=CA=B5=D6=BB=CA=C7=D2=BB= =B8=F6Python=D0=B4=B3=C9=B5=C4CGI=BD=C5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C=D6=BB=D3=D0=C8=FD=CB=C4= =CC=EC=C1=CB=A1=A3 > > > > =CE=D2=D4=DA=B0=D1=B5=B1=CA=B1Pythoncn=C9=CF=B5=C4=B6=AB=CE=F7copy&past;= e=D2=BB=CF=C2 > > > > P2P=B9=B2=CF=ED=D2=F4=C0=D6=BF=CD=BB=A7=B6=CB=CF=EE=C4=BF > > > > =BF=CD=BB=A7=B6=CB=B9=A6=C4=DC=D2=AA=C7=F3=A3=BA > > =D4=DA=D2=D1=BE=AD=CC=E1=B9=A9=B5=C4Address Server=C9=CF=D7=A2=B2=E1=D3= =EB=D7=A2=CF=FA > > =CD=A8=B9=FDAddress Server=B2=E9=D1=AF=C6=E4=CB=FB=D4=DA=CF=DF=B5=C4Pee= rs > > =B7=A2=CB=CD=B2=E9=D1=AF=C7=EB=C7=F3=B5=BD=C6=E4=CB=FBPeers > > =CF=EC=D3=A6=C6=E4=CB=FBPeers=B5=C3=B2=E9=D1=AF=C7=EB=C7=F3 > > =B4=D3=C6=E4=CB=FBPeers=C9=CF=C7=EB=C7=F3=CE=C4=BC=FE=CF=C2=D4=D8 > > =CF=EC=D3=A6=C6=E4=CB=FBPeers=B5=C3=CE=C4=BC=FE=CF=C2=D4=D8=C7=EB=C7=F3 > > > > =D3=C3=E4=AF=C0=C0=C6=F7=D7=F7=CE=AA=D3=EB=D3=C3=BB=A7=BD=BB=C1=F7=B5= =C4=BD=E7=C3=E6 > > > > =C4=BF=C7=B0Address Server=D2=D1=BE=AD=CC=E1=B9=A9=C1=CB > > > > =CD=A8=B9=FD=D5=E2=D1=F9=B5=C4URI=BF=C9=D2=D4=CA=B5=CF=D6=D4=DAAddress = Server=C9=CF=D7=A2=B2=E1 > > > > http://Server/peerdb.cgi?requestType=3Dregister&name;=3Dusername&address;= =3Dip=B5=D8=D6=B7:=B6=CB=BF=DA=BA=C5 > > > > =D7=A2=B2=E1=B3=C9=B9=A6=BA=F3=A3=AC=B5=C3=B5=BD=C8=E7=CF=C2XML=BB=D8= =B8=B4 > >> > RegisterReply > >true > >Tue 8 Mar, 2005 11:01:02 > > > > > > =CD=A8=B9=FDhttp://Server/~brooks/682/peerdb.cgi?requestType=3Dunregist= er&name;=3D > > =BF=C9=D2=D4=D4=DAAddress Server=C0=EF=D7=A2=CF=FA > > > > Address Server=BB=B9=D6=A7=B3=D6=D5=E2=D1=F9=B5=C4=B2=D9=D7=F7 > > http://server/peerdb.cgi?requestType=3DfindAllPeers > > =BF=C9=D2=D4=B2=E9=D1=AF=B5=BD=CB=F9=D3=D0=D4=DA=CF=DF=B5=C4Peers > > > > =B5=C3=B5=BD=C8=E7=CF=C2XML=BB=D8=B8=B4 > >> > UserListReply > >true > >Tue 8 Mar, 2005 11:01:02 > >> > > > liudehua > > 192.3.55.6:8000 > > > >> > zhangxueyou > > 133.66.197.2:8000 > > > >> > guofucheng > > 132.6.55.1:8000 > > > > > > > > > > =B5=B1=D3=C3=BB=A7=CF=EB=B2=E9=D1=AF=B8=E8=C7=FA=B5=C4=CA=B1=BA=F2 > > =B7=A2=CB=CD=C8=E7=CF=C2=C7=EB=C7=F3=B8=F8=CB=F9=D3=D0=D4=DA=CF=DF=B5= =C4Peers > > http://otherpeers:port?requestType=3Dsearch&field;=3Dartist&keyword;=3Dzh= oujielun > > > > Peers=BD=D3=B5=BD=D5=E2=D1=F9=B5=C4=C7=EB=C7=F3=BA=F3=A3=AC=D2=AA=B4=D3= =D7=D4=BC=BA=B5=C4XML=CA=FD=BE=DD=BF=E2=C0=EF=B2=E9=D1=AF=CA=C7=B7=F1=D3=D0= =B7=FB=BA=CF=CC=F5=BC=FE=B5=C4=B8=E8=C7=FA=A3=AC=B2=A2=B8=F8=D3=EB=CF=C2=C3= =E6=B8=F1=CA=BD=B5=C4XML=BB=D8=B8=B4=A1=A3 > > > > =B4=CBXML=CA=FD=BE=DD=BF=E2=B2=BB=D2=AA=C7=F3=C4=DC=CD=A8=B9=FDClient= =B8=FC=D0=C2=A3=AC=D2=B2=BE=CD=CA=C7=CB=B5=D4=DA=D2=BB=BF=AA=CA=BC=BD=A8=BA= =C3=D2=BB=B8=F6=D5=E2=D1=F9=B5=C4=CA=FD=BE=DD=BF=E2=A3=AC=B7=C5=C9=CF=BC=B8= =B8=F6=B8=E8=BE=CDOK=C1=CB=A3=AC=B8=F1=CA=BD=D2=B2=B2=BB=D3=C3=B8=FA=CF=C2= =C3=E6=B5=C4XML=D2=BB=D6=C2=A3=AC=B5=BD=CA=B1=BA=F2=CD=A8=B9=FDXSLT=D7=AA= =BB=BB=D2=BB=CF=C2=BE=CDOK > > > >> > SearchReply > >true > >Tue 8 Mar, 2005 11:01:02 > > > >> > > > Police Truck > >Dead Kennedys > >Give Me Convenience Or Give Me Death > >Punk > >http://111.111.111.111:8080/123.mp3 > > >16433776 > >Mon 7 Mar, 2005 11:01:02 > >dfsdfsdfsfdfsddfs > > > > ... > > > > > > > > > > =B7=A2=B3=F6=B2=E9=D1=AF=C7=EB=C7=F3=B5=C4Peers=B0=D1=B5=C3=B5=BD=B5=C4= XML=B7=AD=D2=EB=B3=F6=C0=B4=B8=F8=D3=C3=BB=A7=D4=C4=B6=C1=A3=AC=D3=C3=BB=A7= =D1=A1=D4=F1=CF=C2=D4=D8=C4=C4=CA=D7=B8=E8=C7=FA > > > > =D3=C3=BB=A7=BE=F6=B6=A8=CF=C2=D4=D8=BA=F3=A3=ACPeer=B8=F9=BE=DD=C9=CF= =C3=E6XML=C0=EF=B5=C4URL=A3=AC=B7=A2=B3=F6HTTP GET=C7=EB=C7=F3=A1=A3=D4=B6= =B7=BDPeer=CF=EC=D3=A6=B4=CB=C7=EB=C7=F3=A3=AC=B0=D1=CE=C4=BC=FE=B4=AB=B9= =FD=C8=A5=A1=A3 > > > > =BB=F9=B1=BE=B5=C4=B9=A6=C4=DC=D2=AA=C7=F3=BE=CD=CA=C7=D5=E2=D1=F9=C1= =CB=A1=A3 > > =D2=F2=CE=AA=D6=BB=CA=C7=B8=F6=BD=CC=D1=A7=C4=BF=B5=C4=B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B4=CF=EC=D3=A6=B2=E9= =D1=AF=B8=E8=C7=FA=B5=C4=C7=EB=C7=F3=B2=A2=B8=F8=B3=F6XML=A1=A3 > > =BB=B9=D3=D0=D2=BB=B8=F6Web Service=B5=C4=CA=BE=C0=FD=B4=FA=C2=EB > > > > > > Peerdb.cgi > > > > #!/usr/bin/python > > > > ### a simple cgi script to manage registration of peers. > > ### requestTypes: register, findAllPeers, unregister > > > > from xml.dom.ext import PrettyPrint > > from xml.dom import minidom > > import sys > > import sys, cgi, time > > import cgitb; cgitb.enable() > > > > > > def registerUser(form) : > > username =3D form['name'].value > > useraddr =3D form['address'].value > > > > users =3D minidom.parse('./userdb.xml') > > > > usernode =3D users.createElement('user') > > namenode =3D users.createElement('name') > > addrnode =3D users.createElement('address') > > namenode.appendChild(users.createTextNode(username)) > > addrnode.appendChild(users.createTextNode(useraddr)) > > usernode.appendChild(namenode) > > usernode.appendChild(addrnode) > > > > toplevel =3D users.getElementsByTagName('users')[0] > > toplevel.appendChild(usernode) > > > > f =3D file('./userdb.xml','w') > > f.write(users.toxml()) > > f.close() > > > > str =3D > > "\n > > str +=3D "RegisterReply \ntrue \n"" + time.strftime("%a, %d %b %Y %H:%M:%S", > > time.localtime()) > > str =3D str + "\n\n" > > > > print str > > > > def findAllPeers(form) : > > > > users =3D minidom.parse('./userdb.xml') > > replyNode =3D users.createElement('reply') > > typeNode =3D users.createElement('type') > > typeNode.appendChild(users.createTextNode('UserListReply')) > > statusNode =3D users.createElement('success') > > statusNode.appendChild(users.createTextNode('true')) > > dateNode =3D users.createElement('dateTime') > > dateNode.appendChild(users.createTextNode(time.strftime("%a, %d %b = %Y > > %H:%M:%S", time.localtime()))) > > replyNode.appendChild(typeNode) > > replyNode.appendChild(statusNode) > > replyNode.appendChild(dateNode) > > > > oldroot =3D users.getElementsByTagName('users')[0] > > replyNode.appendChild(oldroot) > > > > print replyNode.toxml() > > > > > > def unregisterUser(form) : > > > > > > username =3D form['name'].value > > users =3D minidom.parse('./userdb.xml') > > u =3D users.getElementsByTagName('name') > > for item in u : > > if item.firstChild.data.strip() =3D=3D username.strip() : > > #print item.firstChild.data.strip() > > toplevel =3D users.getElementsByTagName('users')[0] > > toplevel.removeChild(item.parentNode) > > > > f =3D file('./userdb.xml','w') > > f.write(users.toxml()) > > f.close() > > > > str =3D > > "\n > > str +=3D "RegisterReply \ntrue \n"" + time.strftime("%a, %d %b %Y %H:%M:%S", > > time.localtime()) > > str =3D str + "\n\n" > > > > print str > > > > > > > > form=3Dcgi.FieldStorage() > > > > print 'Content type: text/xml' > > print > > > > > > request =3D form["requestType"].value > > > > if request =3D=3D 'register' : > > registerUser(form); > > elif request =3D=3D 'findAllPeers' : > > findAllPeers(form) > > elif request =3D=3D 'unregister' : > > unregisterUser(form) > > > > > > > > testSearch.cgi > > > > > > #!/usr/bin/python > > > > ### a simple cgi script to allow testing of search queries > > > > > > from xml.dom.ext import PrettyPrint > > from xml.dom import minidom > > import sys > > import sys, cgi, time > > import cgitb; cgitb.enable() > > > > form=3Dcgi.FieldStorage() > > > > field=3Dform['field'].value > > keyword=3Dform['keyword'].value > > > > songs =3D minidom.parse('./sampleDB/music.xml') > > nodes =3D songs.getElementsByTagName(field) > > > > print 'Content type: text/xml' > > print > > > > > > results =3D [] > > for node in nodes : > > if node.firstChild.data =3D=3D keyword: > > results.append(node.parentNode) > > > > > > replyNode =3D songs.createElement('reply') > > typeNode =3D songs.createElement('type') > > typeNode.appendChild(songs.createTextNode('UserListReply')) > > statusNode =3D songs.createElement('success') > > statusNode.appendChild(songs.createTextNode('true')) > > dateNode =3D songs.createElement('dateTime') > > dateNode.appendChild(songs.createTextNode(time.strftime("%a, %d %b %Y > > %H:%M:%S", time.localtime()))) > > > > songNode =3D songs.createElement('songs') > > for item in results : > > songNode.appendChild(item) > > replyNode.appendChild(typeNode) > > replyNode.appendChild(statusNode) > > replyNode.appendChild(dateNode) > > replyNode.appendChild(songNode) > > > > print replyNode.toxml() > > > > > > > > =D7=EE=BA=F3=D2=BB=B6=CE=CA=C7HTTP =C7=EB=C7=F3=B5=C4=B4=FA=C2=EB > > > > > > Here is a simple program that processes HTTP requests, checks to see if= the > > request has parameters attached, and then returns 'hello world' to the > > client. > > > > In Python, you provide the BaseHTTPServer class with a handler that is > > responsible for servicing GET and POST requests. (we are only dealing w= ith > > GET in this project.) It should inherit from both CGIHTTPRequestHandler= and > > object. (see the comment for an explanation of this.) > > > > do_GET is invoked by the BaseHTTPServer whenever a GET request is recei= ved. > > This is where you'll do your work. If you like, you can invoke a separa= te > > CGI script at this point. > > > > The first thing to notice is that this DOES NOT work the way that the c= gi > > module does. In particular, stdout is not redirected back to the client= . > > Instead, self.wfile is returned to the client. So, to send back a file,= use > > self.copyfile, which is inherited from BaseHTTPRequestHandler. > > > > Also, in this code, I want to send back a string, rather than a file. I > > could write the data out to a temp file, but that's messy, so I use the > > StringIO class. It provides a String that has an associated file handle= , so > > it can be manipulated just like a file. In this case, I write to the st= ring, > > then use seek to reset the file pointer, then self.copyfile to move the > > 'file contents' onto the output stream. > > > > self.path includes everything in the URL after the hostname and port. T= his > > is where you will extract arguments. > > > > Note that, if path doesn't contain a '?', I call the superclass' do_GET > > method. The syntax for doing this is a little odd. super takes the name= of a > > type and the object to be referenced, and returns a new object of the > > superclass' type. In order for this to work, you must (indirectly) inhe= rit > > from object. > > > > self.send_header() can be used to send back any necessary HTTP headers.= Take > > a look at the BaseHTTPRequestHandler (in BaseHTTPServer) and the > > CGIHTTPRequestHandler (in CGIHTTPServer) for more usage. > > > > saddr is the host, port tuple ('' is localhost) - when starting an > > HTTPServer, you should provide a saddr and a handler. > > > > import SimpleHTTPServer, BaseHTTPServer, httplib > > from CGIHTTPServer import CGIHTTPRequestHandler > > from StringIO import StringIO > > > > > > > > ### in order for super() to work, myHandler must be a 'new-style object= ' > > ### old-style objects work like objects in C++ - they ae a classobj, ra= ther > > ### than a type. They are not required to have a superclass. > > ### although myHandler has a superclass, apparently CGIHTTPRequestHandl= er > > ### does not derive from object. > > ### To get new-style class behavior, we also derive from object. A stra= nge > > ### hack to preserve both methods of OO ... > > > > class myHandler(CGIHTTPRequestHandler,object) : > > def do_GET(self) : > > if self.path.find('?') > 0 : > > args =3D self.parsePath(self.path) > > print args > > print 'doing get' > > f=3DStringIO() > > f.write('hello wold') > > self.send_header("Content-type", "text/html") > > self.send_header("Content-Length", 11) > > self.end_headers() > > f.seek(0) > > self.copyfile(f, self.wfile) > > else : > > super(myHandler,self).do_GET() > > > > def parsePath(self, pathString) : > > args =3D pathString.split('?')[1] > > pairs =3D [s.split('=3D') for s in args.split('&')] > > pairDict =3D {} > > for item in pairs : > > pairDict[item[0]] =3D item[1] > > return pairDict > > > > > > saddr=3D("",8000) > > m=3DBaseHTTPServer.HTTPServer(saddr, myHandler) > > m.serve_forever() > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >=20 > -- > [Time is unimportant, only life important!] > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese >
2005年04月07日 星期四 11:16
=BA=D9=BA=D9=BA=D9! =CF=C8=BF=B4=D2=BB=CF=C2=D7=D3 CherryPy =BE=CD=D6=AA=B5=C0=C4=E3=CF=D6=D4= =DA=BF=D6=BE=E5=B5=C4 Server =BD=C5=B1=BE=B5=C4=D4=CB=D0=D0=CE=CA=CC=E2,=BD= =E2=BE=F6=B5=C4Pythonic =B7=BD=CA=BD=C1=CB! =B9=FE=B9=FE=B9=FE! "=C8=A5=B8=FA=D4=B6=B7=BDPeers=B9=B5=CD=A8" =D5=E2=B8=F6=B6=AF=D7=F7,=CA=D7=CF=C8=D2=AA=D6=AA=B5=C0 "=D4=B6=B7=BDPeers"= =B5=C4=D4=DA=C4=C4=C0=EF! =E0=C5=E0=C5,=D5=E2=BE=CD=B1=D8=D0=EB=D2=AA=D3=D0=D2=BB=B8=F6 Peer =C1=D0= =B1=ED=B5=C4=B7=FE=CE=F1=CC=E1=B9=A9=C1=CB,=D2=B2=BE=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=BF > > > > > > =BF=CD=BB=A7=B6=CB=B9=A6=C4=DC=D2=AA=C7=F3=A3=BA > > > =D4=DA=D2=D1=BE=AD=CC=E1=B9=A9=B5=C4Address Server=C9=CF=D7=A2=B2=E1= =D3=EB=D7=A2=CF=FA > > > =CD=A8=B9=FDAddress Server=B2=E9=D1=AF=C6=E4=CB=FB=D4=DA=CF=DF=B5=C4P= eers > > > =B7=A2=CB=CD=B2=E9=D1=AF=C7=EB=C7=F3=B5=BD=C6=E4=CB=FBPeers > > > =CF=EC=D3=A6=C6=E4=CB=FBPeers=B5=C3=B2=E9=D1=AF=C7=EB=C7=F3 > > > =B4=D3=C6=E4=CB=FBPeers=C9=CF=C7=EB=C7=F3=CE=C4=BC=FE=CF=C2=D4=D8 > > > =CF=EC=D3=A6=C6=E4=CB=FBPeers=B5=C3=CE=C4=BC=FE=CF=C2=D4=D8=C7=EB=C7= =F3 > > > > > > =D3=C3=E4=AF=C0=C0=C6=F7=D7=F7=CE=AA=D3=EB=D3=C3=BB=A7=BD=BB=C1=F7=B5= =C4=BD=E7=C3=E6 > > > > > > =C4=BF=C7=B0Address Server=D2=D1=BE=AD=CC=E1=B9=A9=C1=CB > > > > > > =CD=A8=B9=FD=D5=E2=D1=F9=B5=C4URI=BF=C9=D2=D4=CA=B5=CF=D6=D4=DAAddres= s Server=C9=CF=D7=A2=B2=E1 > > > > > > http://Server/peerdb.cgi?requestType=3Dregister&name;=3Dusername&addre;= ss=3Dip=B5=D8=D6=B7:=B6=CB=BF=DA=BA=C5 > > > > > > =D7=A2=B2=E1=B3=C9=B9=A6=BA=F3=A3=AC=B5=C3=B5=BD=C8=E7=CF=C2XML=BB=D8= =B8=B4 > > >> > > RegisterReply > > >true > > >Tue 8 Mar, 2005 11:01:02 > > > > > > > > > =CD=A8=B9=FDhttp://Server/~brooks/682/peerdb.cgi?requestType=3Dunregi= ster&name;=3D > > > =BF=C9=D2=D4=D4=DAAddress Server=C0=EF=D7=A2=CF=FA > > > > > > Address Server=BB=B9=D6=A7=B3=D6=D5=E2=D1=F9=B5=C4=B2=D9=D7=F7 > > > http://server/peerdb.cgi?requestType=3DfindAllPeers > > > =BF=C9=D2=D4=B2=E9=D1=AF=B5=BD=CB=F9=D3=D0=D4=DA=CF=DF=B5=C4Peers > > > > > > =B5=C3=B5=BD=C8=E7=CF=C2XML=BB=D8=B8=B4 > > >> > > UserListReply > > >true > > >Tue 8 Mar, 2005 11:01:02 > > >> > > > > > liudehua > > > 192.3.55.6:8000 > > > > > >> > > zhangxueyou > > > 133.66.197.2:8000 > > > > > >> > > guofucheng > > > 132.6.55.1:8000 > > > > > > > > > > > > > > > =B5=B1=D3=C3=BB=A7=CF=EB=B2=E9=D1=AF=B8=E8=C7=FA=B5=C4=CA=B1=BA=F2 > > > =B7=A2=CB=CD=C8=E7=CF=C2=C7=EB=C7=F3=B8=F8=CB=F9=D3=D0=D4=DA=CF=DF=B5= =C4Peers > > > http://otherpeers:port?requestType=3Dsearch&field;=3Dartist&keyword;=3D= zhoujielun > > > > > > Peers=BD=D3=B5=BD=D5=E2=D1=F9=B5=C4=C7=EB=C7=F3=BA=F3=A3=AC=D2=AA=B4= =D3=D7=D4=BC=BA=B5=C4XML=CA=FD=BE=DD=BF=E2=C0=EF=B2=E9=D1=AF=CA=C7=B7=F1=D3= =D0=B7=FB=BA=CF=CC=F5=BC=FE=B5=C4=B8=E8=C7=FA=A3=AC=B2=A2=B8=F8=D3=EB=CF=C2= =C3=E6=B8=F1=CA=BD=B5=C4XML=BB=D8=B8=B4=A1=A3 > > > > > > =B4=CBXML=CA=FD=BE=DD=BF=E2=B2=BB=D2=AA=C7=F3=C4=DC=CD=A8=B9=FDClient= =B8=FC=D0=C2=A3=AC=D2=B2=BE=CD=CA=C7=CB=B5=D4=DA=D2=BB=BF=AA=CA=BC=BD=A8=BA= =C3=D2=BB=B8=F6=D5=E2=D1=F9=B5=C4=CA=FD=BE=DD=BF=E2=A3=AC=B7=C5=C9=CF=BC=B8= =B8=F6=B8=E8=BE=CDOK=C1=CB=A3=AC=B8=F1=CA=BD=D2=B2=B2=BB=D3=C3=B8=FA=CF=C2= =C3=E6=B5=C4XML=D2=BB=D6=C2=A3=AC=B5=BD=CA=B1=BA=F2=CD=A8=B9=FDXSLT=D7=AA= =BB=BB=D2=BB=CF=C2=BE=CDOK > > > > > >> > > SearchReply > > >true > > >Tue 8 Mar, 2005 11:01:02 > > > > > >> > > > > > Police Truck > > >Dead Kennedys > > >Give Me Convenience Or Give Me Death > > >Punk > > >http://111.111.111.111:8080/123.mp3 > > > >16433776 > > >Mon 7 Mar, 2005 11:01:02 > > >dfsdfsdfsfdfsddfs > > > > > > ... > > > > > > > > > > > > > > > =B7=A2=B3=F6=B2=E9=D1=AF=C7=EB=C7=F3=B5=C4Peers=B0=D1=B5=C3=B5=BD=B5= =C4XML=B7=AD=D2=EB=B3=F6=C0=B4=B8=F8=D3=C3=BB=A7=D4=C4=B6=C1=A3=AC=D3=C3=BB= =A7=D1=A1=D4=F1=CF=C2=D4=D8=C4=C4=CA=D7=B8=E8=C7=FA > > > > > > =D3=C3=BB=A7=BE=F6=B6=A8=CF=C2=D4=D8=BA=F3=A3=ACPeer=B8=F9=BE=DD=C9= =CF=C3=E6XML=C0=EF=B5=C4URL=A3=AC=B7=A2=B3=F6HTTP GET=C7=EB=C7=F3=A1=A3=D4= =B6=B7=BDPeer=CF=EC=D3=A6=B4=CB=C7=EB=C7=F3=A3=AC=B0=D1=CE=C4=BC=FE=B4=AB= =B9=FD=C8=A5=A1=A3 > > > > > > =BB=F9=B1=BE=B5=C4=B9=A6=C4=DC=D2=AA=C7=F3=BE=CD=CA=C7=D5=E2=D1=F9=C1= =CB=A1=A3 > > > =D2=F2=CE=AA=D6=BB=CA=C7=B8=F6=BD=CC=D1=A7=C4=BF=B5=C4=B5=C4=CF=EE=C4= =BF=A3=AC=CB=F9=D2=D4=D5=E2=C0=EF=B2=BB=BF=BC=C2=C7Peers=BA=DC=B6=E0=B5=C4= =C7=E9=BF=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3=B2=A2=B8=F8=B3=F6XML=A1=A3 > > > =BB=B9=D3=D0=D2=BB=B8=F6Web Service=B5=C4=CA=BE=C0=FD=B4=FA=C2=EB > > > > > > > > > Peerdb.cgi > > > > > > #!/usr/bin/python > > > > > > ### a simple cgi script to manage registration of peers. > > > ### requestTypes: register, findAllPeers, unregister > > > > > > from xml.dom.ext import PrettyPrint > > > from xml.dom import minidom > > > import sys > > > import sys, cgi, time > > > import cgitb; cgitb.enable() > > > > > > > > > def registerUser(form) : > > > username =3D form['name'].value > > > useraddr =3D form['address'].value > > > > > > users =3D minidom.parse('./userdb.xml') > > > > > > usernode =3D users.createElement('user') > > > namenode =3D users.createElement('name') > > > addrnode =3D users.createElement('address') > > > namenode.appendChild(users.createTextNode(username)) > > > addrnode.appendChild(users.createTextNode(useraddr)) > > > usernode.appendChild(namenode) > > > usernode.appendChild(addrnode) > > > > > > toplevel =3D users.getElementsByTagName('users')[0] > > > toplevel.appendChild(usernode) > > > > > > f =3D file('./userdb.xml','w') > > > f.write(users.toxml()) > > > f.close() > > > > > > str =3D > > > "\n > > > str +=3D "RegisterReply \ntrue \n"" + time.strftime("%a, %d %b %Y %H:%M:%S", > > > time.localtime()) > > > str =3D str + "\n\n" > > > > > > print str > > > > > > def findAllPeers(form) : > > > > > > users =3D minidom.parse('./userdb.xml') > > > replyNode =3D users.createElement('reply') > > > typeNode =3D users.createElement('type') > > > typeNode.appendChild(users.createTextNode('UserListReply')) > > > statusNode =3D users.createElement('success') > > > statusNode.appendChild(users.createTextNode('true')) > > > dateNode =3D users.createElement('dateTime') > > > dateNode.appendChild(users.createTextNode(time.strftime("%a, %d %= b %Y > > > %H:%M:%S", time.localtime()))) > > > replyNode.appendChild(typeNode) > > > replyNode.appendChild(statusNode) > > > replyNode.appendChild(dateNode) > > > > > > oldroot =3D users.getElementsByTagName('users')[0] > > > replyNode.appendChild(oldroot) > > > > > > print replyNode.toxml() > > > > > > > > > def unregisterUser(form) : > > > > > > > > > username =3D form['name'].value > > > users =3D minidom.parse('./userdb.xml') > > > u =3D users.getElementsByTagName('name') > > > for item in u : > > > if item.firstChild.data.strip() =3D=3D username.strip() : > > > #print item.firstChild.data.strip() > > > toplevel =3D users.getElementsByTagName('users')[0] > > > toplevel.removeChild(item.parentNode) > > > > > > f =3D file('./userdb.xml','w') > > > f.write(users.toxml()) > > > f.close() > > > > > > str =3D > > > "\n > > > str +=3D "RegisterReply \ntrue \n"" + time.strftime("%a, %d %b %Y %H:%M:%S", > > > time.localtime()) > > > str =3D str + "\n\n" > > > > > > print str > > > > > > > > > > > > form=3Dcgi.FieldStorage() > > > > > > print 'Content type: text/xml' > > > print > > > > > > > > > request =3D form["requestType"].value > > > > > > if request =3D=3D 'register' : > > > registerUser(form); > > > elif request =3D=3D 'findAllPeers' : > > > findAllPeers(form) > > > elif request =3D=3D 'unregister' : > > > unregisterUser(form) > > > > > > > > > > > > testSearch.cgi > > > > > > > > > #!/usr/bin/python > > > > > > ### a simple cgi script to allow testing of search queries > > > > > > > > > from xml.dom.ext import PrettyPrint > > > from xml.dom import minidom > > > import sys > > > import sys, cgi, time > > > import cgitb; cgitb.enable() > > > > > > form=3Dcgi.FieldStorage() > > > > > > field=3Dform['field'].value > > > keyword=3Dform['keyword'].value > > > > > > songs =3D minidom.parse('./sampleDB/music.xml') > > > nodes =3D songs.getElementsByTagName(field) > > > > > > print 'Content type: text/xml' > > > print > > > > > > > > > results =3D [] > > > for node in nodes : > > > if node.firstChild.data =3D=3D keyword: > > > results.append(node.parentNode) > > > > > > > > > replyNode =3D songs.createElement('reply') > > > typeNode =3D songs.createElement('type') > > > typeNode.appendChild(songs.createTextNode('UserListReply')) > > > statusNode =3D songs.createElement('success') > > > statusNode.appendChild(songs.createTextNode('true')) > > > dateNode =3D songs.createElement('dateTime') > > > dateNode.appendChild(songs.createTextNode(time.strftime("%a, %d %b %Y > > > %H:%M:%S", time.localtime()))) > > > > > > songNode =3D songs.createElement('songs') > > > for item in results : > > > songNode.appendChild(item) > > > replyNode.appendChild(typeNode) > > > replyNode.appendChild(statusNode) > > > replyNode.appendChild(dateNode) > > > replyNode.appendChild(songNode) > > > > > > print replyNode.toxml() > > > > > > > > > > > > =D7=EE=BA=F3=D2=BB=B6=CE=CA=C7HTTP =C7=EB=C7=F3=B5=C4=B4=FA=C2=EB > > > > > > > > > Here is a simple program that processes HTTP requests, checks to see = if the > > > request has parameters attached, and then returns 'hello world' to th= e > > > client. > > > > > > In Python, you provide the BaseHTTPServer class with a handler that i= s > > > responsible for servicing GET and POST requests. (we are only dealing= with > > > GET in this project.) It should inherit from both CGIHTTPRequestHandl= er and > > > object. (see the comment for an explanation of this.) > > > > > > do_GET is invoked by the BaseHTTPServer whenever a GET request is rec= eived. > > > This is where you'll do your work. If you like, you can invoke a sepa= rate > > > CGI script at this point. > > > > > > The first thing to notice is that this DOES NOT work the way that the= cgi > > > module does. In particular, stdout is not redirected back to the clie= nt. > > > Instead, self.wfile is returned to the client. So, to send back a fil= e, use > > > self.copyfile, which is inherited from BaseHTTPRequestHandler. > > > > > > Also, in this code, I want to send back a string, rather than a file.= I > > > could write the data out to a temp file, but that's messy, so I use t= he > > > StringIO class. It provides a String that has an associated file hand= le, so > > > it can be manipulated just like a file. In this case, I write to the = string, > > > then use seek to reset the file pointer, then self.copyfile to move t= he > > > 'file contents' onto the output stream. > > > > > > self.path includes everything in the URL after the hostname and port.= This > > > is where you will extract arguments. > > > > > > Note that, if path doesn't contain a '?', I call the superclass' do_G= ET > > > method. The syntax for doing this is a little odd. super takes the na= me of a > > > type and the object to be referenced, and returns a new object of the > > > superclass' type. In order for this to work, you must (indirectly) in= herit > > > from object. > > > > > > self.send_header() can be used to send back any necessary HTTP header= s. Take > > > a look at the BaseHTTPRequestHandler (in BaseHTTPServer) and the > > > CGIHTTPRequestHandler (in CGIHTTPServer) for more usage. > > > > > > saddr is the host, port tuple ('' is localhost) - when starting an > > > HTTPServer, you should provide a saddr and a handler. > > > > > > import SimpleHTTPServer, BaseHTTPServer, httplib > > > from CGIHTTPServer import CGIHTTPRequestHandler > > > from StringIO import StringIO > > > > > > > > > > > > ### in order for super() to work, myHandler must be a 'new-style obje= ct' > > > ### old-style objects work like objects in C++ - they ae a classobj, = rather > > > ### than a type. They are not required to have a superclass. > > > ### although myHandler has a superclass, apparently CGIHTTPRequestHan= dler > > > ### does not derive from object. > > > ### To get new-style class behavior, we also derive from object. A st= range > > > ### hack to preserve both methods of OO ... > > > > > > class myHandler(CGIHTTPRequestHandler,object) : > > > def do_GET(self) : > > > if self.path.find('?') > 0 : > > > args =3D self.parsePath(self.path) > > > print args > > > print 'doing get' > > > f=3DStringIO() > > > f.write('hello wold') > > > self.send_header("Content-type", "text/html") > > > self.send_header("Content-Length", 11) > > > self.end_headers() > > > f.seek(0) > > > self.copyfile(f, self.wfile) > > > else : > > > super(myHandler,self).do_GET() > > > > > > def parsePath(self, pathString) : > > > args =3D pathString.split('?')[1] > > > pairs =3D [s.split('=3D') for s in args.split('&')] > > > pairDict =3D {} > > > for item in pairs : > > > pairDict[item[0]] =3D item[1] > > > return pairDict > > > > > > > > > saddr=3D("",8000) > > > m=3DBaseHTTPServer.HTTPServer(saddr, myHandler) > > > m.serve_forever() > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > [Time is unimportant, only life important!] > > _______________________________________________ > > python-chinese list > > python-chinese at lists.python.cn > > http://python.cn/mailman/listinfo/python-chinese > > >=20 --=20 [Time is unimportant, only life important!]
Zeuux © 2025
京ICP备05028076号