HTTPS - GET HEAD request with proxy like "ip:port:user:pass" ?
HTTPS - GET HEAD request with proxy like "ip:port:user:pass" ?
Hi, I need to make request HTTPS - GET or HEAD .. to test my server or ping ... but only through proxy with authentication .. can someone help with code .. winApi or else ? thank you.
Re: HTTPS - GET HEAD request with proxy like "ip:port:user:pass" ?
I need with timeout ? ReceiveHTTPMemory has not timeout option ..
Re: HTTPS - GET HEAD request with proxy like "ip:port:user:pass" ?
Timeout is only possible with my libcurl.pbi
See Tips 'n Tricks
See Tips 'n Tricks
Re: HTTPS - GET HEAD request with proxy like "ip:port:user:pass" ?
Since I have no proxy with user and password, I can not provide a working example
Usage see here:
https://curl.se/libcurl/c/CURLOPT_PROXYUSERPWD.html
Usage see here:
https://curl.se/libcurl/c/CURLOPT_PROXYUSERPWD.html
Re: HTTPS - GET HEAD request with proxy like "ip:port:user:pass" ?
hi infratec, I saw your code with winapi : viewtopic.php?p=441105#p441105infratec wrote: Sun Feb 12, 2023 2:44 pm Since I have no proxy with user and password, I can not provide a working example
Usage see here:
https://curl.se/libcurl/c/CURLOPT_PROXYUSERPWD.html
can this code be modified for proxy: "ip:port:user:pass" ?
Re: HTTPS - GET HEAD request with proxy like "ip:port:user:pass" ?
I don't know.
I don't use win api any more.
I use only libcurl because it is cross platform.

I don't use win api any more.
I use only libcurl because it is cross platform.
Re: HTTPS - GET HEAD request with proxy like "ip:port:user:pass" ?
Thank you infratec, I get it working...
> How can I see all request headers .. I need to see what is send, what headers ?
Code: Select all
IncludeFile "LibCurl.pbi"
Procedure.s URLGetData(URL$)
Protected Curl.i, *CurlSList, Response$, ret.l, total_time.d, connect.d
Curl = curl_easy_init()
If Curl
*CurlSList = curl_slist_append(#Null, "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36")
curl_easy_setopt(Curl, #CURLOPT_HTTPHEADER, *CurlSList)
curl_easy_setopt_str(Curl, #CURLOPT_URL, URL$)
curl_easy_setopt(curl, #CURLOPT_FOLLOWLOCATION, 0)
curl_easy_setopt_str(Curl, #CURLOPT_PROXY, "http://proxyIP:proxyPort")
curl_easy_setopt_str(Curl, #CURLOPT_PROXYUSERPWD, "proxyUser:proxyPass")
curl_easy_setopt(Curl, #CURLOPT_NOBODY, 1)
curl_easy_setopt(Curl, #CURLOPT_HEADER, 0)
curl_easy_setopt(Curl, #CURLOPT_NOPROGRESS, 1)
curl_easy_setopt(Curl, #CURLOPT_TIMEOUT_MS, 1000)
curl_easy_setopt(Curl, #CURLOPT_TCP_KEEPALIVE, 0)
; accept insecure certificates
curl_easy_setopt(curl, #CURLOPT_SSL_VERIFYPEER, #False)
curl_easy_setopt(curl, #CURLOPT_SSL_VERIFYHOST, #False)
; use own receive function
;curl_easy_setopt(curl, #CURLOPT_WRITEFUNCTION, @LibCurl_WriteFunction())
If curl_easy_perform(Curl) = #CURLE_OK
Debug "Ok"
curl_easy_getinfo(Curl, #CURLINFO_TOTAL_TIME, @total_time)
curl_easy_getinfo(Curl, #CURLINFO_PRETRANSFER_TIME, @connect)
;Response$ = LibCurl_GetData()
Debug StrD(total_time * 1000, 1) + " ms -- " + StrD(connect * 1000, 1) + " ms"
Else
Debug "Error: " + curl_easy_strerror(res)
EndIf
curl_slist_free_all(*CurlSList)
curl_easy_cleanup(Curl)
EndIf
ProcedureReturn Response$
EndProcedure
Debug URLGetData("https://google.com")
Last edited by ruslanx on Sun Feb 12, 2023 7:39 pm, edited 1 time in total.
Re: HTTPS - GET HEAD request with proxy like "ip:port:user:pass" ?
Replace
with
Code: Select all
curl_easy_setopt(Curl, #CURLOPT_HEADER, 0)
Code: Select all
curl_easy_setopt(Curl, #CURLOPT_HEADER, 1)
Re: HTTPS - GET HEAD request with proxy like "ip:port:user:pass" ?
no, I need headers of request .. not response
https://mkyong.com/wp-content/uploads/2 ... eaders.png
https://mkyong.com/wp-content/uploads/2 ... eaders.png
Re: HTTPS - GET HEAD request with proxy like "ip:port:user:pass" ?
You build the header of the request.
So you should know what is inside (header slist)
I don't know which header you want to see.
Your link looks líke the response page from a website and not like header lines.
So you should know what is inside (header slist)
I don't know which header you want to see.
Your link looks líke the response page from a website and not like header lines.
Re: HTTPS - GET HEAD request with proxy like "ip:port:user:pass" ?
Code: Select all
import socket
HOST = "127.0.0.1"
PORT = 65431
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((HOST, PORT))
s.listen()
while True:
conn, addr = s.accept()
with conn:
print(f"connected by {addr}")
data = conn.recv(1024)
print(data.decode())
conn.send(data)
conn.close()
Re: HTTPS - GET HEAD request with proxy like "ip:port:user:pass" ?
This code is not useful for me.
I can not run it.
I can not run it.