list index out of range - split() function in python 3

97 Views Asked by At

I create a web proxy server and try to parse the url from the header but I get a problem with split()

def proxy_thread(connectionSocket,addr):

    request = connectionSocket.recv(Buffer)

    GETREQ = request.decode('utf-8', 'ignore').split('\r\n')[0]

    print ("Test " + GETREQ)

    url = GETREQ.split(" ")[1]

Here is the Traceback: Unhandled exception in thread started by Traceback (most recent call last): File "C:\Users\dangt\Desktop\cheg.py", line 62, in proxy_thread url = GETREQ.split(" ")[1] IndexError: list index out of range

0

There are 0 best solutions below