from socket import * # Get socket functions serverSocket = socket(AF_INET, SOCK_STREAM) # The following line allows you to rerun the server right away after killing it. # That’s useful for testing; otherwise you may have to wait 15-30 seconds each # time. server.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) # Prepare a server socket on a particular port #Fill in code to set up the port while True: # Establish the connection print('Ready to serve...') connectionSocket, addr = #Fill in code to get a connection try: message = # Fill in code to read GET request filename = message.split()[1] # Fill in code to provide security f = open(filename) outputdata = # Fill in code to read data from the file f.close() # Send HTTP header line(s) into socket # Fill in code to send header(s) # Send the content of the requested file to the client for i in range(0, len(outputdata)): connectionSocket.send(outputdata[i].encode()) connectionSocket.send("\r\n".encode()) connectionSocket.close() except IOError: #Send response message for file not found # Fill in # Close client socket # Fill in