gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash libbase/network.cpp cygnal/ChangeLog cygn...


From: Rob Savoye
Subject: [Gnash-commit] gnash libbase/network.cpp cygnal/ChangeLog cygn...
Date: Thu, 20 Mar 2008 18:14:56 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Rob Savoye <rsavoye>    08/03/20 18:14:56

Modified files:
        libbase        : network.cpp 
        cygnal         : ChangeLog buffer.cpp handler.cpp http.cpp 
                         http.h 

Log message:
                * libbase/network.cpp: Return a 0 if the socket is never 
available
                for writing.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/network.cpp?cvsroot=gnash&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/ChangeLog?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/buffer.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/handler.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/http.cpp?cvsroot=gnash&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/http.h?cvsroot=gnash&r1=1.16&r2=1.17

Patches:
Index: libbase/network.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/network.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- libbase/network.cpp 20 Mar 2008 01:05:50 -0000      1.37
+++ libbase/network.cpp 20 Mar 2008 18:14:55 -0000      1.38
@@ -695,8 +695,8 @@
         }
 
         if (ret == 0) {
-            log_error (_("The socket for fd %d timed out waiting to read"), 
fd);
-            return -1;
+            log_debug (_("The socket for fd %d timed out waiting to read"), 
fd);
+            return 0;
         }
 
         ret = read(fd, buffer, nbytes);
@@ -785,7 +785,8 @@
         }
 
         if (ret == 0) {
-            log_error (_("The socket for fd %d timed out waiting to write"), 
fd);
+            log_debug (_("The socket for fd %d timed out waiting to write"), 
fd);
+           return 0;
         }
 
         ret = write(fd, bufptr, nbytes);

Index: cygnal/ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/cygnal/ChangeLog,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- cygnal/ChangeLog    20 Mar 2008 02:25:57 -0000      1.11
+++ cygnal/ChangeLog    20 Mar 2008 18:14:55 -0000      1.12
@@ -1,3 +1,8 @@
+2008-03-20  Rob Savoye  <address@hidden>
+
+       * http.{h,cpp}: Add support for more header fields, Accept-Range,
+       Last-Modified, Keep-Alive. Use "\r\n" instead of endl for header
+       fileds, as the two byte sequence is required by HTTP.
 
 2008-03-19  Rob Savoye  <address@hidden>
 

Index: cygnal/buffer.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/buffer.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- cygnal/buffer.cpp   20 Mar 2008 02:25:57 -0000      1.5
+++ cygnal/buffer.cpp   20 Mar 2008 18:14:56 -0000      1.6
@@ -70,9 +70,9 @@
 #ifdef USE_STATISTICS
        struct timespec now;
        clock_gettime (CLOCK_REALTIME, &now);
-       log_debug("Buffer %x (%d) stayed in queue for %g seconds",
+       log_debug("Buffer %x (%d) stayed in queue for %f seconds",
                  (void *)_ptr, _nbytes,
-                 (float)((now.tv_sec - _stamp.tv_sec) + ((now.tv_nsec - 
_stamp.tv_nsec)/1000000.0)));
+                 (float)((now.tv_sec - _stamp.tv_sec) + ((now.tv_nsec - 
_stamp.tv_nsec)/1e9)));
 #endif
         delete[] _ptr;
         _ptr = 0;

Index: cygnal/handler.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/handler.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- cygnal/handler.cpp  20 Mar 2008 02:25:57 -0000      1.6
+++ cygnal/handler.cpp  20 Mar 2008 18:14:56 -0000      1.7
@@ -201,8 +201,8 @@
 
     do {
        Buffer *buf = new Buffer;
-       int ret = hand->readNet(buf->reference(), buf->size());
-       if (ret >= 0) {
+       int ret = hand->readNet(buf->reference(), buf->size(), 15);
+       if (ret > 0) {
            if (ret != buf->size()) {
                buf->resize(ret);
            }
@@ -234,6 +234,7 @@
            Buffer *buf = hand->popout();
 //         log_debug("FIXME: got data in Outgoing que");
 //         buf->dump();
+//         ret = hand->writeNet(buf->reference(), buf->size(), 15);
            ret = hand->writeNet(buf);
            delete buf;
        }
@@ -241,7 +242,8 @@
            log_debug("Net Out handler done...");
            break;
        }
-    } while (ret >= 0);    
+    } while (ret > 0);
+    hand->closeConnection();
 }
 
 } // end of extern C

