qt QWebView fails on loading jQuery page - qt

I have been struggling this problem lately and couldn’t find any solution for that. So, I’d appreciate if you could really look into this.
There is a target website which runs JQuery when I click on a specific button. When I connect to the signals of QWebView and QNetworkAccessManager, I see the it hangs loading jquery_modules.min_22190.js. I have no clue why this happens.
Here is a minimal code that you can try and see: https://www.dropbox.com/s/4rooelcjbcl9qus/minimal_webview.zip
Last thing that I see in the logs:
finished "Unknown error" , code: 0 QUrl( "http://www2.thewebsite.be/nl/js/jquery/jquery_modules.min_22190.js" )
Header 1 = "Date" : "Sat, 26 Jul 2014 08:50:55 GMT"
Header 2 = "Server" : "Apache"
Header 3 = "X-Frame-Options" : "SAMEORIGIN"
Header 4 = "Cache-Control" : "max-age=604800"
Header 5 = "Expires" : "Sat, 02 Aug 2014 08:50:55 GMT"
Header 6 = "Vary" : "Accept-Encoding,User-Agent"
Header 7 = "Content-Encoding" : "gzip"
Header 8 = "P3P" : "CP='NOI DSP COR PSAo PSDo'"
Header 9 = "Keep-Alive" : "timeout=5, max=200"
Header 10 = "Connection" : "Keep-Alive"
Header 11 = "Content-Type" : "text/html; charset=iso-8859-15"
Thanks a lot in advance,

I have solved the issue by moving to Qt 5.3. The above mentioned problem is not reproducible there.

Related

R RestRserve Add Etag to static path

Let's say I have a REST API using RestRserve like this, is there a way to add an Etag to enable caching on cloud services?
writeLines("Hello World", "myfile.txt")
app <- Application$new(content_type = "application/json")
app$add_static("/", ".")
backend <- BackendRserve$new()
# backend$start(app, http_port = 8080)
req <- Request$new(path = "/myfile.txt", method = "GET")
app$process_request(req)$headers
#> $Server
#> [1] "RestRserve/0.4.1001"
As we see, there is no Etag.
Example using Go fiber
Using GO fiber, I would use it like this:
package main
import (
"flag"
"log"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/etag"
)
var (
port = flag.String("port", ":3000", "Port to listen on")
)
func main() {
app := fiber.New()
app.Use(etag.New())
app.Static("/", ".")
log.Fatal(app.Listen(*port))
}
and then querying localhost:3000/myfile.txt I would see headers like this
HTTP/1.1 200 OK
Date: Fri, 18 Mar 2022 13:13:44 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 12
Last-Modified: Fri, 21 Jan 2022 16:24:47 GMT
Etag: "12-823400506"
Connection: close
Hello World
Is there a way to add Etag headers to static files using RestRserve?
As of RestRserve version 1.1.1 (on CRAN), there is an ETag Middleware class.
Use it like so:
# ... code like before
etag <- ETagMiddleware$new()
app$append_middleware(etag)
# ...
See also https://restrserve.org/reference/ETagMiddleware.html

Karate fails to close earlier started Crome processes

