Set multiple turn servers in Gstream WebRTCBin - gstreamer

How to add multiple turn server urls to a webrtcbin, when using gst-python?
I know how to set a single url with:
webrtcbin.set_property("turn-server",turn_url)
But I want to add more URLs. Documentation says
The TURN server of the form turn(s)://username:password#host:port.
This is a convenience property, use #GstWebRTCBin::add-turn-server if
you wish to use multiple TURN servers.

add-turn-server is a signal, so use emit:
webrtcbin.emit("add-turn-server", "turns://...")

Related

Django(2.11) simultaneous (within 10ms) identical HTTP requests

Consider a POST/PUT REST API (using DRF).
If the server receives request1 and within a couple of ms request2 with identical everything to request1 (duplicate request), is there a way to avoid the request2 to be executed using some Django way? Or Should I deal with it manually by some state?
Any inputs would be much appreciated.
There isn't anything out of the box so you would need to write something your self potentially a piece of custom middleware (https://docs.djangoproject.com/en/3.0/topics/http/middleware/) would be best as then it would run over all of the requests. You would need to capture and exam the requests so you'd need a fast storage of some sort such as a memory store.
You could also look into the python asynco library - https://docs.python.org/3/library/asyncio-sync.html
Another possible solution would be using a FIFO message queue which is configured to support de-duplication based on content. This would turn the request into an deferred process though so it may not be suitable for your needs.

Sharing cookies between thread groups

