Skip to content

Commit 235e816

Browse files
committed
Rename to escape
1 parent 4c34ef0 commit 235e816

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

src/_native/winhttp.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static int crack_url(const wchar_t *url, URL_COMPONENTS *parts) {
129129
return 1;
130130
}
131131

132-
static wchar_t *_recode_url_part(bool encode, const wchar_t *url_part, DWORD cch, bool allow_env=false)
132+
static wchar_t *_escape_url_part(bool encode, const wchar_t *url_part, DWORD cch, bool allow_env=false)
133133
{
134134
if (!url_part) {
135135
return NULL;
@@ -175,14 +175,14 @@ static wchar_t *_recode_url_part(bool encode, const wchar_t *url_part, DWORD cch
175175
return result;
176176
}
177177

178-
static wchar_t *encode_url_part(const wchar_t *url_part, DWORD cch, bool allow_env=false)
178+
static wchar_t *escape_url_part(const wchar_t *url_part, DWORD cch, bool allow_env=false)
179179
{
180-
return _recode_url_part(true, url_part, cch, allow_env);
180+
return _escape_url_part(true, url_part, cch, allow_env);
181181
}
182182

183-
static wchar_t *decode_url_part(const wchar_t *url_part, DWORD cch, bool allow_env=false)
183+
static wchar_t *unescape_url_part(const wchar_t *url_part, DWORD cch, bool allow_env=false)
184184
{
185-
return _recode_url_part(false, url_part, cch, allow_env);
185+
return _escape_url_part(false, url_part, cch, allow_env);
186186
}
187187

188188

@@ -308,11 +308,11 @@ PyObject *winhttp_urlopen(PyObject *, PyObject *args, PyObject *kwargs) {
308308
if (!crack_url(url, &url_parts)) {
309309
goto exit;
310310
}
311-
hostname = decode_url_part(url_parts.lpszHostName, url_parts.dwHostNameLength);
311+
hostname = unescape_url_part(url_parts.lpszHostName, url_parts.dwHostNameLength);
312312
if (!hostname) {
313313
goto exit;
314314
}
315-
urlpath = decode_url_part(url_parts.lpszUrlPath, url_parts.dwUrlPathLength);
315+
urlpath = unescape_url_part(url_parts.lpszUrlPath, url_parts.dwUrlPathLength);
316316
if (!urlpath) {
317317
goto exit;
318318
}
@@ -381,11 +381,11 @@ PyObject *winhttp_urlopen(PyObject *, PyObject *args, PyObject *kwargs) {
381381
));
382382

383383
if (url_parts.dwUserNameLength || url_parts.dwPasswordLength) {
384-
user = decode_url_part(url_parts.lpszUserName, url_parts.dwUserNameLength);
384+
user = unescape_url_part(url_parts.lpszUserName, url_parts.dwUserNameLength);
385385
if (!user) {
386386
goto exit;
387387
}
388-
pass = decode_url_part(url_parts.lpszPassword, url_parts.dwPasswordLength);
388+
pass = unescape_url_part(url_parts.lpszPassword, url_parts.dwPasswordLength);
389389
if (!pass) {
390390
goto exit;
391391
}
@@ -568,8 +568,8 @@ PyObject *winhttp_urlsplit(PyObject *, PyObject *args, PyObject *kwargs) {
568568
// Deliberately not decoding host or path. We never use a blacklist, we only
569569
// match against values specified by the user, or pass it to. If they want
570570
// to provide the same URL with different encoding, that's their fault.
571-
wchar_t *user = decode_url_part(url_parts.lpszUserName, url_parts.dwUserNameLength, true);
572-
wchar_t *pass = decode_url_part(url_parts.lpszPassword, url_parts.dwPasswordLength, true);
571+
wchar_t *user = unescape_url_part(url_parts.lpszUserName, url_parts.dwUserNameLength, true);
572+
wchar_t *pass = unescape_url_part(url_parts.lpszPassword, url_parts.dwPasswordLength, true);
573573
PyObject *r = Py_BuildValue("(u#u#u#u#nu#u#)",
574574
url_parts.lpszScheme, (Py_ssize_t)url_parts.dwSchemeLength,
575575
user, (Py_ssize_t)(user ? wcslen(user) : 0),
@@ -605,11 +605,11 @@ PyObject *winhttp_urlunsplit(PyObject *, PyObject *args, PyObject *kwargs) {
605605
}
606606
DWORD cch = 0;
607607
PyObject *r = NULL;
608-
url.lpszUserName = encode_url_part(user, user ? wcslen(user) : 0, true);
608+
url.lpszUserName = escape_url_part(user, user ? wcslen(user) : 0, true);
609609
if (user && !url.lpszUserName) {
610610
goto exit;
611611
}
612-
url.lpszPassword = encode_url_part(pass, pass ? wcslen(pass) : 0, true);
612+
url.lpszPassword = escape_url_part(pass, pass ? wcslen(pass) : 0, true);
613613
if (pass && !url.lpszPassword) {
614614
goto exit;
615615
}

0 commit comments

Comments
 (0)