72a @verb #7407:"send_request_raw" this none this rxdo #7407 @program #7407:"send_request_raw" this none this "$ljmoo:send_request_raw(request_string) => Server response: {\"HTTP/1.1 200 OK\", ...}" "" " This verb is pretty low-level. Don't worry about calling it." {site, port, loc} = this.url_info {request_string} = args if (caller != this) raise(E_PERM, "You aren't allowed to call this verb") endif $code_utils:semaphore_enter("network", caller_perms()) con = $network:open(site, port) notify(con, tostr("POST ", loc, " HTTP/1.0")) notify(con, tostr("Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*")) notify(con, tostr("Content-type: application/x-www-form-urlencoded")) notify(con, tostr("User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90)")) notify(con, tostr("Host: ", site, ":", port)) notify(con, tostr("Content-length: ", length(request_string))) notify(con, tostr("Connection: Keep-Alive")) notify(con, "") notify(con, request_string) fork f (10) "Polls the connection every five seconds. If at any point it's idle time exceeds ten seconds, give up. If it's still sporadically sending data after thirty seconds, give up." while (`idle_seconds(con) < 10 && connected_seconds(con) < 30 ! E_INVARG') suspend(5) endwhile `boot_player(con) ! ANY' endfork inctext = "" server_response = {} while (inctext != E_INVARG) inctext = `read(con) ! E_INVARG' if (typeof(inctext) != $ERR) server_response = {@server_response, inctext} endif endwhile "Well, the server finally completed its transmission. If our fork is still running, destroy it now." $code_utils:task_valid(f) && kill_task(f) $code_utils:semaphore_exit("network", caller_perms()) return server_response "Last modified by Dax (#789) on Wed May 4 06:46:33 2005 MDT." . 0