Maximilian Hils
770936f1f9
raise TypeError on invalid header assignment, fix #1562
2016-09-21 19:21:32 -07:00
arjun23496
a8deed1f4e
Lint fix - minor
2016-08-31 16:39:04 +05:30
arjun23496
2476809ff8
Lint fix - replace tests
2016-08-31 16:27:22 +05:30
arjun23496
d2cfa5ca41
Added tests for replace in request,message,header
2016-08-31 10:23:33 +05:30
Maximilian Hils
f27028f58e
introduce Response.make for simple response creation
2016-08-23 00:17:06 -07:00
Shadab Zafar
bc175b58f2
Use test times less than 2038
...
So that tests pass on 32bit systems too
2016-08-15 12:00:23 +05:30
Shadab Zafar
ec0bae35c5
Assert cookie groups explicitly rather than just the length
2016-08-15 12:00:23 +05:30
Shadab Zafar
988174246b
Add some cookie formatting related tests
2016-08-15 12:00:23 +05:30
Shadab Zafar
03e6117042
Add a function to get cookie expiration time
2016-08-15 12:00:23 +05:30
Shadab Zafar
a479c51465
Add method to group pairs by cookies
2016-08-15 12:00:23 +05:30
Maximilian Hils
013288f7ca
add quote/unquote tests
2016-07-24 19:38:44 -07:00
Maximilian Hils
e07f515a20
remove content caching in netlib.http.Message
2016-07-23 19:05:10 -07:00
Maximilian Hils
798759d2b3
fix content view cache invalidation
2016-07-21 19:49:32 -07:00
Aldo Cortesi
02acfb1242
Fix netlib.utils.is_valid_host
...
- Don't crash when passed an empty string. This translated into an actual core
crash, discovered while fuzzing with afl.
- Taking a slice of length one out of bytes returns an integer, so the check
for trailing period in this function never worked on Python3.
- Add unit tests.
2016-07-21 10:38:37 +12:00
Thomas Kriechbaumer
a32312cecc
fix-1366
2016-07-16 18:31:37 +02:00
Maximilian Hils
e6e39ce80f
preserve content-type parameter order
2016-07-15 23:46:12 -07:00
Maximilian Hils
3602fd7a36
Merge remote-tracking branch 'origin/master' into message-body-encoding
2016-07-15 23:17:57 -07:00
Maximilian Hils
a3c7c84d49
improve message content semantics
2016-07-15 22:50:33 -07:00
Shadab Zafar
39f5108400
Test cookies.is_expired separately
2016-07-10 01:06:50 +05:30
Maximilian Hils
76473d44e0
py3++
2016-07-07 17:50:26 -07:00
Maximilian Hils
f62e976e1e
py3++
2016-07-07 17:29:22 -07:00
Maximilian Hils
a6b3551934
raise ValueError if content-encoding is invalid
2016-07-04 13:58:09 -07:00
Maximilian Hils
2f8a1fd2cb
tests++
2016-07-02 03:03:42 -07:00
Maximilian Hils
6032c4f235
message.content -> .raw_content, implement .text
...
This PR improves our handling of HTTP message body encodings:
- The unaltered message body is now accessible as `.raw_content`
- The "content-encoding"-decoded content (i.e. gzip removed) content
is not `.content`, as this is what we want in 99% of the cases.
- `.text` now provides the "content-encoding"-decoded and then
"content-type charset"-decoded message body.
- The decoded values for `.content` and `.text` are cached,
so that repeated access and `x.text = x.text` is cheap.
- The `decoded()` decorator is now deprecated, as we can now just use
`.content`. Similarly `HTTPMessage.get_decoded_content()` is
deprecated.
2016-07-02 01:51:47 -07:00
Thomas Kriechbaumer
eb3ed87100
move custom HTTP/2 stack from netlib to pathod
2016-06-17 15:06:01 +02:00
Aldo Cortesi
9e63350a96
Use handlers in http2 test suite
2016-06-14 14:32:18 +12:00
Maximilian Hils
30fff1fb32
be more strict about module namespaces
2016-05-31 14:05:57 -07:00
Aldo Cortesi
42e91fcfe1
http2.frame -> http2.framereader
2016-05-31 20:32:28 +12:00
Aldo Cortesi
5a75ea3fc6
Fix test failures
2016-05-31 20:19:54 +12:00
Aldo Cortesi
40a030f215
Satisfy flake8
2016-05-31 19:58:28 +12:00
Aldo Cortesi
ec34cae618
utils.multipartdecode -> http.multipart.decode
...
also
utils.parse_content_type -> http.headers.parse_content_type
2016-05-31 19:07:55 +12:00
Aldo Cortesi
15b2374ef9
netlib.utils.get_header_tokens -> netlib.http1.read.get_header_tokens
...
Placing this next to its only use.
2016-05-31 18:54:42 +12:00
Aldo Cortesi
6dda2b2ee5
Module is part of the name - url.decode, not url.urldecode
...
A pattern we need to use far more often in the codebase
2016-05-31 18:46:19 +12:00
Aldo Cortesi
4e6c9c4e93
Extract url functions from netlib.utils and move to netlib.http.url
2016-05-31 18:42:56 +12:00
Aldo Cortesi
08fbe6f111
Start cleaning up netlib.utils
...
- Remove http2 functions, move to http2.frame
- Remove Serializable, move to netlib.basetypes
2016-05-31 17:16:31 +12:00
Aldo Cortesi
9ea68ebd28
Improve handling of pseudo-headers
...
- The canonical source for :method, :scheme and :path are the .method, .scheme
and .path attributes on the request object.
- These pseudo-headers are stripped after reading the request, and re-inserted
just before sending.
- The :authority header remains, and should be handled analagously to the Host
header in HTTP1 with respect to display and user interaction.
2016-05-31 14:36:17 +12:00
Thomas Kriechbaumer
03167d5e71
fix headers order
2016-05-29 22:07:22 +02:00
Thomas Kriechbaumer
e2447406cc
more style cleanup
2016-05-29 13:43:20 +02:00
Thomas Kriechbaumer
8eeab37a07
more style cleanup
...
Use this to check:
flake8 --count mitmproxy netlib pathod examples test
2016-05-29 11:55:12 +02:00
Maximilian Hils
85aa5da6e3
fix tests
2016-05-28 19:31:43 -07:00
Thomas Kriechbaumer
caee1adeb6
cleanup imports with flake8
2016-05-28 14:43:32 +02:00
Aldo Cortesi
43d7965532
Clean un-needed imports
2016-05-21 15:00:52 +12:00
Maximilian Hils
b538138ead
tests++
2016-05-20 11:04:27 -07:00
Maximilian Hils
6f8db2d7eb
improve MultiDict, add ImmutableMultiDict, adjust response.cookies
2016-05-18 22:50:19 -07:00
Maximilian Hils
44ac64aa72
add MultiDict
...
This commit introduces MultiDict, a multi-dictionary similar to
ODict, but with improved semantics (as in the Headers class).
MultiDict fixes a few issues that were present in the Request/Response
API. In particular, `request.cookies["foo"] = "bar"` has previously been a
no-op, as the cookies property returned a mutable _copy_ of the cookies.
2016-05-18 18:46:42 -07:00
Thomas Kriechbaumer
bef72c1b02
Merge pull request #1121 from Kriechi/fix-cookies
...
improve cookie parsing
2016-05-11 12:30:44 -05:00
Maximilian Hils
4c8e334642
actually fix tests
2016-05-10 12:19:26 -06:00
Maximilian Hils
bb4f9611f5
Revert "fix tests"
...
This reverts commit f315dc1eb9
.
2016-05-10 12:18:05 -06:00
Maximilian Hils
f315dc1eb9
fix tests
2016-05-10 12:17:25 -06:00
Thomas Kriechbaumer
08002282e8
improve cookie parsing
...
allows '/' to be within a cookie name
removes deprecated cookie getter/setter
fixes #1118
2016-05-10 11:13:12 -05:00