Skip to content

Commit

Permalink
Merge pull request #58 from semuconsulting/RC-1.0.21
Browse files Browse the repository at this point in the history
RELEASE CANDIDATE 1.0.21
  • Loading branch information
semuadmin authored Mar 13, 2024
2 parents 9e81065 + 2933657 commit 2bce0f8
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"editor.formatOnSave": true,
"modulename": "${workspaceFolderBasename}",
"distname": "${workspaceFolderBasename}",
"moduleversion": "1.0.20"
"moduleversion": "1.0.21"
}
6 changes: 6 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# pygnssutils Release Notes

### RELEASE CANDIDATE 1.0.21

ENHANCEMENTS:

1. Add SSL support to gnssntripclient.

### RELEASE 1.0.20

FIXES:
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "pygnssutils"
authors = [{ name = "semuadmin", email = "[email protected]" }]
maintainers = [{ name = "semuadmin", email = "[email protected]" }]
description = "GNSS Command Line Utilities"
version = "1.0.20"
version = "1.0.21"
license = { file = "LICENSE" }
readme = "README.md"
requires-python = ">=3.8"
Expand All @@ -34,6 +34,7 @@ classifiers = [
]

dependencies = [
"certifi>=2024.0.0",
"paho-mqtt>=1.6.0",
"pyserial>=3.5",
"pyspartn>=0.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/pygnssutils/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
:license: BSD 3-Clause
"""

__version__ = "1.0.20"
__version__ = "1.0.21"
24 changes: 24 additions & 0 deletions src/pygnssutils/gnssntripclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import os
import socket
import ssl
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from base64 import b64encode
from datetime import datetime, timedelta
Expand All @@ -34,6 +35,7 @@
from threading import Event, Thread
from time import sleep

from certifi import where as findcacerts
from pynmeagps import GET, NMEAMessage
from pyrtcm import RTCMMessageError, RTCMParseError, RTCMTypeError
from pyubx2 import ERR_IGNORE, RTCM3_PROTOCOL, UBXReader
Expand Down Expand Up @@ -453,8 +455,16 @@ def _read_thread(
scopeid = int(settings["scopeid"])
mountpoint = settings["mountpoint"]
ggainterval = int(settings["ggainterval"])

conn = format_conn(settings["ipprot"], server, port, flowinfo, scopeid)
with socket.socket(settings["ipprot"], socket.SOCK_STREAM) as self._socket:
if port == 443:
# context = ssl.create_default_context()
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.load_verify_locations(findcacerts())
self._socket = context.wrap_socket(
self._socket, server_hostname=server
)
self._socket.settimeout(TIMEOUT)
self._socket.connect(conn)
self._socket.sendall(self._formatGET(settings))
Expand Down Expand Up @@ -485,6 +495,20 @@ def _read_thread(
):
stopevent.set()
self._connected = False
except ssl.SSLCertVerificationError as err:
tip = (
f" - try using '{server[4:]}' rather than '{server}' for the NTRIP caster URL"
if "certificate is not valid for 'www." in err.strerror
else (
f" - try adding the NTRIP caster URL SSL certificate to {findcacerts()}"
if "unable to get local issuer certificate" in err.strerror
else ""
)
)
print(f"SSL Certificate Verification Error{tip}\n{err}")
stopevent.set()
self._connected = False
self._app_update_status(False, (f"Error!: {err.strerror[0:32]}", "red"))

def _do_header(self, sock: socket, stopevent: Event, output: object) -> str:
"""
Expand Down

0 comments on commit 2bce0f8

Please sign in to comment.