Commit Graph

2457 Commits

Author SHA1 Message Date
Adrien Destugues
9f7d29b05e Fix two problems with chunked gzipped HTTP replies.
* receiveEnd is set in a different place in case of chunked transfers,
which would cause the decompressor to never be flushed.
* In the case of chunked transfers, we call Flush() without any input
data (to flush only whatever is remaining in the decompression buffer).
This causes ZLib to return Z_BUF_ERROR which is translated to
B_BUFFER_OVERFLOW. This is a non-fatal error and is expected behavior in
that case. Don't handle this as an error, and do use the extracted data.

Fixes various cases of missing the last chunk of a page (pastie.org,
Google search results, and more).
2014-07-21 11:49:42 +02:00
John Scipione
24588f6b80 BShape: Rename these params back in header.
Accidentally renamed these in the header, rename them back to
match the cpp file. These param names might not be very good but
they match the struct variable names. They are private methods
anyway. No functional change intended in either commit.
2014-07-14 19:15:13 -04:00
John Scipione
db1ef05aef BShape: Style fixes for docs 2014-07-14 19:02:44 -04:00
Ingo Weinhold
e1e6c12480 BPackageWriter::Recompress(): Change param to BPositionIO*
Besides that this is a nicer interface, it allows us to get a the HPKG
header as a side effect of initializing the reader, thus preventing
seeking backward in the file. This makes "package recompress - <file>"
work.
2014-07-13 17:57:57 +02:00
Ingo Weinhold
44c4771163 BPackageWriter: Add BPositionIO support 2014-07-13 17:57:55 +02:00
Ingo Weinhold
8f5130edfa package kit: Actually add support for B_HPKG_COMPRESSION_NONE
Until now we always declared in the HPKG header that the package file is
zlib compressed. For uncompressed files we would just store all
individual chunks uncompressed. Now we handle completely uncompressed
files slightly differently: We don't write the redundant chunk size
table anymore. The size savings are minor, but it makes the uncompressed
format read-streamable which may be handy.
2014-07-12 23:12:21 +02:00
Ingo Weinhold
e527b79631 Switch package file accessor classes to use BPositionIO
* PackageFileHeap{Reader,Writer} as well as Package{Reader,Writer} and
  their implementation and super classes do now internally use a
  BPositionIO instead of a FD to access the package file. This provides
  more flexibility needed for features to come.
* BPackageReader has already grown a new Init() version with a
  BPositionIO* parameter.
2014-07-12 15:40:22 +02:00
Ingo Weinhold
8546c4160e BPositionIO: Add {Read,Write}AtExactly()
Analoguous to {Read,Write}Exactly(), just for the *At() versions.
2014-07-12 15:40:21 +02:00
Ingo Weinhold
cdfeba5a1e BPackageWriter: Add Recompress()
Allows rewriting an existing package file with a different compression.
2014-07-08 22:00:35 +02:00
Ingo Weinhold
72f6b787cf BUrl: Add missing functionality from support kit BUrl 2014-07-03 17:39:59 +02:00
Ingo Weinhold
b773d89eba BDataIO: Add Flush() 2014-06-30 21:55:40 +02:00
John Scipione
732c579702 Roster: style fixes.
* Check if == NULL or == 0 explicitily
* Use NULL instead of 0 as default value for pointers in header.
* other little stuff, new lines, comments
2014-06-25 19:31:24 -04:00
John Scipione
e0016ffde9 Style fixes to BRoster, move docs to doxygen.
Keep the brief description as a regular comment above each public method.

Leave the docs of private methods.

Some variable renaming mostly because of abbreviations.

Add documentation for all the public methods and app_info members and defines
that didn't have docs in the cpp file.
2014-06-25 15:35:09 -04:00
Adrien Destugues
158ae74373 Escape reserved characters when converting paths to urls
* Introduce and use BUrl::BUrl(const BPath&)
* The path is url-encoded, and the protocol is set to "file"

