Skip to content

Commit

Permalink
Merge branch 'master' of github.com:KeepSafe/aiohttp
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Jan 20, 2015
2 parents beddeb6 + 06afe9f commit deb8d17
Show file tree
Hide file tree
Showing 14 changed files with 118 additions and 65 deletions.
16 changes: 8 additions & 8 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[bumpversion]
current_version = 0.14.2a0
current_version = 0.15.0a0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>[a-z]+\d+))?
serialize =
{major}.{minor}.{patch}{release}
{major}.{minor}.{patch}

serialize =
{major}.{minor}.{patch}{release}
{major}.{minor}.{patch}
commit = True
tag = True

[bumpversion:file:aiohttp/__init__.py]

[bumpversion:part:release]
optional_value = final
values =
a0
final
values =
a0
final

2 changes: 1 addition & 1 deletion aiohttp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This relies on each of the submodules having an __all__ variable.

__version__ = '0.14.2a0'
__version__ = '0.15.0a0'


from . import hdrs # noqa
Expand Down
4 changes: 2 additions & 2 deletions aiohttp/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class BaseConnector(object):
:param conn_timeout: (optional) Connect timeout.
:param keepalive_timeout: (optional) Keep-alive timeout.
:param bool share_cookies: Set to True to keep cookies between requests.
:param bool force_close: Set to True to froce close and do reconnect
:param bool force_close: Set to True to force close and do reconnect
after each request (and between redirects).
:param loop: Optional event loop.
"""
Expand Down Expand Up @@ -223,7 +223,7 @@ class TCPConnector(BaseConnector):
:param bool verify_ssl: Set to True to check ssl certifications.
:param bool resolve: Set to True to do DNS lookup for host name.
:param familiy: socket address family
:param family: socket address family
:param args: see :class:`BaseConnector`
:param kwargs: see :class:`BaseConnector`
"""
Expand Down
35 changes: 23 additions & 12 deletions aiohttp/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import json
import re
import os
import warnings

from urllib.parse import urlsplit, parse_qsl, urlencode, unquote
from types import MappingProxyType
Expand Down Expand Up @@ -172,6 +173,8 @@ def __init__(self, app, message, payload, transport, reader, writer, *,
self._payload = payload
self._cookies = None

self._read_bytes = None

@property
def method(self):
"""Read only property for getting HTTP method.
Expand Down Expand Up @@ -281,7 +284,13 @@ def cookies(self):

@property
def payload(self):
"""Return raw paiload stream."""
"""Return raw payload stream."""
warnings.warn('use Request.content instead', DeprecationWarning)
return self._payload

@property
def content(self):
"""Return raw payload stream."""
return self._payload

@asyncio.coroutine
Expand All @@ -300,13 +309,15 @@ def read(self):
Returns bytes object with full request content.
"""
body = bytearray()
while True:
chunk = yield from self._payload.readany()
body.extend(chunk)
if chunk is EOF_MARKER:
break
return bytes(body)
if self._read_bytes is None:
body = bytearray()
while True:
chunk = yield from self._payload.readany()
body.extend(chunk)
if chunk is EOF_MARKER:
break
self._read_bytes = bytes(body)
return self._read_bytes

@asyncio.coroutine
def text(self):
Expand Down Expand Up @@ -350,7 +361,7 @@ def post(self):
keep_blank_values=True,
encoding=content_charset)