Index: cygnal/http.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/http.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- cygnal/http.cpp     20 Mar 2008 02:25:57 -0000      1.22
+++ cygnal/http.cpp     20 Mar 2008 18:14:56 -0000      1.23
@@ -136,9 +136,10 @@
     extractLanguage(buf);
     extractCharset(buf);
     extractConnection(buf);
+    extractKeepAlive(buf);
     extractEncoding(buf);
     extractTE(buf);
-    dump();
+//    dump();
 
 //     // See if we got a legit GET request
 //     if (strncmp(ptr, "GET ", 4) == 0) {
@@ -152,7 +153,7 @@
 }
 
 bool
-HTTP::formatHeader(const short type)
+HTTP::formatHeader(http_status_e type)
 {
 //    GNASH_REPORT_FUNCTION;
 
@@ -162,16 +163,23 @@
 
 
 bool
-HTTP::formatHeader(int filesize, const short type)
+HTTP::formatHeader(int filesize, http_status_e type)
 {
 //    GNASH_REPORT_FUNCTION;
 
-    _header << "HTTP/1.1 200 OK" << endl;
-    formatServer();
+    _header << "HTTP/1.1 200 OK" << "\r\n";
     formatDate();
-//    this->formatConnection("Keep-alive"); // this is the default for HTTP 1.1
-//     _header << "Accept-Ranges: bytes" << endl;
+    formatServer();
+//     if (type == NONE) {
+//     formatConnection("close"); // this is the default for HTTP 1.1
+//     }
+//     _header << "Accept-Ranges: bytes" << "\r\n";
+    formatLastModified();
+    formatEtag("24103b9-1c54-ec8632c0"); // FIXME: borrowed from tcpdump
+    formatAcceptRanges("bytes");
     formatContentLength(filesize);
+    formatKeepAlive("timeout=15, max=100");
+    formatConnection("Keep-Alive");
     formatContentType();
     // All HTTP messages are followed by a blank line.
     terminateHeader();
@@ -184,19 +192,19 @@
 //    GNASH_REPORT_FUNCTION;
 
     // First build the message body, so we know how to set Content-Length
-    _body << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">" << endl;
-    _body << "<html><head>" << endl;
-    _body << "<title>" << code << " Not Found</title>" << endl;
-    _body << "</head><body>" << endl;
-    _body << "<h1>Not Found</h1>" << endl;
-    _body << "<p>The requested URL " << _filespec << " was not found on this 
server.</p>" << endl;
-    _body << "<hr>" << endl;
-    _body << "<address>Cygnal (GNU/Linux) Server at localhost Port " << _port 
<< " </address>" << endl;
-    _body << "</body></html>" << endl;
-    _body << endl;
+    _body << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">" << "\r\n";
+    _body << "<html><head>" << "\r\n";
+    _body << "<title>" << code << " Not Found</title>" << "\r\n";
+    _body << "</head><body>" << "\r\n";
+    _body << "<h1>Not Found</h1>" << "\r\n";
+    _body << "<p>The requested URL " << _filespec << " was not found on this 
server.</p>" << "\r\n";
+    _body << "<hr>" << "\r\n";
+    _body << "<address>Cygnal (GNU/Linux) Server at localhost Port " << _port 
<< " </address>" << "\r\n";
+    _body << "</body></html>" << "\r\n";
+    _body << "\r\n";
 
     // First build the header
-    _header << "HTTP/1.1 " << code << " Not Found" << endl;
+    _header << "HTTP/1.1 " << code << " Not Found" << "\r\n";
     formatDate();
     formatServer();
     _filesize = _body.str().size();
@@ -212,26 +220,26 @@
 //    GNASH_REPORT_FUNCTION;
     boost::posix_time::ptime now = 
boost::posix_time::second_clock::local_time();
     
-//    cout <<  now.time_of_day() << endl;
+//    cout <<  now.time_of_day() << "\r\n";
     
     boost::gregorian::date d(now.date());
 //     boost::gregorian::date d(boost::gregorian::day_clock::local_day());
-//     cout << boost::posix_time::to_simple_string(now) << endl;
-//     cout << d.day_of_week() << endl;
-//     cout << d.day() << endl;
-//     cout << d.year() << endl;
-//     cout << d.month() << endl;
+//     cout << boost::posix_time::to_simple_string(now) << "\r\n";
+//     cout << d.day_of_week() << "\r\n";
+//     cout << d.day() << "\r\n";
+//     cout << d.year() << "\r\n";
+//     cout << d.month() << "\r\n";
     
 //    boost::date_time::time_zone_ptr zone(new posix_time_zone("MST"));
 //    boost::date_time::time_zone_base b(now "MST");
-//    cout << zone.dst_zone_abbrev() << endl;
+//    cout << zone.dst_zone_abbrev() << "\r\n";
 
     _header << "Date: " << d.day_of_week();
     _header << ", " << d.day();
     _header << " "  << d.month();
     _header << " "  << d.year();
     _header << " "  << now.time_of_day();
-    _header << " GMT" << endl;
+    _header << " GMT" << "\r\n";
     return true;
 }
 
@@ -239,7 +247,7 @@
 HTTP::formatServer()
 {
 //    GNASH_REPORT_FUNCTION;
-    _header << "Server: Cygnal (GNU/Linux)" << endl;
+    _header << "Server: Cygnal (GNU/Linux)" << "\r\n";
     return true;
 }
 
@@ -247,7 +255,7 @@
 HTTP::formatServer(const string &data)
 {
 //    GNASH_REPORT_FUNCTION;
-    _header << "Server: " << data << endl;
+    _header << "Server: " << data << "\r\n";
     return true;
 }
 
@@ -255,7 +263,7 @@
 HTTP::formatMethod(const string &data)
 {
 //    GNASH_REPORT_FUNCTION;
-    _header << "Method: " << data << endl;
+    _header << "Method: " << data << "\r\n";
     return true;
 }
 
@@ -263,7 +271,7 @@
 HTTP::formatReferer(const string &refer)
 {
 //    GNASH_REPORT_FUNCTION;
-    _header << "Referer: " << refer << endl;
+    _header << "Referer: " << refer << "\r\n";
     return true;
 }
 
@@ -271,7 +279,15 @@
 HTTP::formatConnection(const string &options)
 {
 //    GNASH_REPORT_FUNCTION;
-    _header << "Connection: " << options << endl;
+    _header << "Connection: " << options << "\r\n";
+    return true;
+}
+
+bool
+HTTP::formatKeepAlive(const string &options)
+{
+//    GNASH_REPORT_FUNCTION;
+    _header << "Keep-Alive: " << options << "\r\n";
     return true;
 }
 
@@ -288,20 +304,22 @@
     
     switch (filetype) {
       case HTML:
-         _header << "Content-Type: text/html; charset=UTF-8" << endl;
+         _header << "Content-Type: text/html" << "\r\n";
+//       _header << "Content-Type: text/html; charset=UTF-8" << "\r\n";
          break;
       case SWF:
-         _header << "Content-Type: application/x-shockwave-flash" << endl;
-//       _header << "Content-Type: application/futuresplash" << endl;
+         _header << "Content-Type: application/x-shockwave-flash" << "\r\n";
+//       _header << "Content-Type: application/futuresplash" << "\r\n";
          break;
       case VIDEO:
-         _header << "Content-Type: video/flv" << endl;
+         _header << "Content-Type: video/flv" << "\r\n";
          break;
       case MP3:
-         _header << "Content-Type: audio/mpeg" << endl;
+         _header << "Content-Type: audio/mpeg" << "\r\n";
          break;
       default:
-         _header << "Content-Type: text/html; charset=UTF-8" << endl;
+         _header << "Content-Type: text/html" << "\r\n";
+//       _header << "Content-Type: text/html; charset=UTF-8" << "\r\n";
     }
     return true;
 }