Fixes #10964.
2014-06-25 10:45:03 +02:00
John Scipione
29e8fa5922 Style fixes to Support Kit files 2014-06-24 19:30:54 -04:00
Ingo Weinhold
32832cbe47 Remove BPackageKit::BDataOutput
Use BDataIO instead.
2014-06-23 22:58:15 +02:00
Ingo Weinhold
0d8b44e25b BDataIO: Add methods {Read,Write}Exactly() 2014-06-23 22:58:15 +02:00
Ingo Weinhold
dec78bb27c Add new error codes B_PARTIAL_{READ,WRITE} 2014-06-23 22:58:15 +02:00
Ingo Weinhold
98759fe6e6 BDataIO: Provide default implementations for Read()/Write()
This makes the interface somewhat more suitable for unidirectional use,
since one doesn't have to implement the other, not needed method.
2014-06-23 22:58:14 +02:00
Adrien Destugues
33d60fa21f BRegion: add ScaleBy(BSize) and user documentation. 2014-06-19 19:23:31 +02:00
Adrien Destugues
669ac9d6f5 BRegion: add ScaleBy method.
* Is there a reason to not have it?
2014-06-19 18:05:14 +02:00
John Scipione
8d39283b71 While I'm at it fix tiny style issue I missed 2014-06-18 21:04:24 -04:00
John Scipione
5efee6dfb0 NodeMonitor: Revert enums back to #defines
While enums are presented much more clearly in the docs and the values didn't
change this apparently caused some issues so we're going back to using #defines.

Also update the docs changing the \var tags to \def tag and putting the description
in a \brief tag.
2014-06-18 20:57:49 -04:00
John Scipione
a30a4a41f9 Style fixes to Storage Kit classes.
No functional changes intended.

* Some variable renaming for clarity and consistency.
* Pointer style fixes.
* Added private method documentation back to cpp files for some methods.
2014-06-18 19:14:19 -04:00
Ingo Weinhold
d2d1af830b Revert "Move ZlibDecompressor to libshared"
This reverts commit 9af2105d36.

Conflicts:
	src/kits/package/Jamfile
2014-06-18 22:13:39 +02:00
Ingo Weinhold
4c235c7497 Revert "Fix more issues detected by gcc4 compiler:"
This reverts commit 19f3bae071.
2014-06-18 22:13:38 +02:00
Ingo Weinhold
5c9672edeb Add watching support for installation location package changes
Can be requested/stopped via BPackageRoster::{Start,Stop}Watching().
The notification message has the what code B_PACKAGE_UPDATE and contains
fields "event", "location", and "change count".
2014-06-17 20:32:26 +02:00
Ingo Weinhold
0de3219e33 package daemon: Rework error and issue propagation to client
* BDaemonClient: Move inner class BCommitTransactionResult to top level
  and make it public.
* BCommitTransactionResult:
  - Add a whole bunch of specific error code enum values. Such an error
    code is now the primary error, as opposed to before where we would
    mix status_t and enum value errors. There's a systemError property
    of type status_t which may provide additional information, though
    (depending on the primary error type).
  - Remove the errorMessage property. Due to mapping all errors to the
    specific error codes this is no longer necessary. Mixing such a
    message with another error description is also not very helpful when
    it comes to localization (still not supported, though).
  - Add several properties (paths, strings, error codes) that serve as
    arguments to the primary error and are used by FullErrorMessage().
  - Add issues property, a list of instances of new class
    BTransactionIssue. Those describe non-critical issues (e.g. failed
    update of a settings file) that occurred in the process of
    committing the transaction. Those issues should be presented to the
    user by the package management program.
* Exception: Adjust to transport the BCommitTransactionResult
  properties.
* CommitTransactionHandler, FsTransactions, Root, Volume: Adjust to
  BCommitTransactionResult/Exception changes.
* CommitTransactionHandler: Now requires a BCommitTransactionResult to
  which it adds the issues it encounters. The reply BMessage is no
  longer needed, though.
* Volume: Refactor common code from the three methods that use
  CommitTransactionHandler into new method _CommitTransaction.
2014-06-15 17:21:01 +02:00
John Scipione
1f424632be Style fixes to IK, focus on docs 2014-06-13 17:27:01 -04:00
John Scipione
219bf21ef6 Style fixes to Locale Kit, focus on docs. 2014-06-11 16:48:02 -04:00
John Scipione
37fedaf849 Style fixes to the Game Kit, focus on docs 2014-06-11 16:44:48 -04:00
John Scipione
be902ac4db App Kit: style changes.
No functional change intended.

Focused on documented classes only.

* Update copyright information.
* whitespace fixes.
* pointer style
* Rename some variables, msg => message, form => what
* Need consistent variable names to make documentation easier,
  allows us to use \copydoc or \copydetails instead of repeating
  ourselves over and over again.
2014-06-11 16:24:02 -04:00
Adrien Destugues
def1a05788 Made the wrong constructor private. 2014-06-11 19:27:03 +02:00
Adrien Destugues
b92e7f1512 Make BReferenceable public.
* The Network Kit now makes use of it for BUrlContext, so we need this
in the public headers.
* Problem caught by the new build bot by compiling the unit tests.
2014-06-11 17:08:05 +02:00
Adrien Destugues
895fa41e0b Make handling of Http Authentication thread safe
* Each BHttpAuthentication object is locked on all field accesses,
* They are owned by the BUrlContext and never deleted, so there is no
need for reference-counting them,
* The BUrlContext itself is now reference counted, and all BUrlRequests
hold a reference to it.

