Lonami Exo
07ece83aba
Fix overlapping markdown entities being skipped
2017-11-06 10:37:22 +01:00
Lonami Exo
4f80429215
Work on byte level when parsing markdown
...
Reasoning: instead encoding every character one by one as we
encounter them to use half their length as the correct offset,
we can simply encode the whole string at once as utf-16le and
work with that directly.
2017-11-06 10:29:32 +01:00
Viktor Oreshkin
49eb281251
Proper offset calculation for markdown ( #407 )
...
Dan suca
If Dan shared it with Traitor I'll not have to spend my time on this
Not a, sorry for not letting you sleep
k thx bye
Will this stay in history?
2017-11-06 00:17:22 +01:00
Lonami Exo
82cac4836c
Fix markdown URL parsing using character index instead offset
2017-10-30 11:15:53 +01:00
Lonami Exo
0a14aa1bc6
Remove additional check when calculating emojies length
...
This special check treated some emojies as 3 characters long but
this shouldn't have actually been done, likely due to the old
regex matching more things as emoji than it should (which would
have count as 2 too, making up for 1+3 from the new is_emoji()).
2017-10-30 10:56:39 +01:00
Lonami Exo
2609bd9bd1
Use constants and allow empty URL regex when parsing markdown
2017-10-29 18:21:21 +01:00
Lonami Exo
d47a9f83d0
Fix some special cases which are not treated as emojis (offset 1)
2017-10-29 17:07:37 +01:00
Lonami Exo
bcaa8007a3
Fix inline URL matching swallowing all parse entities
2017-10-29 16:43:30 +01:00
Lonami Exo
f5fafc6a27
Enhance emoji detection
2017-10-29 16:41:30 +01:00
Lonami Exo
368269cb11
Add ability to parse inline URLs
2017-10-29 16:33:10 +01:00
Lonami Exo
9600a9ea0b
Fix markdown parsing failing if delimiter was last character
2017-10-28 19:17:18 +02:00
Lonami Exo
5adec2e1ab
Initial attempt at parsing Markdown-like syntax
2017-10-28 19:06:41 +02:00
Lonami Exo
4fd9d361f0
Replace redundant isinstance calls with a tuple parameter
2017-10-13 11:39:34 +02:00
Lonami Exo
6242cc8159
Fix .tgread_object not seeking back on TypeNotFoundError
2017-10-12 18:52:04 +02:00
Lonami Exo
91a5d20e93
Replace .on_response with static .from_reader for all types
2017-10-07 13:26:09 +02:00
Lonami Exo
71c2a82b3d
Completely remove BinaryWriter from the project
2017-09-28 11:49:45 +02:00
Lonami Exo
b83cd98ba0
Replace TLObject.on_send with the new .to_bytes()
...
This also replaces some int.to_bytes() calls with a faster
struct.pack (up to x4 faster). This approach is also around
x3 faster than creating a BinaryWriter just to serialize a
TLObject as bytes.
2017-09-26 14:36:02 +02:00
Lonami Exo
b0f6b23e52
Fix creating new connections accessing invalid attributes
2017-09-22 16:11:07 +02:00
Lonami Exo
9dfb5d493c
Fix BrokenPipeError was instance of OSError
2017-09-22 13:51:11 +02:00
Lonami Exo
a992f42781
Attempt at fixing socket is None on .connect()
2017-09-22 13:14:56 +02:00
Lonami Exo
2b2da843a1
Create a Connection only once and avoid no-op if was "connected"
2017-09-21 13:44:22 +02:00
Lonami Exo
4777b8dad4
Handle .connect() method more gracefully
2017-09-21 13:44:22 +02:00
Sergey
446174c7de
Catching WinError 10038
...
While client.connect() there were OSError: [WinError 10038] an operation was attempted on something that is not a socket
2017-09-21 13:37:13 +02:00
Lonami Exo
200d1d67be
Make BufferError message more useful
2017-09-18 11:45:08 +02:00
Lonami Exo
d79dccc923
Add a lock around TcpClient.close() to try avoiding None.close()
2017-09-13 09:44:58 +02:00
Lonami Exo
15fd5390ae
Optimize imports
2017-09-04 17:18:33 +02:00
Lonami Exo
97cab7347b
Make lint happier
2017-09-04 17:10:04 +02:00
Lonami Exo
626778bd32
Ignore EBADF when closing the socket
2017-09-03 13:44:29 +02:00
Lonami Exo
68cdc9eaf1
Treat OSError.errno == EBADF as a ConnectionResetError
2017-09-03 11:54:26 +02:00
Lonami Exo
2a5d08b23d
Turn socket.timeout error into the more general TimeoutError
2017-09-03 10:01:00 +02:00
Lonami Exo
b908296efa
Remove unused TcpClien.read(timeout=...) param, change other accessors
2017-09-02 19:33:42 +02:00
Lonami Exo
36f51e1e3f
Remove ability to TcpClient.cancel_read()
...
This simplifies the process of sending and receiving data,
and makes use of Python's socket.settimeout instead a hand-crafted
version with a sort-of arbitrary self.delay = 0.1 (seconds), which
should improve the speed of the method
2017-09-02 19:14:11 +02:00
Lonami Exo
cc280a129d
Remove TcpClient.write/read shared locks
...
Since they were shared between write and read, and now the read
is done constantly on a separate thread, the read lock would
cause the write method to be locked and not functional at all
2017-09-02 18:49:29 +02:00
Lonami Exo
b4811261e9
Set a known buffer size if possible on BinaryWriter()s
2017-08-29 20:44:51 +02:00
Lonami Exo
82304b18eb
Attempt at supporting IPv6 ( #211 and #112 )
2017-08-29 13:49:41 +02:00
Lonami Exo
592e107f52
Recreate the TCP socket only when needed
2017-08-29 13:35:56 +02:00
Lonami Exo
a3c2c462a7
Add support for tcp_obfuscated on the Connection class ( #112 )
2017-08-28 21:44:02 +02:00
Lonami Exo
5404670469
Implement and use TCP obfuscated as a PoC ( #112 )
...
Credits to MadelineProto/Connection.php by @danog
2017-08-28 20:25:44 +02:00
Lonami Exo
adfebfc82c
Remove ThreadTcpClient test (committed by mistake)
2017-08-28 17:46:31 +02:00
Lonami Exo
1a6231472e
Ensure the connection is flagged as closed on errors, move #201
2017-08-22 23:12:32 +02:00
Lonami Exo
1f7ac71187
Debug level should always be used for logging since it's a library
2017-07-10 15:21:20 +02:00
Lonami Exo
0cfbf63eaf
Fix ConnectionResetError not flagging the socket as disconnected
2017-06-27 10:18:35 +02:00
Lonami Exo
843c16215c
Add timeout parameter on TcpClient.connect() too
2017-06-22 19:21:33 +02:00
Lonami Exo
e4fbd87c75
Turn timeout into a property instead leaving it as a parameter
2017-06-22 11:43:42 +02:00
Lonami Exo
d8afb7e548
Also except BlockingIOError on TcpClient.send()
2017-06-12 10:44:04 +02:00
Lonami Exo
7adb4f09d6
Slightly reorganise the project structure
2017-06-09 16:13:39 +02:00