Compare commits

...

3 Commits

Author SHA1 Message Date
c725eed37d Allow socket proxy 2026-03-06 13:53:00 +03:00
573b85932f Merge branch release/v9.3.0 into hotfix/v9.3.1 2026-03-04 09:17:03 +00:00
3c707ebbf4 Fix bug 78204 2026-02-26 15:44:32 +03:00
6 changed files with 55 additions and 8 deletions

View File

@ -72,6 +72,10 @@ extern NSString *const SRHTTPResponseErrorKey;
// Optional array of cookies (NSHTTPCookie objects) to apply to the connections
@property (nonatomic, readwrite) NSArray * requestCookies;
// Optional proxy configuration dictionary (kCFStreamPropertyHTTPProxy format).
// Set before calling -open. Example: Proxyman at 127.0.0.1:9090.
@property (nonatomic, strong) NSDictionary *proxyDictionary;
// This returns the negotiated protocol.
// It will be nil until after the handshake completes.
@property (nonatomic, readonly, copy) NSString *protocol;

View File

@ -619,7 +619,16 @@ static __strong NSData *CRLFCRLF;
_inputStream.delegate = self;
_outputStream.delegate = self;
if (self.proxyDictionary) {
CFReadStreamSetProperty((__bridge CFReadStreamRef)_inputStream,
kCFStreamPropertyHTTPProxy,
(__bridge CFDictionaryRef)self.proxyDictionary);
CFWriteStreamSetProperty((__bridge CFWriteStreamRef)_outputStream,
kCFStreamPropertyHTTPProxy,
(__bridge CFDictionaryRef)self.proxyDictionary);
}
[self setupNetworkServiceType:_urlRequest.networkServiceType];
}

View File

@ -38,6 +38,8 @@
#include <memory>
#include "../../../../../DesktopEditor/graphics/BaseThread.h"
#define _LOGGER_SOCKETS
namespace NSNetwork
{
namespace NSWebSocket
@ -124,6 +126,10 @@ namespace NSNetwork
}
//webSocket.connect(url, queryDst, sio::string_message::create(sAuth));
#ifdef _LOGGER_SOCKETS
m_socket->set_proxy_basic_auth("http://127.0.0.1:9090", "", "");
#endif
m_connecting_in_process = true;
m_socket->connect(m_base->url, queryDst, objAuth);

View File

@ -42,6 +42,8 @@
#include <memory>
#include "../../../../../DesktopEditor/graphics/BaseThread.h"
#define _LOGGER_SOCKETS
namespace NSNetwork
{
namespace NSWebSocket
@ -113,6 +115,10 @@ namespace NSNetwork
}
//webSocket.connect(url, queryDst, sio_no_tls::string_message::create(sAuth));
#ifdef _LOGGER_SOCKETS
m_socket->set_proxy_basic_auth("http://127.0.0.1:9090", "", "");
#endif
m_connecting_in_process = true;
m_socket->connect(m_base->url, queryDst, objAuth);

View File

@ -48,7 +48,7 @@
}
- (void)open
{
{
if (m_url && m_url.length)
{
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:m_url]];
@ -58,6 +58,19 @@
protocols:nil
allowsUntrustedSSLCertificates:YES];
self.socket.delegate = self;
#ifdef _LOGGER_SOCKETS
self.socket.proxyDictionary = @{
(NSString *)kCFNetworkProxiesHTTPEnable: @YES,
(NSString *)kCFNetworkProxiesHTTPProxy: @"127.0.0.1",
(NSString *)kCFNetworkProxiesHTTPPort: @9090,
(NSString *)kCFNetworkProxiesHTTPSEnable: @YES,
(NSString *)kCFNetworkProxiesHTTPSProxy: @"127.0.0.1",
(NSString *)kCFNetworkProxiesHTTPSPort: @9090
};
NSLog(@"[SocketRocket] Proxyman proxy enabled: 127.0.0.1:9090");
#endif
[self.socket open];
}
}
@ -65,7 +78,7 @@
- (void)send:(NSString*)message
{
#if _LOGGER_SOCKETS
#ifdef _LOGGER_SOCKETS
NSLog(@"------------------- SEND TO SOCKET -------------------");
NSLog(@"%@", message);
@ -101,7 +114,7 @@
- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message
{
#if _LOGGER_SOCKETS
#ifdef _LOGGER_SOCKETS
NSLog(@"------------------- SOCKET RECEIVE MESSAGE -------------------");
NSLog(@"%@", message);
@ -119,7 +132,7 @@
{
m_listener->onOpen();
#if _LOGGER_SOCKETS
#ifdef _LOGGER_SOCKETS
NSLog(@"------------------- SOCKET OPEN -------------------");
NSLog(@"URL : %@", webSocket.url);
@ -134,7 +147,7 @@
{
m_listener->onError(error.localizedDescription.stdstring);
#if _LOGGER_SOCKETS
#ifdef _LOGGER_SOCKETS
NSLog(@"---------------------------------------------------------");
NSLog(@"------------------- SOCKET ERROR : %@ ------------", error);
@ -147,7 +160,7 @@
{
m_listener->onClose(code, reason.stdstring);
#if _LOGGER_SOCKETS
#ifdef _LOGGER_SOCKETS
NSLog(@"---------------------------------------------------------");
NSLog(@"------------------- SOCKET CLOSE : %@ -----------", reason);
@ -158,7 +171,7 @@
- (void)webSocket:(SRWebSocket *)webSocket didReceivePong:(NSData *)pongPayload
{
#if _LOGGER_SOCKETS
#ifdef _LOGGER_SOCKETS
NSString *str = [[NSString alloc] initWithData:pongPayload encoding:NSUTF8StringEncoding];

View File

@ -478,6 +478,15 @@ core_android {
!core_android_no_unistd {
DEFINES += HAVE_UNISTD_H HAVE_FCNTL_H
}
core_release {
QMAKE_CFLAGS += -g0
QMAKE_CXXFLAGS += -g0
QMAKE_LFLAGS += -Wl,-s
QMAKE_CFLAGS -= -fno-limit-debug-info
QMAKE_CXXFLAGS -= -fno-limit-debug-info
}
}
core_debug {