This makes sure using the BHttpAuthentication objects from requests is
thread-safe.
2014-06-11 14:11:01 +02:00
Adrien Destugues
463ffbfde4 First steps towards cookie jar thread-safety
* Change the semantics of the iterators copy constructor and assignment
operator: they now return a new iterator for the same cookie jar (and
same url for the UrlIterator). They don't try to point to the same
position as the copied iterator. The only purpose of these is to write
code such as:

Iterator it = jar.GetIterator();

so having a full copy isn't that useful.

* The per-domain cookie lists are now protected with a read-write lock.
The iterators retain a read lock while they are handling cookies from
that list. They get a write lock when doing Remove. Adding a cookie to
the jar also gets the write lock for the matching list

* Fix a memory leak when adding a new domain-list to the jar failed

* Simplify the declaration of the PrivateHashMap type (it would be
even simpler if HashMap was a public API)

* The domain hashmap is now a SynchronizedHashMap. It is locked as long
as an Iterator or UrlIterator exists, which may be a problem as these
are public APIs. Writing safe iterators for an hashmap with concurrent
accesses is not easy, so the API could be modified to return a list of
domains and a list of cookies for a given domain or URL instead. This
would suit the intended uses just as well.

* The jar now store const cookies, so there is no need to lock them for
access/modification. Updating a cookie is done by replacing it with
another one in the jar (with the same domain and value). There is still
the problem of deleting a cookie while other threads may still access
it, this will be fixed by making cookies BReferenceable.
2014-06-11 12:59:33 +02:00
Adrien Destugues
1cbab031fd More relaxing of cookie-setting rules
* Allow non-secure page to set (but not read) secure cookies
* Allow pages to set cookies for subdomains (but not access them)
2014-06-09 11:17:49 +02:00
Adrien Destugues
7f1f341e5f Forgot to commit changes to the header. 2014-06-06 19:11:03 +02:00
Stephan Aßmus
3df9235571 HttpRequest.h: Fixed some formatting 2014-06-06 00:23:48 +02:00
Stephan Aßmus
cb1a99c5f0 HttpHeaders: Small code refactorings
Also check BList::Add() for success when adding a BHttpHeader.
2014-06-06 00:23:47 +02:00
John Scipione
daabbbe5f9 BRegion: Style fix, update parameter name
No functional change.

Trying to indentify each kind of object uniquely and consistently.

... update docs as well.
2014-06-04 11:58:07 -04:00
Adrien Destugues
cd805f6793 Remove some redundant fields
These were getting out of sync and causing trouble, and they are easy to
compute from existing information.

Fixes some problems detected by the testsuite where the user/password or
the host would sometime disappear from the URL.
2014-06-04 11:56:23 +02:00
John Scipione
44cee34013 BRegion: Style updates for documentation.
No functional changes intended.

* Updated copyright information.
* Reduced doxygen documentation down to a helpful summary
  in a regular comment, the documentation has been moved into
  the Haiku Book.
* Some parameter renaming for consistency and clarity.
* A few other style fixes.
2014-06-03 20:26:45 -04:00
John Scipione
1f46fc6d52 BRect: Style fixes for documentation 2014-05-30 19:31:10 -04:00
Jessica Hamilton
fad4fc59f9 Revert "ByteOrder.h: remove use of __builtin_bswap16."
This reverts commit 040dc2eebc.
2014-05-30 20:39:43 +12:00
Jessica Hamilton
040dc2eebc ByteOrder.h: remove use of __builtin_bswap16.
* Fixes the build for host compilers older than gcc-4.8
2014-05-30 08:45:57 +12:00
Jessica Hamilton
44ec21c3ff ByteOrder.h: simplify compiler test
* A problem with our gcc requires adding casts for gcc4 when
  the __builtin_bswap functions are used with a format string
* Unlike gcc2, the __builtin_bswap functions do not get disabled
  despite using -fno-builtins, hence added compiler check in
  runtime_loader/utility.cpp
2014-05-30 00:15:38 +12:00
John Scipione
8ad6baf789 BButton style fixes for docs.
No functional change intended.
2014-05-28 14:21:06 -04:00
John Scipione
b29d84a85a BRadioButton style fixes for docs. 2014-05-28 14:10:35 -04:00
John Scipione
7ad8e674de BCheckBox: Style fixes, variable renaming for consistency, docs.
Also some other style fixes, no functional changes intended.
2014-05-28 14:06:32 -04:00