Comments (4)
You have to use HttpQueryInfoW
with HTTP_QUERY_COOKIE
to get the corresponding header.
There's no built-in solution for handling cookies out-of-the-box. The same applies for setting cookies. You need to send Set-Cookie
header manually.
from kotlin-mpp-wininet.
Ty, HttpQueryInfoW worked fine for me,
justed added this code in "WinInetHelper.request", after getResponseData() call
sample:
var lpszData = ByteArray(200)
val dwSize = alloc()
val index = alloc()
index.value = 0.dword()
dwSize.value = 200.dword()
lpszData.usePinned {
if (HttpQueryInfoW(requestHandle.handle,HTTP_QUERY_SET_COOKIE,it.addressOf(0),dwSize.ptr,index.ptr) == 0){
if (GetLastError().toInt() == ERROR_INSUFFICIENT_BUFFER){
println("ERROR_INSUFFICIENT_BUFFER, required_size = " + dwSize.value)
lpszData = ByteArray(dwSize.value.toInt())
index.value = 0.dword()
HttpQueryInfoW(requestHandle.handle,HTTP_QUERY_SET_COOKIE,it.addressOf(0),dwSize.ptr,index.ptr)
}
else if (GetLastError().toInt() == ERROR_HTTP_HEADER_NOT_FOUND){
index.value = 0.dword()
HttpQueryInfoW(requestHandle.handle,HTTP_QUERY_COOKIE,it.addressOf(0),dwSize.ptr,index.ptr)
println("ERROR_HTTP_HEADER_NOT_FOUND (HTTP_QUERY_SET_COOKIE) - trying HTTP_QUERY_COOKIE")
}
}
}
println("size = " + dwSize.value + ", indice = " + index.value + ", cookie = " + lpszData.decodeToString())
from kotlin-mpp-wininet.
Do you Know to to handle https with certificate? In java u should update sdk cacerts, no idea how to do it in klotin/native
from kotlin-mpp-wininet.
HTTPS is supported by the WinInet library and handled transparently, so the certificate has to be available in system.
It's controller by INTERNET_FLAG_SECURE flag. Check MemScope.openRequest(...)
function in WinInetHelper.kt
.
from kotlin-mpp-wininet.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kotlin-mpp-wininet.