Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HTTP persistent connection
can answer only question 3.

Member function Http.PostWithTimeout
Copy      Help
function# timeout_s $action $data [str&responsepage] [$headers] [inetflags] [str&responseheaders] [&unused]

;Posts web form data. Returns 1 on success, 0 on failure. Error on timeout.
;This function cannot post files. To post files use PostFormData.

;timeout_s - timeout in seconds.
;data - urlencoded string, eg "name=John+Smith&".
;action, responsepage, headers, inetflags, responseheaders - the same as with PostFormData.
;unused - used internally.

;See also: <Http.PostFormData>.

,if(!m_hi) end ES_INIT
,__HInternet _hi; int th _ret
,th=mac("__Http_PostWithTimeout" "" &this action data &responsepage headers inetflags &responseheaders &_hi &_ret)
,wait timeout_s H th
,,InternetCloseHandle _hi; _hi.handle=0 ;;ends thread
,,wait 0 H th ;;because the thread uses this. ~0.5ms
,,end _error
,ret _ret

lpstr sh="Content-Type: application/x-www-form-urlencoded"
if(empty(headers)) headers=sh
else if(findrx(headers "(?i)^Content-Type *:" 8)<0) headers=_s.from(sh "[]" headers)

unused=HttpOpenRequest(m_hi "POST" action 0 0 0 INTERNET_FLAG_RELOAD|inetflags 0); if(!unused) ret Error
if(!HttpSendRequest(unused headers -1 data len(data))) ret Error

if(&responseheaders and !GetResponseHeaders(unused responseheaders)) ret Error

if(&responsepage) ret Read(unused responsepage)
ret 1

Function __Http_PostWithTimeout
Copy      Help
function Http&h $action $data str&responsepage $headers inetflags str&responseheaders &handle &_ret

_ret=h.PostWithTimeout(0 action data responsepage headers inetflags responseheaders handle)

Messages In This Thread

Forum Jump:

Users browsing this thread: 1 Guest(s)