@@ -310,7 +328,7 @@
 HTTP::formatContentLength()
 {
 //    GNASH_REPORT_FUNCTION;
-    _header << "Content-Length: " << _filesize << endl;
+    _header << "Content-Length: " << _filesize << "\r\n";
     return true;
 }
 
@@ -318,7 +336,7 @@
 HTTP::formatContentLength(int filesize)
 {
 //    GNASH_REPORT_FUNCTION;
-    _header << "Content-Length: " << filesize << endl;
+    _header << "Content-Length: " << filesize << "\r\n";
     return true;
 }
 
@@ -326,7 +344,7 @@
 HTTP::formatHost(const string &host)
 {
 //    GNASH_REPORT_FUNCTION;
-    _header << "Host: " << host << endl;
+    _header << "Host: " << host << "\r\n";
     return true;
 }
 
@@ -334,17 +352,58 @@
 HTTP::formatAgent(const string &agent)
 {
 //    GNASH_REPORT_FUNCTION;
-    _header << "User-Agent: " << agent << endl;
+    _header << "User-Agent: " << agent << "\r\n";
     return true;
 }
 
 bool
+HTTP::formatAcceptRanges(const string &range)
+{
+//    GNASH_REPORT_FUNCTION;
+    _header << "Accept-Ranges: " << range << "\r\n";
+    return true;
+}
+
+bool
+HTTP::formatEtag(const string &tag)
+{
+//    GNASH_REPORT_FUNCTION;
+    _header << "Etag: " << tag << "\r\n";
+    return true;
+}
+
+bool
+HTTP::formatLastModified(const string &date)
+{
+    _header << "Last-Modified: " << date << "\r\n";
+}
+
+bool
+HTTP::formatLastModified()
+{
+//    GNASH_REPORT_FUNCTION;
+    boost::posix_time::ptime now = 
boost::posix_time::second_clock::local_time();
+    stringstream date;
+    
+    boost::gregorian::date d(now.date());
+    
+    date << d.day_of_week();
+    date << ", " << d.day();
+    date << " "  << d.month();
+    date << " "  << d.year();
+    date << " "  << now.time_of_day();
+    date << " GMT";
+
+    return formatLastModified(date.str());
+}
+
+bool
 HTTP::formatLanguage(const string &lang)
 {
 //    GNASH_REPORT_FUNCTION;
 
     // For some browsers this appears to also be Content-Language
-    _header << "Accept-Language: " << lang << endl;
+    _header << "Accept-Language: " << lang << "\r\n";
     return true;
 }
 
