I'm making a web server for a SSH Tunneling hardware box. It hangs when it sends a js file.
Output:
GET \ HTTP\1.1
Sent: login.htm
GET \login_log.js HTTP\1.1
Program hangs here. It won't send.
Output:
GET \ HTTP\1.1
Sent: login.htm
GET \login_log.js HTTP\1.1
Program hangs here. It won't send.
;;;;;;;;;;;;;;;;;;;;;;;;;; ;SSH Tunneling Server Box; ;;;;;;;;;;;;;;;;;;;;;;;;;; AppTitle "SSH Tunneling Server Box" Global admin_pass = "admin" Global http = CreateTCPServer(80) ;Create the online website Global ssh = CreateTCPServer(22) ;Create the SSH Tunneling server Global httpstream If http = 0 Then ;Light error light here ElseIf ssh = 0 Then ;Light error light here EndIf While Not KeyHit(1) httpstream = AcceptTCPStream(http) If httpstream Then R_line$ = ReadLine$(httpstream) Print R_line$ If Mid$(R_line$,5,2) = "/ " Then If FileType("login.htm") = 0 Then Color 255,0,0 Print "Error! Missing File." Color 255,255,255 EndIf SendFile("login.htm") Else If FileType(Mid$(R_line$,6,Len(R_Line$) - 14)) = 0 Then Color 255,0,0 Print "Error! Missing File." Color 255,255,255 EndIf SendFile(Mid$(R_line$,6,Len(R_Line$) - 14)) EndIf CloseTCPStream httpstream httpstream = 0 EndIf sshstream = AcceptTCPStream(ssh) If sshstream Then WriteLine sshstream,"Shoo. Were aren't accepting ssh connections!" CloseTCPStream sshstream sshstream = 0 EndIf Wend CloseTCPServer http CloseTCPServer ssh Function SendFile(filepath$) file = ReadFile(filepath$) While Not Eof(file) WriteLine httpstream,ReadLine$(file) Wend CloseFile(file) WriteLine httpstream,"" Color 0,255,0 Print "Sent: " + filepath$ Color 255,255,255 End Function