MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / SetDataSecure

Method SetDataSecure

UTCP/src/ftp_c.cpp:1903–1940  ·  view source on GitHub ↗

* level 0: PROT C * level 1: PROT P */

Source from the content-addressed store, hash-verified

1901* level 1: PROT P
1902*/
1903int CUT_FTPClient::SetDataSecure(int level) {
1904 int rt = 0;
1905
1906 if (true) { //always send PBSZ
1907 Send("PBSZ 0\r\n");
1908
1909 rt = GetResponseCode(this);
1910
1911 if(rt == 0)
1912 return OnError(UTE_NO_RESPONSE); //no response
1913 if(rt != 200) {
1914 return OnError(UTE_CONNECT_FAIL_NO_SSL_SUPPORT); //negative response
1915 }
1916 }
1917
1918 if (level == 1) {
1919 Send("PROT P\r\n");
1920 } else if (level == 0) {
1921 Send("PROT C\r\n");
1922 } else {
1923 return OnError(UTE_ERROR); //unknown level
1924 }
1925
1926 m_dataSecLevel = level;
1927
1928 rt = GetResponseCode(this);
1929
1930 if(rt == 0)
1931 return OnError(UTE_NO_RESPONSE); //no response
1932 if(rt != 200) {
1933 return OnError(UTE_CONNECT_FAIL_NO_SSL_SUPPORT); //negative response
1934 }
1935
1936 m_wsData.EnableSSL((level == 1));
1937
1938 return OnError(UTE_SUCCESS);
1939
1940}
1941
1942int CUT_FTPClient::GetDataSecure() {
1943 return m_dataSecLevel;

Callers

nothing calls this directly

Calls 1

EnableSSLMethod · 0.80

Tested by

no test coverage detected