src/netops.c


Log

Author Commit Date CI Message
Carlos Martín Nieto e1ce5249 2013-11-18T21:40:19 netops: fix leak
Russell Belfer 98eaf39a 2013-11-13T11:12:31 Fix warnings
Linquize fb190bbb 2013-11-12T19:44:13 Fix warnings
Ben Straub 79c44342 2013-11-05T11:35:57 Make url decoding more bulletproof
Ben Straub d6eb3f9c 2013-11-05T10:54:44 Remove unnecessary check
Ben Straub fe294b95 2013-11-05T10:37:50 Incorporate feedback
Ben Straub 16bffd1c 2013-11-04T12:04:17 Unescape url-encoded usernames and passwords
Ben Straub c227c173 2013-11-04T11:42:14 Use http_parser_parse_url to parse urls
Ben Straub 56c1cda2 2013-11-01T19:22:43 Clarify parsing issues and errors
Ben Straub 7e035908 2013-11-01T15:29:25 Streamline url-parsing logic.
Ben Straub 048f837b 2013-10-31T13:30:22 Prevent another segfault from bad URL
Ben Straub 151b3218 2013-10-31T13:16:04 Prevent segfault with a badly-formed URL
Ben Straub 41a6de28 2013-10-02T14:45:57 HTTP: handle "relative" redirects
Ben Straub b59344bf 2013-09-26T16:48:08 Tighten up url-connection utility
Ben Straub ea59f659 2013-09-26T16:20:30 Deploy gitno_connection_data into transport (winhttp) ...and have that call manage replaced memory in the output structure.
Ben Straub 8988688c 2013-09-25T20:41:56 Migrate redirect URL handling to common utility
Russell Belfer eb0ff130 2013-09-24T14:07:08 Disconnect path string to preserve after redirect The subtransport path was relying on pointing to data owned by the remote which meant that after a redirect, the updated path was getting lost for future requests. This updates the http transport to strdup the path and maintain its own lifetime. This also pulls responsibility for parsing the URL back into the http transport and isolates the functions that parse and free that connection data so that they can be reused between the initial parsing and the redirect parsing.
Ben Straub c9144405 2013-09-23T11:37:35 Properly parse urls that include protocol://
Fraser Tweedale e5296308 2013-08-24T20:15:22 netops: remove duplicate include 9e9aee6 added an include <netinet/in.h> to fix the build on FreeBSD. Sometime since then the same header is included ifndef _WIN32, so remove the duplicate include.
Russell Belfer de81aee3 2013-02-04T14:49:28 Merge pull request #1298 from ben/user-at Handle "user@" prefix for credentials partially included in URLs
Sven Strickroth c70455c7 2013-02-01T22:53:51 Deduplicate FormatMessage UTF-16 to UTF-8 conversion code Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth bd25a302 2013-02-01T22:22:26 Improved error handling Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth 89ad1c57 2013-02-01T22:14:52 Get utf8_size from WideCharToMultiByte instead of guessing it Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth b0dc81f0 2013-02-01T16:17:34 Win32: Make sure error messages are consistently UTF-8 encoded W/o this a libgit2 error message could have a mixed encoding: e.g. a filename in UTF-8 combined with a native Windows error message encoded with the local code page. Signed-off-by: Sven Strickroth <email@cs-ware.de>
Ben Straub c4beee76 2013-02-01T10:00:55 Introduce git__substrdup
Ben Straub cf7038a6 2013-01-31T14:04:21 Enhance url parsing to include passwords
Ben Straub 2234b2b0 2013-01-30T19:03:58 Stash username from url (but don't use it yet)
Ben Straub 5f10853e 2013-01-30T18:50:31 Skip "user@" when finding hostname in url
Philip Kelley cfc39f50 2013-01-25T22:43:52 Fix 3 memory leaks
Carlos Martín Nieto 7a2cf780 2013-01-20T01:57:32 Fix compilation on OpenBSD
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
Michael Schubert f2b00cbd 2012-12-17T19:35:40 netops: on SSL teardown only send shutdown alert According to man 3 SSL_shutdown / TLS, "If a unidirectional shutdown is enough (the underlying connection shall be closed anyway), this first call to SSL_shutdown() is sufficient." Currently, an unidirectional shutdown is enough, since gitno_ssl_teardown is called by gitno_close only. Do so to avoid further errors (by misbehaving peers for example). Fixes #1129.
Michael Schubert 9c8dbc88 2012-12-17T19:18:34 netops: properly handle GITNO_CONNECT_SSL_NO_CHECK_CERT Don't return an error just because GITNO_CONNECT_SSL_NO_CHECK_CERT is set.
Fraser Tweedale 9e9aee67 2012-11-26T23:29:34 fix build on FreeBSD 3f9eb1e introduced support for SSL certificates issued for IP addresses, making use of in_addr and in_addr6 structs. On FreeBSD these are defined in (a file included in) <netinet/in.h>, so include that file on FreeBSD and get the build working again.
Philip Kelley 9d641283 2012-11-08T08:06:23 Merge pull request #1048 from pwkelley/basic_auth Basic authentication for http and winhttp
Eduardo Bart 345eef23 2012-11-07T16:10:57 Move inet_pton to posix platform-compatibility layer
Eduardo Bart d1a69d0f 2012-11-06T20:16:53 Fix compilation for mingw32 and cygwin inet_pton is available only in windows vista or later, fixed the issue by reimplementing it using WSAStringToAddress
Philip Kelley 2f7538ec 2012-11-06T09:36:04 Fix connection leak in http subtransport
Philip Kelley 41fb1ca0 2012-10-29T13:41:14 Reorganize transport architecture (squashed 3)
Ben Straub 7bcd9e23 2012-10-19T19:23:32 gitno_buffer: callback on each packet The fetch code takes advantage of this to implement a progress callback every 100kb of transfer.
Michael Schubert 65ac67fb 2012-08-28T21:58:10 netops: be more careful with SSL errors SSL_get_error() allows to receive a result code for various SSL operations. Depending on the return value (see man (3) SSL_get_error) there might be additional information in the OpenSSL error queue. Return the queued message if available, otherwise set an error message corresponding to the return code.
Michael Schubert 4deda91b 2012-09-04T00:13:59 netops: continue writing on SSL_ERROR_WANT_WRITE
Carlos Martín Nieto 0d5dce26 2012-08-28T14:15:32 ssl: make cert check ignore work for invalid certs, not just CNs Passing SSL_VERIFY_PEER makes OpenSSL shut down the connection if the certificate is invalid, without giving us a chance to ignore that error. Pass SSL_VERIFY_NONE and call SSL_get_verify_result if the user wanted us to check. When no CNs match, we used to jump to on_error which gave a bogus error as that's for OpenSSL errors. Jump to cert_fail so we tell the user that the error came from checking the certificate.
Vicent Marti e25dda51 2012-08-02T01:38:30 Merge remote-tracking branch 'nulltoken/topic/amd64-compat' into development Conflicts: src/netops.c src/netops.h src/oid.c
Carlos Martín Nieto 0048372a 2012-07-27T01:09:06 transport: rename encrypt to use_ssl SSL isn't the only way that a transport can be encrypted. The new name will make it easier to merge the SSH support.
Carlos Martín Nieto 8861d32f 2012-07-25T16:16:53 ssl: use the callback instead of ifs to determine how to get data Using the callbacks makes it clearer and reduces the amount of #ifdefs and ifs and we need in the code.
Carlos Martín Nieto b49c8f71 2012-07-24T19:03:22 remote: use the same code to control git and http This allows us to add capabilitites to both at the same time, keeps them in sync and removes a lot of code. gitno_buffer now uses a callback to fill its buffer, allowing us to use the same interface for git and http (which uses callbacks).
nulltoken b8457baa 2012-07-24T07:57:58 portability: Improve x86/amd64 compatibility
Vicent Marti 798e4d53 2012-06-22T21:25:17 amigaos: Cleanup
Vicent Marti 2ae052d1 2012-06-22T20:48:50 Merge branch 'pull-req' of https://github.com/chris-y/libgit2 into amigaos
Chris Young b6423939 2012-06-20T20:35:13 more getaddrinfo compatibility
Chris Young 8d18f1f7 2012-06-20T20:12:30 getaddrinfo() replacement functions
Tim Clem ac8eac2f 2012-06-15T11:25:52 Fix compile errors when building on windows Errors were due to not including winsock2 early enough.
Chris Young d043013f 2012-06-14T19:09:42 More changes resulting from pull request
Chris Young a8df98c6 2012-06-14T18:57:24 Updates from comments on OS4 compatibility pull request http://github.com/libgit2/libgit2/pull/766
Chris Young 96ef3d84 2012-06-13T23:16:14 Make this more generic and mergeable. Needs AmigaOS.cmake now from CMake package at OS4Depot, or contents below: --8<-- SET(AMIGA 1) SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") --8<--
Chris Young 327fb51c 2012-06-09T18:13:07 Fix gethostbyname compatibility
Chris Young c41fc475 2012-06-07T21:26:39 horrid gethostbyname compatibility
nulltoken 6f944ab1 2012-06-07T13:36:28 Fix compilation warning
Carlos Martín Nieto 66798ad0 2012-06-06T11:00:15 Don't include arpa/inet.h on Windows
Vicent Martí 966fbdcb 2012-06-05T13:53:33 Merge pull request #697 from carlosmn/ssl Add HTTPS support
Scott J. Goldman c1318f71 2012-05-26T18:16:13 Use lowercase names for Windows headers Otherwise we can't cross-compile on Linux.
Carlos Martín Nieto 250b95b2 2012-05-26T21:17:08 ssl: allow skipping the server certificate check Sometimes it's useful not to perform the check. Allow it to be configurable.
Carlos Martín Nieto 3f9eb1e5 2012-05-17T22:22:05 ssl: add support for certificates issues to an IP address
Carlos Martín Nieto 441df990 2012-05-17T23:57:30 ssl: look up the last CN the alternative names don't match
Carlos Martín Nieto d3e1367f 2012-05-17T21:40:20 ssl: remove GnuTLS support It's too much work for now to redo everything. Move the ssl context struct to transport.h
Carlos Martín Nieto 16768191 2012-05-17T21:16:59 ssl: match host names according to RFC 2818 (HTTP over TLS)
Carlos Martín Nieto dbb36e1b 2012-05-17T17:56:49 ssl: check certificates against the system's trusted CAs
Carlos Martín Nieto 89460f3f 2012-05-03T14:07:55 ssl: teardown the connection on close This should help us free some resources, though the libraries do keep some buffers allocated regardless.
Carlos Martín Nieto a6f24a5b 2012-05-01T01:50:26 https: make it work with OpenSSL as well Add specific functions that use OpenSSL instead of GnuTLS
Carlos Martín Nieto 66024c7c 2012-05-01T00:05:25 http: add https support when GnuTLS is available If it's not available, an error saying so will be returned when trying to use a https:// URL. This also unifies a lot of the network code to use git_transport in many places instead of an socket descriptor.
Carlos Martín Nieto 65ca81a6 2012-05-08T14:28:21 Minor error fixes Clear the error in pkt when we notice that the remote is starting to send the packfile. Fix the format string for Windows networking errors.
Scott J. Goldman 901fbdad 2012-05-07T00:05:02 Define explicit _WIN32_WINNT version in makefile Previously, it was defined in netops.c, but it's also needed in one of the clar tests, so I figured we might as well just make it global for the whole project. Without it, the mingw32 linker won't resolve GetProcessId() (called from the core/errors.c clar test) because of some conditionals in windows.h.
Vicent Martí cd58c15c 2012-05-05T16:47:20 Merge remote-tracking branch 'scottjg/fix-mingw32' into development Conflicts: src/netops.c src/netops.h src/transports/http.c tests-clar/clar
Scott J. Goldman b4b96d56 2012-05-05T13:30:33 Fix gitno_connect() error handling on Windows gitno_connect() can return an error or socket, which is fine on most platforms where sockets are file descriptors (signed int), but on Windows, SOCKET is an unsigned type, which is problematic when we are trying to test if the socket was actually a negative error code. This fix seperates the error code and socket in gitno_connect(), and fixes the error handling in do_connect() functions to compensate. It appears that git_connect() and the git-transport do_connect() functions had bugs in the non-windows cases too (leaking sockets, and not properly reporting connection error, respectively) so I went ahead and fixed those too.
Russell Belfer 44ef8b1b 2012-04-13T13:00:10 Fix warnings on 64-bit windows builds This fixes all the warnings on win64 except those in deps, which come from the regex code.
Carlos Martín Nieto bd6585a7 2012-03-16T15:15:21 netops: show winsock error messages on Windows
Carlos Martín Nieto 56b7df10 2012-03-07T07:01:20 error-handling: netops
schu 5e0de328 2012-02-13T17:10:24 Update Copyright header Signed-off-by: schu <schu-github@schulog.org>
Ehsan Akhgari 31ffc141 2012-02-02T00:14:59 Fix the build on Emscripten struct timeval is used in this file, which requires <sys/time.h> to be included.
Vicent Marti 3286c408 2011-10-28T14:51:13 global: Properly use `git__` memory wrappers Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
Carlos Martín Nieto 51760bc1 2011-10-05T18:11:22 pkt: get rid of the chunked support It was a bad idea. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto f9613325 2011-10-05T00:42:27 http: parse the response from the server Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 34bfb4b0 2011-09-14T00:54:45 net,pkt: add chunked support As we don't know the length of the message we want to send to the other end, we send a chunk size before each message. In later versions, sending the wants might benefit from batching the lines together. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto bad53552 2011-09-30T23:48:27 netops: abstract away socket closing Winsock wants us to use closesocket() instead of close(), so introduce the gitno_close function, which does the right thing. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto ccc9872d 2011-09-30T17:21:30 Initialise the winsock DLL Windows wants us to initialise the networking DLL before we're allowed to send data through a socket. Call WSASetup and WSACleanup if GIT_WIN32 is defined. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Vicent Marti 6e34111e 2011-09-29T16:30:38 netops: Use pragmas only in MSVC
Vicent Martí 8114ee4c 2011-09-22T10:17:43 Merge pull request #405 from carlosmn/http-ls Implement ls-remote over HTTP
Vicent Marti bb742ede 2011-09-19T01:54:32 Cleanup legal data 1. The license header is technically not valid if it doesn't have a copyright signature. 2. The COPYING file has been updated with the different licenses used in the project. 3. The full GPLv2 header in each file annoys me.
Carlos Martín Nieto 928dd90a 2011-09-09T13:17:58 netops: store the error if gitno_send fails Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 24384700 2011-09-06T21:44:13 netops: don't try to free addrinfo on DNS error Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto b0bda0a4 2011-09-07T19:13:40 netops: get rid of the len - 1 limitation This was as a result of the pkt code using string functions where they shouldn't. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto db84b798 2011-09-04T15:32:11 Move extract_host_and_port to netops and add default port argument Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Vicent Marti 0bd594b6 2011-08-30T19:44:09 netops: Use the size_t, Luke
Carlos Martín Nieto 74bd343a 2011-08-19T09:03:19 Fix Windows compilation Sockets on Windows are unsigned, so define a type GIT_SOCKET which is signed or unsigned depending on the platform. Thanks to Em for his patience with this. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 427ca3d3 2011-08-12T22:44:35 Actually implement object negotiation Only signal that we need a pack if we do need it and don't send a want just because it's the first. If we don't need to download the pack, then we can skip all of the negotiation and just return success. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 39cdf272 2011-07-06T09:11:03 Fix network MSYS compilation MSYS/MinGW uses winsock but obviously doesn't set _MSC_VER. Use _WIN32 to decide whether to use winsock or BSD headers. Also remove these headers from src/transport_git.c altogether, as they are not needed. MSYS is very conservative, so we have to tell it that we don't care about versions of Windows lower than WindowsXP. We also need to tell CMake to add ws2_32 to the libraries list and we shouldn't add the -fPIC option, to MSYS because it complains that it does it anyway. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto c7c787ce 2011-06-24T18:19:00 Use gitno_buffer in the git transport This allows us to leave out the buffer handling logic. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto ea7a5452 2011-06-24T16:25:26 Add gitno_buffer as a recv wrapper Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 1b4f8140 2011-06-16T00:39:35 Create netops and start moving git:// to it Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>