Results 1 to 10 of 10

Thread: Retrieving modified date of file using QHttp

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Posts
    58
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: Retrieving modified date of file using QHttp

    Quote Originally Posted by hardgeus View Post

    header.setValue("If-Modified-Since", "Sun, 31 Dec 2006 19:24:26 GMT");
    Ack, I need to stop answering my own questions. After some digging into the HTTP spec, any invalid date is silently ignored, this includes any dates in the future. I have 304 responses now. Now to figure out how to make my local files have the same date stamp as the file on the server :P

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Retrieving modified date of file using QHttp

    Quote Originally Posted by hardgeus View Post
    Now to figure out how to make my local files have the same date stamp as the file on the server
    QFileInfo::lastModified()
    QDateTime::toUTC()
    http://wiki.qtcentre.org/index.php?title=QLocale

  3. #3
    Join Date
    May 2006
    Posts
    58
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: Retrieving modified date of file using QHttp

    Quote Originally Posted by jacek View Post
    I already have that much working for determining whether the local file is newer than the file on the server (since I am sending the local stamp in the Get header, and the server is determining whether to send a 304, I don't really need to know the server side time in this step), so far so good, but the problem is that whenever I *save* the file, its local timestamp is set to whenever I downloaded it, and not the timestamp from the server. I was hoping that this would be handled transparently, but it looks like I am going to have to manually retrieve the server side file timestamp and manually set it to my local file.

  4. #4
    Join Date
    May 2006
    Posts
    58
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: Retrieving modified date of file using QHttp

    OK, I got it. In my slot for readResponseHeader I can pull the last modified date:

    QString sModified = responseHeader.value( "Last-Modified" );

    I promise I'll shut up now until I have the full code ready to link :P

  5. #5
    Join Date
    May 2006
    Posts
    58
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: Retrieving modified date of file using QHttp

    Quote Originally Posted by hardgeus View Post

    I promise I'll shut up now until I have the full code ready to link :P
    Unless someone wants to save me a few hours of digging and tell me how to manually set the modify date on a file :P

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Retrieving modified date of file using QHttp

    Quote Originally Posted by hardgeus View Post
    Unless someone wants to save me a few hours of digging and tell me how to manually set the modify date on a file :P
    You can use utime(2), it's a part of POSIX, so it should be available on windows too.

  7. The following user says thank you to jacek for this useful post:

    hardgeus (4th December 2006)

Similar Threads

  1. File Binary Upload QHttp find the bug/s
    By patrik08 in forum Qt Programming
    Replies: 13
    Last Post: 10th June 2008, 07:51
  2. QHttp "PUT METHOD" QT Problem File Upload. RFC 2616
    By patrik08 in forum Qt Programming
    Replies: 7
    Last Post: 25th October 2006, 22:02
  3. QHttp GET File & Password
    By patrik08 in forum Qt Programming
    Replies: 4
    Last Post: 11th June 2006, 13:04
  4. QHttp has problems with some url's
    By whoops.slo in forum Qt Programming
    Replies: 2
    Last Post: 2nd June 2006, 23:16
  5. How to link modified file
    By awalesminfo in forum Newbie
    Replies: 4
    Last Post: 22nd March 2006, 17:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.