In my project I use Karate 0.9.5, Oracle JDK8.
From time to time in our pipeline I see a problem. Karate fails to close earlier started Crome processes. Is there any solution to this problem?
I try to solved by explicitly call close() and quit() it didn't help. After running process was finished I found a couple of active chrome process on the server.
Here's a log:
12:51:45.227 preferred port 9222 not available, will use: 52436
12:51:47.524 request:
1 > GET http://localhost:52436/json
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Host: localhost:52436
1 > User-Agent: Apache-HttpClient/4.5.11 (Java/1.8.0_181)
12:51:47.584 response time in milliseconds: 58,31
1 < 200
1 < Content-Length: 361
1 < Content-Type: application/json; charset=UTF-8
[ {
"description": "",
"devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:52436/devtools/page/4BD6A5C19E01B01D88995CD69367F81F",
"id": "4BD6A5C19E01B01D88995CD69367F81F",
"title": "",
"type": "page",
"url": "about:blank",
"webSocketDebuggerUrl": "ws://localhost:52436/devtools/page/4BD6A5C19E01B01D88995CD69367F81F"
} ]
12:51:47.584 root frame id: 4BD6A5C19E01B01D88995CD69367F81F
12:51:47.632 >> {"method":"Target.activateTarget","params":{"targetId":"4BD6A5C19E01B01D88995CD69367F81F"},"id":1}
12:51:47.638 << {"id":1,"result":{}}
12:51:47.639 >> {"method":"Page.enable","id":2}
12:51:47.883 << {"id":2,"result":{}}
12:51:47.885 >> {"method":"Runtime.enable","id":3}
12:51:47.889 << {"method":"Runtime.executionContextCreated","params":{"context":{"id":1,"origin":"://","name":"","auxData":{"isDefault":true,"type":"default","frameId":"4BD6A5C19E01B01D88995CD69367F81F"}}}}
12:51:47.890 << {"id":3,"result":{}}
12:51:47.890 >> {"method":"Target.setAutoAttach","params":{"autoAttach":true,"waitForDebuggerOnStart":false,"flatten":true},"id":4}
12:51:47.892 << {"id":4,"result":{}}
12:52:02.894 << timed out after milliseconds: 15000 - [id: 4, method: Target.setAutoAttach, params: {autoAttach=true, waitForDebuggerOnStart=false, flatten=true}]
12:52:02.917 driver config / start failed: failed to get reply for: [id: 4, method: Target.setAutoAttach, params: {autoAttach=true, waitForDebuggerOnStart=false, flatten=true}], options: {type=chrome, showDriverLog=true, httpConfig={readTimeout=60000}, headless=true, target=null}
I think the easiest way to solve it is to extend root web driver interface com.intuit.karate.driver.Driver by adding additional method like getPID(). This method must return PID of launched process.
Can you log a bug and also provide some information as to what happened before this, are you using the Docker image etc. It looks like the previous Scenario did not shut down clearly.
But before that do you mind upgrading to 0.9.6.RC3 (just released) and trying that ? There have been a couple of tweaks to the life-cycle especially trying to close Chrome without waiting for a response. Also it may be worth adding a couple of changes a) Target.setAutoAttach without waiting and b) add configure option to not start Chrome if the port is in use

How to load CSV data into Excel 2013 using https with basic authentication?

To do so, I wrote the following VBA script and bound it a button which sets some parameters and loads the data. Afterwards it removes the connection to avoid a pile of stale connections.
Private Sub LoadData_Click()
Dim ConnString As String
Dim URL As String
URL = "https://some-server/some/path/some-file.csv"
ConnString = "TEXT;" + URL + "?partner_code=" + CStr(Range("B2")) + "&from=" + CStr(Range("B3")) + "&to=" + CStr(Range("B4"))
Sheets("Import").Select
Sheets("Import").UsedRange.Clear
ActiveSheet.Range("A1").Value = "Data is being loaded. Hold on..."
With ActiveSheet.QueryTables.Add(Connection:=ConnString, Destination:=ActiveSheet.Range("A1"))
.Name = _
" "
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlOverwriteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = True
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1)
.TextFileDecimalSeparator = ","
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Do While ActiveWorkbook.Connections.Count > 0
ActiveWorkbook.Connections.Item(ActiveWorkbook.Connections.Count).Delete
Loop
Sheets("Parameter").Select
End Sub
It works fine with Excel 2010, but not with 2013. When clicking my button I'm prompted for credentials and enter them. With Excel 2010 I see on server side in apache logs some superfluous OPTIONS requests and a HEAD, but finally just one GET which pulls the data.
With Excel 2013 I see three OPTIONS, then a HEAD which is successful (200) and finally a GET which is not successful (401). To further investigate it I did activate mod_dumpio module to see what's happening. And Apache is of course right to turn down excel 2013:
HEAD /some/path/some-file.csv?partner_code=25010&from=01.01.2014&to=01.06.2014 HTTP/1.1\r\n
...
Authorization: Basic Y29udHJvbGxpbmc6Rm9vNWFoUGg=\r\n
which is responded with 200 and directly afterwards a GET appears
GET /some/path/some-file.csv?partner_code=25010&from=01.01.2014&to=01.06.2014 HTTP/1.1\r\n
which lacks the basic auth header and therefore is answered by
HTTP/1.1 401 Unauthorized\r\nDate: Thu, 03 Jul 2014 18:18:59 GMT\r\nServer: Apache\r\nPragma: No-cache\r\nCache-Control: no-cache\r\nExpires: Thu, 01 Jan 1970 01:00:00 CET\r\nWWW-Authenticate: Basic realm="Import/Export"\r\nVary: Accept-Encoding\r\nContent-Encoding: gzip\r\nContent-Length: 378\r\nConnection: close\r\nContent-Type: text/html;charset=utf-8\r\n\r\n
I was following instructions in http://support.microsoft.com/kb/2123563/en-us step by step, but it did not help. Also the HEAD is actually working and using Basic auth.
How to load CSV data into Excel 2013 using https with basic authentication?

