summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-01-12 21:27:03 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-01-12 21:27:03 +0300
commit3cb3883908e3168e5f955be3143771721614307a (patch)
treee160797994b28577e5fa71a4c790e1670e6f4035 /include
parent6461f17159c83bfaeba1ecbd124ab53551f3e22d (diff)
Netlib_FreeHttpRequest() instead of MS_NETLIB_FREEHTTPREQUESTSTRUCT
Diffstat (limited to 'include')
-rw-r--r--include/delphi/m_netlib.inc58
-rw-r--r--include/m_jabber.h2
-rw-r--r--include/m_netlib.h35
3 files changed, 20 insertions, 75 deletions
diff --git a/include/delphi/m_netlib.inc b/include/delphi/m_netlib.inc
index 7772113a94..3bfe107306 100644
--- a/include/delphi/m_netlib.inc
+++ b/include/delphi/m_netlib.inc
@@ -466,59 +466,7 @@ type
szIp :array[0..0,0..63] of AnsiChar;
end;
-const
-{
- Get connection Information
- wParam=(WPARAM)IP filter 1 - return global only IPv6 address, 0 all IPs
- Returns (INT_PTR)(NETLIBIPLIST*) numeric IP address address array
- the last element of the array is all 0s, 0 if not successful
-}
- MS_NETLIB_GETMYIP:PAnsiChar = 'Netlib/GetMyIP';
-
{
- wParam : HANDLE
- lParam : Pointer to a initialised TNETLIBHTTPREQUEST structure
- Affect : Send an HTTP request over a connection, see notes
- Returns: The number of bytes on success, SOCKET_ERROR on failure
- Notes : HANDLE must of been returned by MS_NETLIB_OPENCONNECTION,,
- If you use NLHRF_SMARTAUTHHEADER and NTLM auth is in use then
- full NTLM auth transcation occurs, comprising sending the
- domain, getting the challenge, sending the response.
- NETLIBHTTPREQUEST.resultCode and NETLIBHTTPREQUEST.szResultDescr are
- ignored by this service.
- Errors : ERROR_INVALID_PARAMETER, MS_NETLIB_SEND (return codes)
- }
- MS_NETLIB_SENDHTTPREQUEST:PAnsiChar = 'Netlib/SendHttpRequest';
-
- {
- wParam : HANDLE
- lParam : 0
- Affect : Receive HTTP headers, see notes
- Returns: A pointer to a TNETLIBHTTPREQUEST structure on success, NULL(0) on failure
- Notes : The returned pointer must be freed after it's done with
- use MS_NETLIB_FREEHTTPREQUESTSTRUCT.
- -
- HANDLE must be returned by MS_NETLIB_OPENCONNECTION
- -
- Return^.pData=NIL and Return^.dataLength=0 always
- -
- The returned data should be retrieved using MS_NETLIB_RECV once
- the headers have been parsed.
- If headers haven't finished within 60 seconds the function returns
- NULL(0) and ERROR_TIMEOUT
- Errors : ERROR_INVALID_PARAMETER, any MS_NETLIB_RECV or select()
- ERROR_HANDLE_EOF (connection closed bfore headers complete)
- ERROR_TIMEOUT (headers still not complete after 60 seconds)
- ERROR_BAD_FORMAT (invalid character or line ending in headers, or first line is blank)
- ERROR_BUFFER_OVERFLOW (each header line must be less than 4096 chars long)
- ERROR_INVALID_DATA (first header line is malformed ("http/[01].[0-9] [0-9]+ .*", or no colon in subsequent line)
-
- }
- MS_NETLIB_RECVHTTPHEADERS:PAnsiChar = 'Netlib/RecvHttpHeaders';
-
- {
- wParam : 0
- lParam : Pointer returned by MS_NETLIB_RECVHTTPHEADERS to free
Affect : Free the memory used by a TNETLIBHTTPREQUEST structure, see notes
Returns: [non zero] on success, NULL(0) on failure
Notes : This service should only be used with memory pointers returned
@@ -526,7 +474,8 @@ const
Errors : ERROR_INVALID_PARAMETER
}
- MS_NETLIB_FREEHTTPREQUESTSTRUCT:PAnsiChar = 'Netlib/FreeHttpRequestStruct';
+
+function Netlib_FreeHttpRequest(param:PNETLIBHTTPREQUEST) : bytebool; stdcall; external AppDll;
{
wParam : HANDLE
@@ -564,7 +513,8 @@ const
Errors : ERROR_INVALID_PARAMETER, ERROR_OUTOFMEMORY
Errors returned by the aforementioned internally used functions
}
- MS_NETLIB_HTTPTRANSACTION:PAnsiChar = 'Netlib/HttpTransaction';
+
+function Netlib_HttpTransaction(nlu:THANDLE; param:PNETLIBHTTPREQUEST) : PNETLIBHTTPREQUEST; stdcall; external AppDll;
{
Affect : Send data over an open connection see notes
diff --git a/include/m_jabber.h b/include/m_jabber.h
index 01d0c71d5e..f6b0b8878d 100644
--- a/include/m_jabber.h
+++ b/include/m_jabber.h
@@ -157,7 +157,7 @@ struct IJabberInterface
virtual LPTSTR STDMETHODCALLTYPE GetResourceFeatures(LPCTSTR jid) = 0;
// Returns the connection handle
- virtual HANDLE STDMETHODCALLTYPE GetHandle(void) = 0;
+ virtual HNETLIBUSER STDMETHODCALLTYPE GetHandle(void) = 0;
};
/*
diff --git a/include/m_netlib.h b/include/m_netlib.h
index a5df2a3f91..1ab848528c 100644
--- a/include/m_netlib.h
+++ b/include/m_netlib.h
@@ -498,12 +498,10 @@ struct NETLIBHTTPREQUEST
#define MS_NETLIB_SENDHTTPREQUEST "Netlib/SendHttpRequest"
/////////////////////////////////////////////////////////////////////////////////////////
-// Receive HTTP headers
-// wParam = (WPARAM)(HANDLE)hConnection
-// lParam = 0
-// Returns a pointer to a NETLIBHTTPREQUEST structure on success, NULL on
-// failure.
-// Call MS_NETLIB_FREEHTTPREQUESTSTRUCT to free this.
+// Receives HTTP headers
+//
+// Returns a pointer to a NETLIBHTTPREQUEST structure on success, NULL on failure.
+// Call Netlib_FreeHttpRequest() to free this.
// hConnection must have been returned by MS_NETLIB_OPENCONNECTION
// nlhr->pData = NULL and nlhr->dataLength = 0 always. The requested data should
// be retrieved using MS_NETLIB_RECV once the header has been parsed.
@@ -516,22 +514,21 @@ struct NETLIBHTTPREQUEST
// ERROR_BUFFER_OVERFLOW (each header line must be less than 4096 chars long)
// ERROR_INVALID_DATA (first header line is malformed ("http/[01].[0-9] [0-9]+ .*", or no colon in subsequent line)
-#define MS_NETLIB_RECVHTTPHEADERS "Netlib/RecvHttpHeaders"
+EXTERN_C MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HANDLE hConnection, int flags = 0);
/////////////////////////////////////////////////////////////////////////////////////////
// Free the memory used by a NETLIBHTTPREQUEST structure
-// wParam = 0
-// lParam = (LPARAM)(NETLIBHTTPREQUEST*)pnlhr
-// Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//
+// Returns true on success, false on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
// This should only be called on structures returned by
// MS_NETLIB_RECVHTTPHEADERS or MS_NETLIB_HTTPTRANSACTION. Calling it on an
// arbitrary structure will have disastrous results.
// Errors: ERROR_INVALID_PARAMETER
-#define MS_NETLIB_FREEHTTPREQUESTSTRUCT "Netlib/FreeHttpRequestStruct"
+EXTERN_C MIR_APP_DLL(bool) Netlib_FreeHttpRequest(NETLIBHTTPREQUEST*);
/////////////////////////////////////////////////////////////////////////////////////////
-// smart pointer for NETLIBHTTPREQUEST via a call of MS_NETLIB_FREEHTTPREQUESTSTRUCT
+// smart pointer for NETLIBHTTPREQUEST via a call of Netlib_FreeHttpRequest()
#ifdef __cplusplus
class NLHR_PTR
@@ -550,7 +547,7 @@ public:
__inline NETLIBHTTPREQUEST* operator=(NETLIBHTTPREQUEST *p)
{
if (_p)
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)(NETLIBHTTPREQUEST*)_p);
+ Netlib_FreeHttpRequest(_p);
_p = p;
return _p;
}
@@ -558,18 +555,16 @@ public:
__inline NETLIBHTTPREQUEST* operator->() const { return _p; }
__inline ~NLHR_PTR()
{
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)(NETLIBHTTPREQUEST*)_p);
+ Netlib_FreeHttpRequest(_p);
}
};
#endif
/////////////////////////////////////////////////////////////////////////////////////////
// Do an entire HTTP transaction
-// wParam = (WPARAM)(HANDLE)hUser
-// lParam = (LPARAM)(NETLIBHTTPREQUEST*)&nlhr
-// Returns a pointer to another NETLIBHTTPREQUEST structure on success, NULL on
-// failure.
-// Call MS_NETLIB_FREEHTTPREQUESTSTRUCT to free this.
+//
+// Returns a pointer to another NETLIBHTTPREQUEST structure on success, NULL on failure.
+// Call Netlib_FreeHttpRequest() to free this.
// hUser must have been returned by MS_NETLIB_REGISTERUSER
// nlhr.szUrl should be a full HTTP URL. If it does not start with http:// , that
// will be assumed (but it's best not to use this fact, for reasons of
@@ -593,7 +588,7 @@ public:
// Errors: ERROR_INVALID_PARAMETER, ERROR_OUTOFMEMORY, anything from the above
// list of functions
-#define MS_NETLIB_HTTPTRANSACTION "Netlib/HttpTransaction"
+EXTERN_C MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_HttpTransaction(HNETLIBUSER hNlu, NETLIBHTTPREQUEST *pRequest);
/////////////////////////////////////////////////////////////////////////////////////////
// Send data over a connection