Feature/httpd (#94)
* Stub code for http server * can send a response, cannot process body yet * write headers to the response * remove commented code * add simple test + set default http handler * tweak CI + unittest * add missing file * rewrite http::trim in a simple way * doc
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							b26e9d0338
						
					
				
				
					commit
					f84bc53c8d
				
			@@ -232,19 +232,28 @@ namespace ix
 | 
			
		||||
    bool Socket::writeBytes(const std::string& str,
 | 
			
		||||
                            const CancellationRequest& isCancellationRequested)
 | 
			
		||||
    {
 | 
			
		||||
        char* buffer = const_cast<char*>(str.c_str());
 | 
			
		||||
        int len = (int) str.size();
 | 
			
		||||
 | 
			
		||||
        while (true)
 | 
			
		||||
        {
 | 
			
		||||
            if (isCancellationRequested && isCancellationRequested()) return false;
 | 
			
		||||
 | 
			
		||||
            char* buffer = const_cast<char*>(str.c_str());
 | 
			
		||||
            int len = (int) str.size();
 | 
			
		||||
 | 
			
		||||
            ssize_t ret = send(buffer, len);
 | 
			
		||||
 | 
			
		||||
            // We wrote some bytes, as needed, all good.
 | 
			
		||||
            if (ret > 0)
 | 
			
		||||
            {
 | 
			
		||||
                return ret == len;
 | 
			
		||||
                if (ret == len)
 | 
			
		||||
                {
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    buffer += ret;
 | 
			
		||||
                    len -= ret; 
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            // There is possibly something to be writen, try again
 | 
			
		||||
            else if (ret < 0 && Socket::isWaitNeeded())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user