@@ -353,7 +412,7 @@
 {
 //    GNASH_REPORT_FUNCTION;
     // For some browsers this appears to also be Content-Charset
-    _header << "Accept-Charset: " << set << endl;
+    _header << "Accept-Charset: " << set << "\r\n";
     return true;
 }
 
@@ -361,7 +420,7 @@
 HTTP::formatEncoding(const string &code)
 {
 //    GNASH_REPORT_FUNCTION;
-    _header << "Accept-Encoding: " << code << endl;
+    _header << "Accept-Encoding: " << code << "\r\n";
     return true;
 }
 
@@ -369,7 +428,7 @@
 HTTP::formatTE(const string &te)
 {
 //    GNASH_REPORT_FUNCTION;
-    _header << "TE: " << te << endl;
+    _header << "TE: " << te << "\r\n";
     return true;
 }
 
@@ -378,7 +437,7 @@
 {
     GNASH_REPORT_FUNCTION;
     
-    formatHeader(_filesize, HTML);
+    formatHeader(_filesize, code);
 //    int ret = Network::writeNet(_header.str());
     Buffer *buf = new Buffer;
 //    Network::byte_t *ptr = (Network::byte_t *)_body.str().c_str();
@@ -407,18 +466,18 @@
 
     _header.str("");
 
-    _header << req << " " << url << "HTTP/1.1" << endl;
-    _header << "User-Agent: Opera/9.01 (X11; Linux i686; U; en)" << endl;
-    _header << "Accept: text/html, application/xml;q=0.9, 
application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, 
*/*;q=0.1" << endl;
+    _header << req << " " << url << "HTTP/1.1" << "\r\n";
+    _header << "User-Agent: Opera/9.01 (X11; Linux i686; U; en)" << "\r\n";
+    _header << "Accept: text/html, application/xml;q=0.9, 
application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, 
*/*;q=0.1" << "\r\n";
 
-    _header << "Accept-Language: en" << endl;
-    _header << "Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1" << endl;
+    _header << "Accept-Language: en" << "\r\n";
+    _header << "Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1" << "\r\n";
     
-    _header << "Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0" << 
endl;
-    _header << "Referer: " << url << endl;
+    _header << "Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0" << 
"\r\n";
+    _header << "Referer: " << url << "\r\n";
 
-    _header << "Connection: Keep-Alive, TE" << endl;
-    _header << "TE: deflate, gzip, chunked, identity, trailers" << endl;
+    _header << "Connection: Keep-Alive, TE" << "\r\n";
+    _header << "TE: deflate, gzip, chunked, identity, trailers" << "\r\n";
     return true;
 }
 // bool
