Comments (6)
I am not sure if this really works. Because php doesn't support threads at all. (even pthread is not really what we needed, because it doesn't share references)
from tink_http.
Threads are not a requirement though. The runloop could still make progress two downloads in parallel, so long as each of them is performed bit by bit.
from tink_http.
Did I miss something? I thought the http request a sync operation. How does that parallelize?
from tink_http.
Well, in theory the pipes drive the sources which each read a (possibly empty) slice through a worker which hands control back to the runloop, which then schedules the next worker to progress. The IO occurs in parallel anyway (since the kernel with its TCP stack and also the server on the other end progress independently). The trick is not to block until all data is read, but just read it bit by bit. And ideally not to block if no data exists, but just yield Progress.NONE
so that other operations may check their status.
from tink_http.
Oh that means need to find out the "bit by bit" api in php. But I have no idea atm.
Or maybe just replace readAll
with something else here: https://github.com/haxetink/tink_http/blob/21ac733/src/tink/http/Client.hx#L160
from tink_http.
I created a non-blocking tink_tcp connection for php based on stream_select which might make it easier to accomplish this if read bit by bit. But it also created a mess in the source hence my comment haxetink/tink_tcp#5
from tink_http.
Related Issues (20)
- PhpContainer needs an update HOT 4
- Consider making safe methods lazy.
- Main.hx:38: Error#422: No content-length header found @ tink.http.Header.byName:91 HOT 38
- compilation cache for php not working because of ... HOT 9
- Add more header names HOT 2
- [question ]is this library support Hashlink? HOT 7
- " TestHttp is not ready to be accessed" HOT 1
- HTTP/2 Multiplexing HOT 13
- Fetch and auth in url HOT 1
- Looks like Azure uses '\r\n' carriage returns normally, which messes with Chunked HOT 4
- Make client side distinction between http and https less awkward.
- mod-neko travis-cl fails with "Server not ready" HOT 4
- Handle curl exit code HOT 1
- Define request timeout for Client.fetch HOT 4
- please update http-status lib here. HOT 1
- Expose client certificate handling. HOT 1
- [Feature request] Add a JS `fetch` client
- fetching content with more than 65536 bytes with cpp HOT 5
- Fetch throws "Https is only supporteed with -lib hxssl" on eval target
- [Question]Does tink_http support the SSE protocol? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tink_http.