summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_util.erl
AgeCommit message (Collapse)Author
2011-03-05Merged revision 1076368 from trunkFilipe David Borba Manana
Catch all in couch_util:to_binary/1 list argument clause When a list_to_binary call fails, the error tag is 'error' and not 'throw'. This was noticed when this clause was being hit in an error clause of the replication http handler (couch_httpd_replicator.erl). git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1078317 13f79535-47bb-0310-9956-ffa450edef68
2011-01-28Validate doc ids that come from a PUT to a URL.Paul Joseph Davis
Backprot of 1064417 from trunk. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1064421 13f79535-47bb-0310-9956-ffa450edef68
2011-01-20COUCHDB-1034 - ignore runs of whitespace between content types in ↵Robert Newson
compressible_types list git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1061282 13f79535-47bb-0310-9956-ffa450edef68
2010-12-22Merged revision 1052031 from trunk:Filipe David Borba Manana
Make sure attachments get compressed when their MIME type lists parameters Closes COUCHDB-996. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1052032 13f79535-47bb-0310-9956-ffa450edef68
2010-11-09tidy up regex for compressible_att_typeAdam Kocoloski
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1033093 13f79535-47bb-0310-9956-ffa450edef68
2010-10-01Remove no longer necessary include macro (forgotten in revision 963038).Filipe David Borba Manana
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1003475 13f79535-47bb-0310-9956-ffa450edef68
2010-09-22Replicator: avoid percent encoding the slashes of design and local document IDs.Filipe David Borba Manana
This avoids receiving and following redirect responses from the peer. It also removes the eventual need of special rules in proxies (like Apache httpd). git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1000140 13f79535-47bb-0310-9956-ffa450edef68
2010-09-13Replicator changes:Filipe David Borba Manana
1) avoid badmatch exceptions when there's a failure opening a single document from a remote source; 2) add error log messages describing which remote documents couldn't be opened and why; 3) when replications errors can't be encoded as json, convert and send them as json strings git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@996492 13f79535-47bb-0310-9956-ffa450edef68
2010-07-19remove unguarded atom creation to prevent DOS attacks. closes COUCHDB-829John Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@965667 13f79535-47bb-0310-9956-ffa450edef68
2010-07-12Reverting revision 963042 - lists:keystore/4 only replaces the first ↵Filipe David Borba Manana
occurrence in the list. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@963367 13f79535-47bb-0310-9956-ffa450edef68
2010-07-11Removing unused function couch_util:ascii_lower/1. If ever needed, the exact ↵Filipe David Borba Manana
same functionality is provided by string:to_lower/1 (ASCII based, not Unicode nor charset based). git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@963045 13f79535-47bb-0310-9956-ffa450edef68
2010-07-11Removing unnecessary code.Filipe David Borba Manana
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@963042 13f79535-47bb-0310-9956-ffa450edef68
2010-07-11Removing couch_util:read_file_size/1 because same functionality is provided ↵Filipe David Borba Manana
by filelib:file_size/1. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@963038 13f79535-47bb-0310-9956-ffa450edef68
2010-06-24use JSON content type in replicator, require it in the _bulk_docs and other ↵John Christopher Anderson
POST apis git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@957422 13f79535-47bb-0310-9956-ffa450edef68
2010-06-16small optimization for reordering result listsAdam Kocoloski
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@955297 13f79535-47bb-0310-9956-ffa450edef68
2010-06-15iodata() type is too new for usAdam Kocoloski
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@954688 13f79535-47bb-0310-9956-ffa450edef68
2010-05-19no newlines in .ini filesJan Lehnardt
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@946465 13f79535-47bb-0310-9956-ffa450edef68
2010-05-04use crypto:md5 when available. thx fdmanana. Closes COUCHDB-757Adam Kocoloski
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@941033 13f79535-47bb-0310-9956-ffa450edef68
2010-05-04use keysearch BIF to search ejson props. Closes COUCHDB-747Adam Kocoloski
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@940708 13f79535-47bb-0310-9956-ffa450edef68
2010-04-02Deterministic/synchronous shutdown code.Damien F. Katz
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@930363 13f79535-47bb-0310-9956-ffa450edef68
2010-03-16Fixes couch_server:all_databases/0Paul Joseph Davis
The logic was failing when the database path had a '.' path component in the middle because Filename -- Root is not a prefix operation. This patch adds a normalization function to couch_util that is run on the Root and Filename variables before doing the array subtraction. I could probably make it smarter and error out but I got lazy. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@923526 13f79535-47bb-0310-9956-ffa450edef68
2010-03-05use OTP base64 lib. Patch by Filipe Manana. Closes COUCHDB-681Adam Kocoloski
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@919449 13f79535-47bb-0310-9956-ffa450edef68
2010-03-04reverting damien's latest commit until we can figure out why it's causing ↵John Christopher Anderson
failures git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@918834 13f79535-47bb-0310-9956-ffa450edef68
2010-03-04Changed process tree shutdown to be synchronous, to eliminate spurious test ↵Damien F. Katz
failures caused by processes not shutdown fast enough or at the wrong time. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@918805 13f79535-47bb-0310-9956-ffa450edef68
2010-01-29Allow storing attachments in compressed form. Closes COUCHDB-583. Thanks ↵John Christopher Anderson
Filipe Manana git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@904650 13f79535-47bb-0310-9956-ffa450edef68
2010-01-12Add utility for verifying hashes.Jason David Davies
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@898477 13f79535-47bb-0310-9956-ffa450edef68
2009-12-16Provide Content-MD5 header support for attachments.Paul Joseph Davis
Fixes COUCHDB-558. Thanks to Filipe Manana we now have checks for attachment transfer integrity using the Content-MD5 header (or trailer). Use of this integrity check is triggered by specifying a Content-MD5 header in your request with a value that is a base64 encoded md5. For requests that are using a chunked Transfer-Encoding it is also possible to use a trailer so that the Content-MD5 doesn't need to be known before transfer. This works by specifying a header "Trailer: Content-MD5" and then in the final chunk (the one with a size of zero) you can specify a Content-MD5 with exactly the same format as in the request headers. See the ETap test 130-attachments-md5.t for explicit examples of the request messages. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@891077 13f79535-47bb-0310-9956-ffa450edef68
2009-11-26Move all C code to src/couchdb/privPaul Joseph Davis
Shuffling bits around to conform to Erlang conventions. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@884671 13f79535-47bb-0310-9956-ffa450edef68
2009-11-21upgrade mochiweb to r113, use hooks instead of forking mochijson2. COUCHDB-474Adam Kocoloski
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@882941 13f79535-47bb-0310-9956-ffa450edef68
2009-11-21code improvements from tidier. Patch by Kostis Sagonas. COUCHDB-570Adam Kocoloski
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@882903 13f79535-47bb-0310-9956-ffa450edef68
2009-11-02cast string status codes (from _externals) to integers before logging. ↵Adam Kocoloski
COUCHDB-551 git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@832091 13f79535-47bb-0310-9956-ffa450edef68
2009-10-24Move stat descriptions out of the config.Paul Joseph Davis
This lists stat descriptions in an Erlang term file to avoid abusing the config system. Uses a file in CouchDB's priv directory that is a list of three-tuple terms. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@829304 13f79535-47bb-0310-9956-ffa450edef68
2009-09-09choice of uuid algos for better insert perf. Closes COUCHDB-465. Thanks ↵Adam Kocoloski
rnewson, bitdiddle git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@813051 13f79535-47bb-0310-9956-ffa450edef68
2009-08-10suppress obsolete list() guard warningAdam Kocoloski
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@802886 13f79535-47bb-0310-9956-ffa450edef68
2009-08-04Initial check-in of OAuth and cookie authentication.Damien F. Katz
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@800938 13f79535-47bb-0310-9956-ffa450edef68
2009-08-04encode slashes in db names in Location response header after database ↵Jan Lehnardt
creation, move couch_rep:url_encode/1 to couch_util:url_encode/1, closes COUCHDB-411 git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@800883 13f79535-47bb-0310-9956-ffa450edef68
2009-07-20Initial checkin of _changes filters. The prime weak-spot for this approach ↵John Christopher Anderson
is that it maintains an OS-process per connected filtered _changes consumer. I'm pretty sure we'll be able to work around this without changing the API, but it'll involve a lot of OS-process bookkeeping. Those enhancements should generally improve show & list performance as well. Punting on them for now, first wanted to get _changes filters implemented so people could give feedback. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@795687 13f79535-47bb-0310-9956-ffa450edef68
2009-07-17Deterministic revids, MD5 checking of documents, added tracking of rev when ↵Damien F. Katz
an attachment is edited to allow attachment level replication. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@795232 13f79535-47bb-0310-9956-ffa450edef68
2009-07-14wheeeeeeeeNoah Slater
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@794057 13f79535-47bb-0310-9956-ffa450edef68
2009-07-06trimmed trailing whitespaceNoah Slater
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@791350 13f79535-47bb-0310-9956-ffa450edef68
2009-06-25Adding tests for couch_task_status.erlPaul Joseph Davis
Thanks Bob Dionne git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@788246 13f79535-47bb-0310-9956-ffa450edef68
2009-05-12Add non-streaming log-file handler. A GET request to /_log will show the ↵Jan Lehnardt
last 1000 bytes of the logflie. More bytes can be requested with GET /_log?bytes=10000. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@774045 13f79535-47bb-0310-9956-ffa450edef68
2009-04-10Fixes for leaked file handles, with test.Damien F. Katz
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@763858 13f79535-47bb-0310-9956-ffa450edef68
2009-03-13Commit Damien's rep_security branch to trunk. John Christopher Anderson
Changes bulk_docs conflict checking. Breaks file format, see mailing list for data upgrade procedure, or http://wiki.apache.org/couchdb/Breaking_changes git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@753448 13f79535-47bb-0310-9956-ffa450edef68
2009-03-07rewrite replicator using OTP behavioursAdam Kocoloski
- only one instance of given source->target runs at a time - supervisor restarts replications that terminate abnormally - pull repl. streams attachments directly to disk - improved memory utilization - temporarily rollback parallel async doc GETs during pull rep. - replication updates show up in Futon Status window git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@751305 13f79535-47bb-0310-9956-ffa450edef68
2008-11-20Nearly completed security/validation work. Still needs replication testing.Damien F. Katz
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@719160 13f79535-47bb-0310-9956-ffa450edef68
2008-10-02HTTPd refactoring. Moved most code out of couch_httpd into associated ↵Damien F. Katz
modules (couch_httpd_view, couch_httpd_db, couch_httpd_misc_handlers). Also a fix to removed previous doc_by_seq index entries on compaction retry. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@701173 13f79535-47bb-0310-9956-ffa450edef68
2008-08-31Merged json_term_changes branch back into trunk.Christopher Lenz
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@690668 13f79535-47bb-0310-9956-ffa450edef68
2008-08-30- Rename configuration options and sections to allow for a nicer .ini file ↵Jan Lehnardt
and HTTP API calls. - Enable .ini parser to read variable assignments with spaces around the '='-sign. - Remove inadequate comment. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@690513 13f79535-47bb-0310-9956-ffa450edef68
2008-08-22Fix for couch_server process crash when databases that don't exist are ↵Damien F. Katz
attempted to be opened. Removed old comments and fixed the AllowRemoteRestart testing option. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@688129 13f79535-47bb-0310-9956-ffa450edef68