瀏覽代碼

Updating to neon 0.34.0 + Enabling more modern networking API

Source commit: 581a0c278f2da606574f52878919f65399320877
Martin Prikryl 10 月之前
父節點
當前提交
caff935bba
共有 4 個文件被更改,包括 23 次插入3 次删除
  1. 8 0
      libs/neon/src/config.h
  2. 7 2
      libs/neon/src/ne_auth.c
  3. 5 1
      libs/neon/src/ne_redirect.c
  4. 3 0
      libs/neon/src/ne_socket.c

+ 8 - 0
libs/neon/src/config.h

@@ -41,6 +41,14 @@
 
 #define NE_HAVE_TS_SSL 1
 
+#define HAVE_INET_NTOP 1
+#define HAVE_INET_PTON 1
+#define HAVE_IF_INDEXTONAME 1
+#define HAVE_IF_NAMETOINDEX 1
+#define USE_GETADDRINFO
+#define USE_GAI_ADDRCONFIG
+#define NE_HAVE_IPV6 // doesn't really have any practival effect
+
 /* Define to enable debugging */
 #define NE_DEBUGGING 1
 

+ 7 - 2
libs/neon/src/ne_auth.c

@@ -434,7 +434,12 @@ static int get_credentials(auth_session *sess, ne_buffer **errmsg, int attempt,
 {
     unsigned mask = chall->protocol->id | sess->spec->protomask;
     int rv;
-    char *realm = ne_strclean(ne_strdup(sess->realm));
+    char *realm =
+                  #ifdef WINSCP
+                  // No "realm" in "passport" auth
+                  sess->realm == NULL ? NULL :
+                  #endif
+                  ne_strclean(ne_strdup(sess->realm));
 
     if (chall->handler->new_creds)
         rv = chall->handler->new_creds(chall->handler->userdata,
@@ -1580,7 +1585,7 @@ static int passport_challenge(auth_session *sess, int attempt,
         while (*auth_hdr == ' ') auth_hdr++;
 
         ne_fill_server_uri(session, &orig_uri);
-        orig_uri.path = ne_strdup(areq->uri);
+        orig_uri.path = ne_strdup(areq->target);
         org_url = ne_uri_unparse(&orig_uri);
         ne_uri_free(&orig_uri);
 

+ 5 - 1
libs/neon/src/ne_redirect.c

@@ -63,7 +63,11 @@ static int post_send(ne_request *req, void *userdata, const ne_status *status)
     uri_free_clear(red);
 
     if (status->klass == 3
-        && (loc = ne_get_response_location(req, NULL)) != NULL) {
+#ifdef WINSCP
+        && !is_passport_challenge(req, status)
+#endif
+        && (loc = ne_get_response_location(req, NULL)) != NULL
+        ) {
         red->uri = loc;
         return NE_REDIRECT;
     }

+ 3 - 0
libs/neon/src/ne_socket.c

@@ -69,6 +69,9 @@
 #ifdef HAVE_WSPIAPI_H
 #include <wspiapi.h>
 #endif
+#if (defined WINSCP) && (HAVE_IF_INDEXTONAME)
+#include <iphlpapi.h>
+#endif
 #endif
 
 #if defined(HAVE_OPENSSL) && defined(HAVE_LIMITS_H)