• How to real disabled cache from HttPConnect

    From Jakub@21:1/5 to All on Thu Oct 26 13:05:11 2023
    I have this class to connect php server

    import java.net.HttpURLConnection
    import java.net.URL
    import java.util.regex.Pattern

    class jHttpConnect03(
    private val destinationUrl: String
    ) {

    private var urlConnectionTls: HttpURLConnection? = null

    private fun chekregexp(url: String, regexp: String): Boolean {
    val mPattern = Pattern.compile(regexp)
    return mPattern.matcher(url).find()
    }

    fun checkTlsAndConnect(): HttpURLConnection? {
    if ( !chekregexp(destinationUrl, "^(http://)") ) {
    return null
    }

    try {
    // Tell the URLConnection
    val url = URL(destinationUrl)

    urlConnectionTls = url.openConnection() as HttpURLConnection
    /*
    urlConnectionTls!!.setRequestProperty("Cache-Control",
    "no-cache")
    urlConnectionTls!!.setDefaultUseCaches(false)
    urlConnectionTls!!.setUseCaches(false)

    */
    /*
    // set none cache
    con.setRequestProperty("Cache-Control", "no-cache");

    con.setDefaultUseCaches(false);
    con.setUseCaches(false);
    */
    //urlConnectionTls!!.sslSocketFactory = context.socketFactory
    } catch ( _ : Exception ) {
    return null
    }

    return if ( urlConnectionTls != null ) {
    urlConnectionTls
    } else {
    null
    }
    }

    }


    I want real disabled cache for HttpConnect but this don't work

    urlConnectionTls!!.setRequestProperty("Cache-Control", "no-cache")
    urlConnectionTls!!.setDefaultUseCaches(false)
    urlConnectionTls!!.setUseCaches(false)


    How to fix this?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)