summaryrefslogtreecommitdiff
path: root/src/pkt.c
Commit message (Collapse)AuthorAgeFilesLines
* errors: Rename error codesbreaking-changesVicent Martí2012-05-181-2/+2
|
* errors: Rename the generic return codesVicent Martí2012-05-181-2/+2
|
* Minor error fixesCarlos Martín Nieto2012-05-081-0/+1
| | | | | | | 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.
* Merge pull request #654 from carlosmn/pkt-errVicent Martí2012-04-301-0/+21
|\ | | | | Recognize and report server-side error messages
| * net: recognize and report server-side error messagesCarlos Martín Nieto2012-04-301-0/+21
| | | | | | | | | | When e.g. a repository isn't found, the server sends an error saying so. Put that error message in our error buffer.
* | buf: deploy git_buf_len()nulltoken2012-04-301-1/+1
|/
* pkt: bring back GIT_ESHORTBUFFERCarlos Martín Nieto2012-04-291-8/+4
| | | | | | The recent 64-bit Windows fixes changed the return code in git_pkt_parse_line() so it wouldn't signal a short buffer, breaking the network code. Bring it back.
* transports: buffer the git requests before sending themCarlos Martín Nieto2012-04-251-68/+0
| | | | | | Trying to send every single line immediately won't give us any speed improvement and duplicates the code we need for other transports. Make the git transport use the same buffer functions as HTTP.
* Fix warnings on 64-bit windows buildsRussell Belfer2012-04-171-35/+42
| | | | | This fixes all the warnings on win64 except those in deps, which come from the regex code.
* error-handling: protocol, pktCarlos Martín Nieto2012-04-111-67/+50
|
* Clean up GIT_UNUSED macros on all platformsRussell Belfer2012-03-021-3/+3
| | | | | | | | | | | | | | | | | | | It turns out that commit 31e9cfc4cbcaf1b38cdd3dbe3282a8f57e5366a5 did not fix the GIT_USUSED behavior on all platforms. This commit walks through and really cleans things up more thoroughly, getting rid of the unnecessary stuff. To remove the use of some GIT_UNUSED, I ended up adding a couple of new iterators for hashtables that allow you to iterator just over keys or just over values. In making this change, I found a bug in the clar tests (where we were doing *count++ but meant to do (*count)++ to increment the value). I fixed that but then found the test failing because it was not really using an empty repo. So, I took some of the code that I wrote for iterator testing and moved it to clar_helpers.c, then made use of that to make it easier to open fixtures on a per test basis even within a single test file.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* Use git_buf for path storage instead of stack-based buffersRussell Belfer2011-12-071-9/+4
| | | | | | | | | | | | | | | | | | | | This converts virtually all of the places that allocate GIT_PATH_MAX buffers on the stack for manipulating paths to use git_buf objects instead. The patch is pretty careful not to touch the public API for libgit2, so there are a few places that still use GIT_PATH_MAX. This extends and changes some details of the git_buf implementation to add a couple of extra functions and to make error handling easier. This includes serious alterations to all the path.c functions, and several of the fileops.c ones, too. Also, there are a number of new functions that parallel existing ones except that use a git_buf instead of a stack-based buffer (such as git_config_find_global_r that exists alongsize git_config_find_global). This also modifies the win32 version of p_realpath to allocate whatever buffer size is needed to accommodate the realpath instead of hardcoding a GIT_PATH_MAX limit, but that change needs to be tested still.
* remote: Cleanup the remotes coderepo-ownershipVicent Marti2011-11-281-12/+12
| | | | | | - Hide the remaining transports code - Drop `git_headarray`, switch to using a callback to list refs. Makes the code cleaner.
* global: Properly use `git__` memory wrappersVicent Marti2011-10-281-3/+3
| | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* pkt: move the protocol strings to the top of the fileCarlos Martín Nieto2011-10-121-17/+14
| | | | | | Put them all together so we know where to find them. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* pkt: get rid of the chunked supportCarlos Martín Nieto2011-10-121-28/+5
| | | | | | It was a bad idea. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* http: simple negotiationCarlos Martín Nieto2011-10-121-0/+1
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Introduce the git_pkt_buffer_ family of functionsCarlos Martín Nieto2011-10-121-21/+82
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* net,pkt: add chunked supportCarlos Martín Nieto2011-10-121-12/+40
| | | | | | | | | 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>
* pkt: send all of the wants in the negotiationCarlos Martín Nieto2011-10-011-1/+3
| | | | | | | A missing if caused the function to return after the first want line without capabilities. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Merge pull request #421 from nulltoken/ntk/fix/config-get-set-longVicent Martí2011-09-221-1/+1
|\ | | | | config: make git_config_[get|set]_long() able to properly deal with 8 bytes wide values
| * config: make git_config_[get|set]_long() able to properly deal with 8 bytes ↵nulltoken2011-09-221-1/+1
| | | | | | | | | | | | | | | | wide values Should fix issue #419. Signed-off-by: nulltoken <emeric.fermas@gmail.com>
* | Merge pull request #405 from carlosmn/http-lsVicent Martí2011-09-221-5/+21
|\ \ | |/ |/| Implement ls-remote over HTTP
| * pkt: add the comment typeCarlos Martín Nieto2011-09-091-0/+19
| | | | | | | | | | | | This is needed for smart HTTP Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * pkt: don't use strlen before we know the name is NUL-terminatedCarlos Martín Nieto2011-09-071-5/+2
| | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | Tabify everythingVicent Marti2011-09-191-4/+4
| | | | | | | | | | | | There were quite a few places were spaces were being used instead of tabs. Try to catch them all. This should hopefully not break anything. Except for `git blame`. Oh well.
* | Cleanup legal dataVicent Marti2011-09-191-21/+3
|/ | | | | | | | | | 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.
* pkt: use sizeof() instead of strlen() to avoid variable length arrayKirill A. Shutemov2011-08-261-1/+1
| | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* Drop STRLEN() macrosKirill A. Shutemov2011-08-251-9/+9
| | | | | | | There is no need in STRLEN macros. Compilers can do this trivial optimization on its own. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* posix: Properly handle `snprintf` in all platformsVicent Marti2011-08-181-1/+2
|
* Actually implement object negotiationCarlos Martín Nieto2011-08-181-12/+21
| | | | | | | | 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>
* Remove enum git_whnCarlos Martín Nieto2011-08-181-2/+2
| | | | | | Instead, use flags inside the git_remote_head structure. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Use common capabilitiesCarlos Martín Nieto2011-08-181-3/+33
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Download packCarlos Martín Nieto2011-08-181-15/+36
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Move have sendingCarlos Martín Nieto2011-08-181-51/+52
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Implement sending havesCarlos Martín Nieto2011-08-181-1/+64
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* negotiationCarlos Martín Nieto2011-08-181-1/+1
|
* git_pkt_send_wantsCarlos Martín Nieto2011-08-181-0/+26
|
* Cleanup external APIVicent Marti2011-07-111-2/+3
| | | | | Some of the WIP API calls have been hidden in preparation for the next minor release.
* Use gitno_buffer in the git transportCarlos Martín Nieto2011-06-271-1/+2
| | | | | | This allows us to leave out the buffer handling logic. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Move git_pkt_{gen_proto,send_request} to transport_git.cCarlos Martín Nieto2011-06-261-58/+0
| | | | | | | This is where they really belong. Remvoe the prefix and make them static. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Use (s)size_tCarlos Martín Nieto2011-06-261-3/+3
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Implement and use git_pkt_send_requestCarlos Martín Nieto2011-06-261-4/+31
| | | | | | | | | | This makes it easier to send a requqest for an URL. It assumes there is a socket where the string should go out to. Make git_pkt_gen_proto accept a command parameter, which defaults to git-upload-pack Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Correctly handle network inputCarlos Martín Nieto2011-06-261-41/+57
| | | | | | | | | Add a parameter to git_pkt_parse_line to tell it how much data you have in your buffer. If the buffer is too short, it returns an error saying so. Adapt the git transport to use this and fix the offset calculation. Add the GIT_ESHORTBUFFER error code.
* Implement and use git_pkt_freeCarlos Martín Nieto2011-06-261-0/+11
| | | | | | | A git_pkt object can be one of several structs. Add this function for convenience and clarity. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Add function to generate a requestCarlos Martín Nieto2011-06-261-0/+39
| | | | | | Add git_pkt_gen_proto to crete a request from an url. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* pkt-line: read capabilitiesCarlos Martín Nieto2011-06-261-1/+20
| | | | | | | Try to read the server capabilities and add them to the git_pkt_ref struct. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* pkt-line: parse other-ref linesCarlos Martín Nieto2011-06-261-4/+57
| | | | | | Add support for parsing other-ref lines. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* pkt: make sure we really only read the lengthCarlos Martín Nieto2011-06-261-3/+16
| | | | | | | | A pkt-line's length are described in its first four bytes in ASCII hex. Copy this substring to another string before feeding it to git__strtol32. Otherwise, it will read the whole hash. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>