@@ -479,6 +538,26 @@
 }
 
 string
+HTTP::extractAcceptRanges(Network::byte_t *data) {
+//    GNASH_REPORT_FUNCTION;
+    
+    string body = reinterpret_cast<const char *>(data);
+    string::size_type start, end, length, pos;
+    string pattern = "Accept-Ranges: ";
+    start = body.find(pattern, 0);
+    if (start == string::npos) {
+        return "error";
+    }
+    end =  body.find("\r\n", start);
+    if (end == string::npos) {
+        return "error";
+    }
+    
+    _referer = body.substr(start+pattern.size(), end-start-1);
+    return _acceptranges;    
+}
+
+string
 HTTP::extractMethod(Network::byte_t *data) {
 //    GNASH_REPORT_FUNCTION;
     
@@ -561,7 +640,8 @@
        string substr = body.substr(start, length);
 //     printf("FIXME: \"%s\"\n", substr.c_str());
        _connections.push_back(substr);
-       if (substr == "Keep-Alive") {
+       // Opera uses upper case first letters, Firefox doesn't.
+       if ((substr == "Keep-Alive") || (substr == "keep-alive")) {
            _keepalive = true;
        }
        start = pos;
@@ -570,6 +650,48 @@
     return _connections.size();
 }
 
+int
+HTTP::extractKeepAlive(Network::byte_t *data) {
+//    GNASH_REPORT_FUNCTION;
+    
+    string body = reinterpret_cast<const char *>(data);
+    string::size_type start, end, length, pos;
+    string pattern = "Keep-Alive: ";
+    
+    start = body.find(pattern, 0);
+    if (start == string::npos) {
+        return -1;
+    }
+    end =  body.find("\r\n", start);
+    if (end == string::npos) {
+       end = body.find("\n", start);
+//         return "error";
+    }
+
+    length = end-start-pattern.size();
+    start = start+pattern.size();
+    string _connection = body.substr(start, length);
+    pos = start;
+    while (pos <= end) {
+       pos = (body.find(",", start) + 2);
+       if (pos <= start) {
+           return _encoding.size();
+       }
+       if ((pos == string::npos) || (pos > end)) {
+           length = end - start;
+       } else {
+           length = pos - start - 2;
+       }
+       string substr = body.substr(start, length);
+//     printf("FIXME: \"%s\"\n", substr.c_str());
+       _kalive.push_back(substr);
+       _keepalive = true;      // if we get this header setting, we want to 
keep alive
+       start = pos;
+    }
+
+    return _connections.size();
+}
+
 string
 HTTP::extractHost(Network::byte_t *data) {
 //    GNASH_REPORT_FUNCTION;
@@ -803,7 +925,7 @@
 
     while (try_again) {
        try_again = false;
-//     cerr << "Trying to open " << actual_filespec << endl;
+//     cerr << "Trying to open " << actual_filespec << "\r\n";
        if (stat(actual_filespec.c_str(), &st) == 0) {
            // If it's a directory, then we emulate what apache
            // does, which is to load the index.html file in that
@@ -967,7 +1089,7 @@
                        buf->resize(ret);
                    }
 //                 log_debug("Read %d bytes from %s.", ret, filespec);
-#if 0
+#if 1
                    hand->pushout(buf);
                    hand->notifyout();
 #else
@@ -986,9 +1108,9 @@
 #ifdef USE_STATISTICS
                struct timespec end;
                clock_gettime (CLOCK_REALTIME, &end);
-               log_debug("Read %d bytes from \"%s\" in %g seconds",
+               log_debug("Read %d bytes from \"%s\" in %f seconds",
                          st.st_size, filespec,
-                         (float)((end.tv_sec - start.tv_sec) + ((end.tv_nsec - 
start.tv_nsec)/1000000.0)));
+                         (float)((end.tv_sec - start.tv_sec) + ((end.tv_nsec - 
start.tv_nsec)/1e9)));
 #endif
            }
 //         memset(args->filespec, 0, 256);
@@ -999,8 +1121,8 @@
 #ifdef USE_STATISTICS
        struct timespec end;
        clock_gettime (CLOCK_REALTIME, &end);
-       log_debug("Processing time for GET request was %g seconds",
-                 (float)((end.tv_sec - start.tv_sec) + ((end.tv_nsec - 
start.tv_nsec)/1000000.0)));
+       log_debug("Processing time for GET request was %f seconds",
+                 (float)((end.tv_sec - start.tv_sec) + ((end.tv_nsec - 
start.tv_nsec)/1e9)));
 #endif
 //     conndata->statistics->dump();
 //    }

Index: cygnal/http.h
===================================================================
RCS file: /sources/gnash/gnash/cygnal/http.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- cygnal/http.h       20 Mar 2008 02:25:57 -0000      1.16
+++ cygnal/http.h       20 Mar 2008 18:14:56 -0000      1.17
@@ -86,7 +86,8 @@
         SERVICE_UNAVAILABLE = 503,
         GATEWAY_TIMEOUT = 504,
         HTTP_VERSION_NOT_SUPPORTED = 505,
-       LIFE_IS_GOOD = 1234
+       LIFE_IS_GOOD = 1234,
+       CLOSEPIPE = 1235
     } http_status_e;
     typedef enum {
         OPTIONS,
@@ -130,6 +131,9 @@
     int extractAccept(gnash::Network::byte_t *data);
     int extractAccept(Buffer *data)
        { return extractAccept(data->reference()); };
+    std::string extractAcceptRanges(gnash::Network::byte_t *data);
+    std::string extractAcceptRanges(Buffer *data)
+       { return extractAcceptRanges(data->reference()); };
     int extractLanguage(gnash::Network::byte_t *data);
     int extractLanguage(Buffer *data)
        { return extractLanguage(data->reference()); };
@@ -145,6 +149,9 @@
     int extractConnection(gnash::Network::byte_t *data);
     int extractConnection(Buffer *data)
        { return extractConnection(data->reference()); };
+    int extractKeepAlive(gnash::Network::byte_t *data);
+    int extractKeepAlive(Buffer *data)
+       { return extractConnection(data->reference()); };
 
     // These return the string that was found for this field.
     std::string extractMethod(gnash::Network::byte_t *data);
@@ -163,8 +170,8 @@
     // These methods add data to the fields in the HTTP header.
     // These return true if OK, false if error.
     bool clearHeader();
-    bool formatHeader(int filesize, const short type);
-    bool formatHeader(const short type);
+    bool formatHeader(int filesize, http_status_e type);
+    bool formatHeader(http_status_e type);
     bool formatRequest(const std::string &url, http_method_e req);
     bool formatMethod(const std::string &data);
     bool formatDate();
@@ -172,12 +179,17 @@
     bool formatServer(const std::string &data);
     bool formatReferer(const std::string &data);
     bool formatConnection(const std::string &data);
+    bool formatKeepAlive(const std::string &data);
     bool formatContentLength();
     bool formatContentLength(int filesize);
     bool formatContentType();
     bool formatContentType(filetype_e type);
     bool formatHost(const std::string &data);
     bool formatAgent(const std::string &data);
+    bool formatAcceptRanges(const std::string &data);
+    bool formatLastModified();
+    bool formatLastModified(const std::string &data);
+    bool formatEtag(const std::string &data);
     bool formatLanguage(const std::string &data);
     bool formatCharset(const std::string &data);
     bool formatEncoding(const std::string &data);
@@ -186,7 +198,7 @@
     bool formatErrorResponse(http_status_e err);
     
     // All HTTP messages are terminated with a blank line
-    void terminateHeader() { _header << std::endl; };
+    void terminateHeader() { _header << "\r\n"; };
     
     // Return the header that's been built up.
     std::string getHeader() { return _header.str(); };
@@ -212,6 +224,7 @@
     std::string getReferer() { return _referer; }
     std::vector<std::string> getLanguage() { return _language;  }
     std::vector<std::string> getConnection() { return _connections; }
+    std::vector<std::string> getKeepAlive() { return _kalive; }
     std::vector<std::string> getTE() { return _te; }
     std::vector<std::string> getCharset() { return _charset; }
     std::vector<std::string> getEncoding() { return _encoding; }
@@ -235,12 +248,14 @@
     std::string _host;
     int         _port;
     std::string _agent;
+    std::string _acceptranges;
     std::vector<std::string> _connections;
     std::vector<std::string> _language;
     std::vector<std::string> _charset;
     std::vector<std::string> _encoding;
     std::vector<std::string> _te;
     std::vector<std::string> _accept;
+    std::vector<std::string> _kalive;
     // Connection parameters we care about
     bool       _keepalive;
     Handler     *_handler;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]