supported_tranfer_encoding = {
supported_transfer_encoding = {
'base64': binascii.a2b_base64,
'quoted-printable': binascii.a2b_qp
}
Expand All @@ -370,10 +381,10 @@ def post(self):
out.add(field.name, ff)
else:
value = field.value
if transfer_encoding in supported_tranfer_encoding:
if transfer_encoding in supported_transfer_encoding:
# binascii accepts bytes
value = value.encode('utf-8')
value = supported_tranfer_encoding[
value = supported_transfer_encoding[
transfer_encoding](value)
out.add(field.name, value)

Expand Down Expand Up @@ -1171,7 +1182,7 @@ def __init__(self, method, handler, name, path):
self._path = path

def match(self, path):
# string comparsion is about 10 times faster than regexp matching
# string comparison is about 10 times faster than regexp matching
if self._path == path:
return {}
else:
Expand Down
2 changes: 1 addition & 1 deletion aiohttp/worker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Async gunicorn worker for auihttp.wen.Application."""
"""Async gunicorn worker for aiohttp.web"""
__all__ = ['GunicornWebWorker']

import asyncio
Expand Down
2 changes: 1 addition & 1 deletion docs/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ information.


Streaming uploads
------------------
-----------------

aiohttp support multiple types of streaming uploads, which allows you to
send large files without reading them into memory.
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Any extra texts (print statements and so on) should be removed.
Tests coverage
--------------

We are stronly keeping our test coverage, please don't make it worse.
We are strongly keeping our test coverage, please don't make it worse.

Use::

Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Server example::
loop.run_until_complete(init(loop))
try:
loop.run_forever()
except KeyboardInterrrupt:
except KeyboardInterrupt:
pass


Expand All @@ -94,7 +94,7 @@ Please feel free to file an issue on `bug tracker
or have some suggestion for library improvement.

The library uses `Travis <https://travis-ci.org/KeepSafe/aiohttp>`_ for
Continious Integration.
Continuous Integration.


Dependencies
Expand Down
14 changes: 7 additions & 7 deletions docs/multidict.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. _aiohttp-multidic:
.. _aiohttp-multidict:

Multidicts
==========
Expand All @@ -21,7 +21,7 @@ Immutable proxies (:class:`MultiDictProxy` and
proxied multidict, the view reflects the multidict changes. They are
implement :class:`~collections.abc.Mapping` interface.

Regular mutable (:class:`MultiDict` and :class:`CIMultiDict`) clases
Regular mutable (:class:`MultiDict` and :class:`CIMultiDict`) classes
implement :class:`~collections.abc.MutableMapping` and allow to change
own content.

Expand All @@ -40,7 +40,7 @@ insensitive, e.g.::


MultiDict
----------------
---------

.. class:: MultiDict(**kwargs)
MultiDict(mapping, **kwargs)
Expand Down Expand Up @@ -93,7 +93,7 @@ MultiDict

.. method:: add(key, value)

Append ``(key, value)`` pair to the dictiaonary.
Append ``(key, value)`` pair to the dictionary.

.. method:: clear()

Expand Down Expand Up @@ -173,7 +173,7 @@ MultiDict

.. method:: popitem()

Remove and retun an arbitrary ``(key, value)`` pair from the dictionary.
Remove and return an arbitrary ``(key, value)`` pair from the dictionary.

:meth:`popitem` is useful to destructively iterate over a
dictionary, as often used in set algorithms.
Expand Down Expand Up @@ -217,7 +217,7 @@ CIMultiDict
Create a case insensitive multidict instance.

The behavior is the same as of :class:`MultiDict` but key
comparsions are case insensitive, e.g.::
comparisons are case insensitive, e.g.::

>>> dct = CIMultiDict(a='val')
>>> 'A' in dct
Expand Down Expand Up @@ -343,7 +343,7 @@ upstr
:class:`CIMultiDict` accepts :class:`str` as *key* argument for dict
lookups but converts it to upper case internally.

For more effective processing it shoult to know if *key* is already upper cased.
For more effective processing it should to know if *key* is already upper cased.

To skip :meth:`~str.upper()` call you may create upper cased string by
hands, e.g::
Expand Down
4 changes: 2 additions & 2 deletions docs/server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ of ``GET``, ``POST``, ``PUT`` or ``DELETE`` strings.
Handling GET params
-------------------

Currently aiohttp does not provide automatical parsing of incoming GET
Currently aiohttp does not provide automatic parsing of incoming GET
params. However aiohttp does provide a nice MulitiDict wrapper for
already parsed params.

Expand Down Expand Up @@ -119,7 +119,7 @@ GET params.
print("Passed in POST", post_params)
SSL
---------
---

To use asyncio's SSL support, just pass an SSLContext object to the
``create_server`` method of the loop.
Expand Down
2 changes: 1 addition & 1 deletion docs/web.rst
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ data asynchronously (by ``yield from ws.send_str('data')`` for example).
.. _aiohttp-web-exceptions:
Exceptions
-----------
----------
:mod:`aiohttp.web` defines exceptions for list of *HTTP status codes*.
Expand Down
Loading

0 comments on commit deb8d17

Please sign in to comment.