I am working on JMeter 3.3. I will have n users and the login should be done only once but the other pages are to be executed multiple times. I found the solution as using 2 different thread groups, but its not working as I have cookies from my login.
I saw a similar usecase in: Sharing cookie values between thread groups in JMeter but none of the solutions worked. How to make this happen?
Could SetUp Thread Group be an answer? (http://jmeter.apache.org/usermanual/component_reference.html#setUp_Thread_Group) - I mean the login (and extracting cookies to a variable) would be done in that setUp group, then your other tests in 'normal' Thread Groups - which would read that globally available variable with your cookie.
If you need to login user only one time per iteration,than use Once only controller.
To share cookies between thread groups you can use Inter-thread communication plugin
Normally if you want to perform login only once you can use If Controller with the condition of ${__groovy(vars.getIteration() == 1,)} where:
__groovy() - a JMeter Function allowing execution of arbitrary Groovy code
vars - is a shorthand to JMeterVariables class instance providing read/write access to JMeter Variables. vars.getIteration() method returns current Thread Group iteration so the sampler(s) you put under the If Controller will be executed only once for each virtual user.
I got the solution from https://stackoverflow.com/a/43379806/8305811 but by turning on the CookieManager.save.cookies to true and setting up the cookie manager in the test plan level.

How to clear cookies in loadrunner 12.50

I am quite new to LoadRunner. I am using the 12.50 community edition and am using the protocol TruClient for web.
What should i do in order to delete the cookies that the LoadRunner has accumulated while doing interaction with browser?
As suggested by tserg42, you could add a separate step inside your "Develop Script" of TruClient for adding the "Utils.clearCookies()" command inside a Javascript action.
Please find the screenshots below for adding the above
Step 1
Drag the marked step on to the script
Step 2
Step 3
Upon clicking the "JS" icon at the right corner, the arguments editor would be available for providing javascript commands. Key in the required commands - "Utils.clearCookies()".
Additionally, you can also check "Simulate new user on each iteration" checkbox from Runtime Settings --> Replay --> Simulate new user on each iteration
I guess you are looking for the function web_cleanup_cookies(). Here is some relevant information I have found about its use:
Return Values
This function returns LR_PASS (0) on success and LR_FAIL (1) on failure.
General Information
The web_cleanup_cookies function removes all the cookies that are currently stored by the for use by the script.
Note: Scripts do not use (access or modify) the cookies that are stored by your browser. Instead, each Vuser uses the cookies that are sent to the Vuser by the server host at runtime. These cookies are maintained only while the script runs. The web-cookie functions (web_add_cookie, web_remove_cookie and web_cleanup_cookies) manipulate these temporary cookies, and do not affect cookies stored by your browser.
This function is supported for all Web scripts, and for WAP scripts running in HTTP or Wireless Session Protocol (WSP) replay mode.
You could try Utils.clearCookies() method. By the way, TruClient API documentation is available online.

Setting Tomcat 7 sessionid and value to be identified via Hardware Load Balancing for session affinity

Although easily done from my perspective with IIS, I'm a total noob to Tomcat and have no idea how to set static values for cookie contents. Yes I've read the security implications and eventually will access via SSL so I'm not concerned. Plus I've read the Servlet 3.0 spec about not changing the value and I accept that.
In IIS I would simply set a HTTP Header named Set-Cookie with an arbitrary setting of WebServerSID and a value of 1001.
Then in the load balancer VIP containing this group of real servers, set the value WebServerSID at the VIP level, and for the first web server a cookie value of 1001 and so one for the remaining machines 1002 for server 2, 1003 for server 3.
This achieves session affinity via cookies until the client closes the browser.
How can this be done with Tomcat 7.0.22?
I see a great deal of configuration changes have occurred between Tomcat 6.x and 7.x with regard to cookies and how they're set up. I've tried the following after extensive research
over the last week.
In web.xml: (this will disable URL rewriting under Tomcat 7.x)
<tracking-mode>COOKIE</tracking-mode> under the default session element
In context.xml: (cookies is true by default but I was explicit as I can't get it working)
cookies=true
sessionCookiePath=/
sessionCookieName=WebServerSID
sessionCookieName=1001
I have 2 entries in context.xml for sessionCookieName because the equivalent commands from Tomcat 6.x look like they've been merged into 1.
See http://tomcat.apache.org/migration-7.html#Tomcat_7.0.x_configuration_file_differences
Extract:
org.apache.catalina.SESSION_COOKIE_NAME system property: This has been removed. An equivalent effect can be obtained by configuring the sessionCookieName attribute for the global context.xml (in CATALINA_BASE/conf/context.xml).
org.apache.catalina.SESSION_PARAMETER_NAME system property: This has been removed. An equivalent effect can be obtained by configuring the sessionCookieName attribute for the global context.xml (in CATALINA_BASE/conf/context.xml).
If this is not right then I simply do not understand the syntax that is required and I cannot find anywhere that will simply spell it out in plain black and white.
Under Tomcat 6.x, I would have used Java Options in the config like:
-Dorg.apache.catalina.SESSION_COOKIE_NAME=WebServerSID
-Dorg.apache.catalina.SESSION_PARAMETER_NAME=1001
The application I'm using does not have any of these values set elsewhere so it's not the application.
All these settings are in context/web/server.xml files at the Catalina base
At the end of the day what I need to see in the response headers under Set-Cookies: (as seen using Fiddler) is:
WebServerSID=1001
NOT
JSESSIONID=as8sd9787ksjds9d8sdjks89s898
thanks in advance
regards
The best you can do purely with configuration is to set the jvmRoute attribute of the Engine which will add the constant value to the end of the session ID. Most load-balancers can handle that. It would look like:
JSESSIONID=as8sd9787ksjds9d8sdjks89s898.route1
If that isn't good enough and you need WebServerSID=1001 you'll have to write a ServletFilter and configure that to add the header on every response.

How to send mass mail in Django and get status for every message?

I'm creating a web app for handling various surveys. An admin can create his own survey and ask users to fill it up. Users are defined by target groups assigned to the survey (so only user in survey's target group can fill the survey).
One of methods to define a target group is a "Token target group". An admin can decide to generate e.g. 25 tokens. After that, the survey can be accessed by anyone who uses a special link (containing the token of course).
So now to the main question:
Every token might have an e-mail address associated with itself. How can I safely send e-mails containing the access link for the survey? I might need to send a few thousand e-mails (max. 10 000 I believe). This is an extreme example and such huge mailings would be needed only occasionally.
But I also would like to be able to keep track of the e-mail message status (was it send or was there any error?). I would also like to make sure that the SMTP server doesn't block this mailing. It would also be nice if the application remained responsive :) (The task should run in background).
What is the best way to handle that problem?
As far as I'm concerned, the standard Django mailing feature won't be much help here. People report that setting up a connection and looping through messages calling send() on them takes forever. It wouldn't run "in background", so I believe that this could have negative impact on the application responsiveness, right?
I read about django-mailer, but as far as I understood the docs - it doesn't allow to keep track of the message status. Or does it?
What are my other options?
Not sure about the rest, but regardless for backgrounding the task (no matter how you eventually do it) you'll want to look for Celery
The key here is to reuse connection and to not open it again for each email. Here is a documentation on the subject.