R: How to cleanly retrieve the attributes of a remote file on the internet?

I can download a file from the internet easily enough using code such as this:
myurl <- "http://www.jatma.or.jp/toukei/xls/13_01.xls"
download.file(myurl, destfile = myfilepath, mode = 'wb')
However, usually I want to check the date the file was last modified before I download it. I can do this very easily in Perl using the LWP::Simple package. I've poked through the documentation for RCurl (which I admit I understand only poorly) and the closest thing I can find is the basicHeaderGatherer function.
library(RCurl)
if(url.exists("http://www.jatma.or.jp/toukei/xls/13_01.xls")) {
h = basicHeaderGatherer()
foo <- getURL("http://www.jatma.or.jp/toukei/xls/13_01.xls",
headerfunction = h$update)
names(h$value())
h$value()
}
h$value()[3]
By using the code above I can eventually access the 'Last-Modified' attribute, but not without generating errors as per the output below. How can I clean up my code to avoid this error and access the 'Last-Modified' attribute in a straightforward manner?
(Please note: this answer looks promising but it generates similar error messages to those shown below, so it doesn't resolve this particular issue.)
Error in curlPerform(curl = curl, .opts = opts, .encoding = .encoding) (from #3) :
embedded nul in string: ' \021ࡱ\032 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0>\0\003\0 \t\0\006\0\0\0\0\0\0\0\0\0\0\0\001\0\0\09\0\0\0\0\0\0\0\0\020\0\0 \0\0\0\0 \0\0\0\08\0\0\0 \t\b\020\0\0\006\005\0g2 \a \0\002\0\006\006\0\0 \0\002\0 \004 \0\002\0\0\0 \0\0\0\\\0p\0\003\0\0CVC B\0\002\0 \004a\001\002\0\0\0 \001\0\0=\001\002\0$\0 \0\002\0\021\0\031\0\002\0\0\0\022\0\002\0\0\0\023\0\002\0\0\0 \001\002\0\0\0 \001\002\0\0\0=\0\022\0 \017\0xKX/8\0\0\0\
> h$value()[3]
Last-Modified
"Fri, 06 Dec 2013 05:33:53 GMT"
>
library(RCurl)
url.exists("http://www.jatma.or.jp/toukei/xls/13_01.xls", .header=T)["Last-Modified"]
# Last-Modified
# "Fri, 06 Dec 2013 05:33:53 GMT"

Qmail : auto response is polluted with email headers

When I set up auto response in qmailadmin for an account. The auto response email is sent but just after the auto response message, there is a sort of stack trace and headers of the original message:
like :
Received: (qmail 903 invoked by uid 508); 12 Jul 2010 20:23:55 -0000
Received: blabla
Received: (qmail 914 invoked from network); 12 Jul 2010 20:31:44 -0000
Received: from blabla (ip)
somemore trace like DKIM-Signature, etc...
*original message headers*
*original message content*
Is there a way to not have all this junk in the body of the email ? My users are not very happy with it... (It used to work well in the past, and I didn't change any thing recently)
If you have an idea of what happens, you are answers are welcome !
thanks !
I assume, that you are using the qmail-autoresponder. To check what is going wrong, I need two additional informations at the moment:
1) Content of the .qmail file with the responder
There should be something like this inside:
|qmail-autoresponder /path/to/autorespond/dir
2) The content of the autorespond directory - especially the message.txt
You can check, if the message.txt is in a correct MIME-format. It should look something like this:
From: "Sender of Mail" <email#yourhost.de>
User-Agent: autoresponder-system
Return-Path: <>
Subject: Re: %S
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Sehr geehrte Damen und Herren,
Diese Emailadresse wird in den kommenden Wochen abgeschaltet. Wir m=F6chten
Sie bitten, sich zuk=FCnftig an Ihren neuen Ansprechpartner ...
Finally I made it works be updating autorespond to the latest version (2.0.2) I don't know what version I had ...
autorespond: usage: time num message dir [ flag arsender ]
optional parameters:
flag - handling of original message:
0 - append nothing
1 - append quoted original message without attachments
Add 0 in .qmail file:
/home/vpopmail/domains/mydomain.com/myuser/Maildir/ | /usr/local/bin/autorespond 86400 3 /home/vpopmail/domains/mydomain.com/myuser/vacation/message /home/vpopmail/domains/mydomain.com/myuser//vacation 0

Resources