Loading src/http.cpp +433 −175 File changed.Preview size limit exceeded, changes collapsed. Show changes src/http.h +4 −2 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ namespace libhttppp { class HttpClient{ public: HttpClient( const HttpUrl &desturl); HttpClient( const HttpUrl &desturl, int vers = 2); ~HttpClient()=default; void reconnect(); const std::vector<char> Get(HttpRequest &nreq, size_t maxTries=0); Loading Loading @@ -124,7 +124,7 @@ namespace libhttppp { int readchunk(const char *data,int datasize,int &pos); // Non-blocking I/O helpers using poll() for efficient waiting size_t _recvBlocking(netplus::buffer &b); size_t _recvBlocking(netplus::buffer &b, int timeout_sec = 60); // Returns 0 on EAGAIN (no data yet), otherwise bytes read size_t _recvNonBlocking(netplus::buffer &b); void _sendAll(const char *data, size_t len); Loading Loading @@ -169,6 +169,8 @@ namespace libhttppp { bool _streamH3EndStream = false; std::vector<uint8_t> _streamH3Raw; // raw frame buffer std::vector<char> _streamH3Body; // decoded DATA frames not yet consumed bool _streamH3InDataFrame = false; // true when inside a partial DATA frame uint64_t _streamH3DataRemaining = 0; // bytes left in current DATA frame private: HttpUrl _url; Loading src/httpd.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -1016,6 +1016,8 @@ void libhttppp::HttpEvent::Http3StreamEvent(netplus::socket *sock, if (is_streaming) { tempreq.SendData.pos = 0; size_t max_iter = content_length / BLOCKSIZE + 4096; size_t empty_streak = 0; const size_t max_empty = 600; // ~60s at 100ms waits for (size_t i = 0; i < max_iter && body.size() < content_length; ++i) { Loading @@ -1024,8 +1026,13 @@ void libhttppp::HttpEvent::Http3StreamEvent(netplus::socket *sock, if (sa > 0) { body.append(tempreq.SendData.data(), sa); tempreq.SendData.clear(); empty_streak = 0; } else { ++empty_streak; if (empty_streak >= max_empty) break; // Yield briefly so upstream data can arrive std::this_thread::sleep_for(std::chrono::milliseconds(100)); } } } Loading Loading @@ -1176,7 +1183,8 @@ void libhttppp::HttpEvent::ResponseEvent(netplus::con &curcon,const int tid,ULON } ResponseEvent(cureq,tid,args); if(cureq.SendData.empty()){ if(cureq.SendData.empty() && !cureq.slots[0].ResponsePending.load(std::memory_order_acquire)){ cureq.SendData.pos=0; cureq.clear(); } Loading src/mediadb.code-workspace 0 → 100644 +11 −0 Original line number Diff line number Diff line { "folders": [ { "path": "../../mediadb" }, { "path": "../../bolli" } ], "settings": {} } No newline at end of file Loading
src/http.h +4 −2 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ namespace libhttppp { class HttpClient{ public: HttpClient( const HttpUrl &desturl); HttpClient( const HttpUrl &desturl, int vers = 2); ~HttpClient()=default; void reconnect(); const std::vector<char> Get(HttpRequest &nreq, size_t maxTries=0); Loading Loading @@ -124,7 +124,7 @@ namespace libhttppp { int readchunk(const char *data,int datasize,int &pos); // Non-blocking I/O helpers using poll() for efficient waiting size_t _recvBlocking(netplus::buffer &b); size_t _recvBlocking(netplus::buffer &b, int timeout_sec = 60); // Returns 0 on EAGAIN (no data yet), otherwise bytes read size_t _recvNonBlocking(netplus::buffer &b); void _sendAll(const char *data, size_t len); Loading Loading @@ -169,6 +169,8 @@ namespace libhttppp { bool _streamH3EndStream = false; std::vector<uint8_t> _streamH3Raw; // raw frame buffer std::vector<char> _streamH3Body; // decoded DATA frames not yet consumed bool _streamH3InDataFrame = false; // true when inside a partial DATA frame uint64_t _streamH3DataRemaining = 0; // bytes left in current DATA frame private: HttpUrl _url; Loading
src/httpd.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -1016,6 +1016,8 @@ void libhttppp::HttpEvent::Http3StreamEvent(netplus::socket *sock, if (is_streaming) { tempreq.SendData.pos = 0; size_t max_iter = content_length / BLOCKSIZE + 4096; size_t empty_streak = 0; const size_t max_empty = 600; // ~60s at 100ms waits for (size_t i = 0; i < max_iter && body.size() < content_length; ++i) { Loading @@ -1024,8 +1026,13 @@ void libhttppp::HttpEvent::Http3StreamEvent(netplus::socket *sock, if (sa > 0) { body.append(tempreq.SendData.data(), sa); tempreq.SendData.clear(); empty_streak = 0; } else { ++empty_streak; if (empty_streak >= max_empty) break; // Yield briefly so upstream data can arrive std::this_thread::sleep_for(std::chrono::milliseconds(100)); } } } Loading Loading @@ -1176,7 +1183,8 @@ void libhttppp::HttpEvent::ResponseEvent(netplus::con &curcon,const int tid,ULON } ResponseEvent(cureq,tid,args); if(cureq.SendData.empty()){ if(cureq.SendData.empty() && !cureq.slots[0].ResponsePending.load(std::memory_order_acquire)){ cureq.SendData.pos=0; cureq.clear(); } Loading
src/mediadb.code-workspace 0 → 100644 +11 −0 Original line number Diff line number Diff line { "folders": [ { "path": "../../mediadb" }, { "path": "../../bolli" } ], "settings": {} } No newline at end of file