ErrorMisc "Unsucessful HTTP code: 400" on cabal update - cabal

Having installed Haskell Platform 2013.2.0.0, and using Win7 cmd:
When running the command "cabal update"
I got the following output:
Downloading the latest package list from hackage.haskell.org
cabal: Failed to download http://hackage.haskell.org/packages/archive/00-index.tar.gz
: ErrorMisc "Unsucessful HTTP code: 400"
To confirm that the link was working, I visited it on my web browser.
At this stage, I'm sorta stuck as to how to resolve the issue.
Also, I'm not sure whether this would help or not, but here's what I get when I run "cabal update -v3"
Downloading the latest package list from hackage.haskell.org
Sending:
GET /packages/archive/00-index.tar.gz HTTP/1.1
Host: hackage.haskell.org
User-Agent: cabal-install/1.16.0.2
Creating new connection to hackage.haskell.org
Received:
HTTP/1.1 400 Bad Request
Server: nginx/1.6.0
Date: Thu, 31 Jul 2014 16:24:24 GMT
Content-Type: text/html
Content-Length: 172
Connection: close
cabal: Failed to download
http://hackage.haskell.org/packages/archive/00-index.tar.gz : ErrorMisc
"Unsucessful HTTP code: 400"

I could solve this problem in my machine by disabling the antivirus and firewall, hope it will help.

Related

hawkBit swupdate Suricatta: HTTP/1.1 401 Unauthorized

I want to set up hawkBit (running on server) and swupdate (running on multiple clients - Linux OS) to perform OS/Software update in Suricatta mode.
1/ Follow up my post on hawkBit community, I've succeeded to run hawkBit in my server as below:
Exported to external link: http://:
Enabled MariaDB
Enabled Gateway Token Authentication (in hawkBit system configuration)
Created a software module
Uploaded an artifact
Created a distribution set
Assigned the software module to the distribution set
Create Targets (in Deployment Mangement UI) with Targets ID is "dev01"
Created a Rollout
Created a Target Filter
2/ I've succeeded to build/execute swupdate as SWupdate guideline
Enabled Suricatta daemon mode
Run swupdate: /usr/bin/swupdate -v -k /etc/public.pem -u '-t DEFAULT -u http://<domain>:<port> -i dev01'
I'm pretty sure this command isn't correct, output log as below:
* Trying <ip address>...
* TCP_NODELAY set
* Connected to <domain> (<ip address>) port <port> (#0)
> GET /DEFAULT/controller/v1/10 HTTP/1.1
Host: <domain>:<port>
User-Agent: libcurl-agent/1.0
Content-Type: application/json
Accept: application/json
charsets: utf-8
< HTTP/1.1 401 Unauthorized
< Date: Sun, 16 May 2021 02:43:40 GMT
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Content-Length: 0
<
* Connection #0 to host <domain> left intact
[TRACE] : SWUPDATE running : [channel_log_effective_url] : Channel's effective URL resolved to http://<domain>:<port>/DEFAULT/controller/v1/dev01
[ERROR] : SWUPDATE failed [0] ERROR corelib/channel_curl.c : channel_get : 1109 : Channel operation returned HTTP error code 401.
[DEBUG] : SWUPDATE running : [suricatta_wait] : Sleeping for 45 seconds.
As per a suggestion from #laverman on Gitter:
You can use Gateway token in the Auth header of the request, e.g. “Authorization : GatewayToken a56cacb7290a8d8a96a2f149ab2f23d1”
but I don't know how the client sends this request (it should be sent by swupdate, right?)
3/ Follow up these instructions from Tutorial # EclipseCon Europe 2019, it guides me to send the request to provision multiple clients from hawkBit Device Simulator. And the problem is how to apply this to real devices.
Another confusion is: when creating new Software Module, Distribution on hawkBit UI, I can't find the ID of these, but creating by send request as Tutorial, I can see the IDs in the response.
So my questions are:
1/ Are my hawkBit setup steps correct?
2/ How can I configure/run swupdate (on clients) to perform the update: poll for new software, download, update, report status, ...
If my description isn't clear enough, please tell me.
Thanks
happy to see that you're trying out Hawkbit for your solution!
I have a few remarks:
The suricatta parameter for GatewayToken is -g, and -k for TargetToken respectively.
The -g <GATEWAY_TOKEN> needs to be set inside of the quotation marks
see SwUpdate Documentation
Example: /usr/bin/swupdate -v -u '-t DEFAULT -u http://<domain>:<port> -i dev01 -g 76430e1830c56f2ea656c9bbc88834a3'
For the GatewayToken Authentication, you need to provide the generated token in System Config view, it is a generated hashcode that looks similar to this example here
You can also authenticate each device/client separately using their own TargetToken.
You can find more information in the Hawkbit documentation

Unknown HTTP GET request in React Native Application

Our tester captured some unknown GET request while doing API testing in our React Native application.
GET /inspector/device?name=some_unique_id&app=com.companyname.appname HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: encrypted key
Sec-WebSocket-Version: 13
Host: localhost:8082
Accept-Encoding: gzip, deflate
User-Agent: okhttp/3.11.0
Could someone give me some idea what is this and why is this called.?
Thanks.
It seems the line may comes from RCTInspectorDevServerHelper.mm. You can see the line
return [NSURL URLWithString:[NSString stringWithFormat:#"http://%#/inspector/device?name=%#&app=%#",
getServerHost(bundleURL, inspectorProxyPort),
escapedDeviceName,
escapedAppName]];
inside getInspectorDeviceUrl function, which seems to be called each time the app is loaded to connect with the bundle.

The problem with CORS headers for the server on Go

Now I am writing a simple server on Go using the standard library net/http. The server is placed in a docker container and placed on google cloud paltform. But when I want to access the server from my third-party React application (which is located on a different server), I always get a CORS error.
Looking for solutions online, I added a library to my code, which is designed to solve the problem of СORS. But adding a library didn’t help. Even after its application, the server does not send me СORS headers. What code do I have now?
package main
import (
controller "./controllers"
"./util"
"github.com/gorilla/mux"
"github.com/rs/cors"
"log"
"net/http"
//"os"
)
// Entry point
func main() {
c := cors.New(cors.Options{
AllowedOrigins: []string{"*"}, // All origins
AllowedMethods: []string{"GET"}, // Allowing only get, just an example
AllowedHeaders: []string{"Authorization", "Content-Type"},
AllowCredentials: true,
Debug: true,
})
r := mux.NewRouter()
// Router
// Live check
r.HandleFunc("/live", controller.LiveCheck)
apiRouter := r.PathPrefix("/api").Subrouter()
// Medication data
medicationRouter := apiRouter.PathPrefix("/medication").Subrouter()
medicationRouter.HandleFunc("", controller.MedicationHeadersList).Methods("GET")
medicationRouter.HandleFunc("/{id}", controller.MedicationChildrenList).Methods("GET")
medicationRouter.HandleFunc("/{id}/leafs", controller.MedicationLeafsList).Methods("GET")
medicationRouter.HandleFunc("/search/", controller.SearchMedicationList).Methods("GET")
medicationRouter.HandleFunc("/result/{id}", controller.MedicationSearchResult).Methods("GET")
//r.Use(util.CORS)
apiRouter.Use(util.VerifyToken)
log.Println(http.ListenAndServe(":8080", c.Handler(r)))
}
Here is the answer I get from the up-point in the browser console:
Request Method: OPTIONS
Status Code: 200 OK
Remote Address: 35.190.37.37:80
Referrer Policy: no-referrer-when-downgrade
Content-Length: 0
Date: Mon, 10 Jun 2019 22:37:36 GMT
Vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers
Via: 1.1 google
I also tried to manually set the CORS headers, creating a middleware, but it also did not help.
Thanks in advance for your help!
UPD Thank you all for the answers and help. Everything turned out to be much easier. Google did not update my docker container, so all my changes in the code did not give the desired effect. My code, which I gave in the question description, perfectly solves the problem of the CORS. The question can be considered closed.
I had this problem too. You can use this code in the development environment.
c := cors.New(cors.Options{
AllowedOrigins: []string{"*"},
AllowCredentials: true,
AllowedHeaders: []string{"Authorization", "Content-Type", "Access-Control-Allow-Origin"},
// Enable Debugging for testing, consider disabling in production
AllowedMethods: []string{"GET", "UPDATE", "PUT", "POST", "DELETE"},
Debug: true,
})
How are you testing this? When a browser must make a cross-origin request that fails pre-flight conditions an OPTIONS request gets sent. This OPTIONS request contains a header who's value is the HTTP method being used in the cross-origin request.
I stood up your simplified version of your server and here's some example curl commands and results.
The below request works fine, I've set the Access-Control-Request-Method to GET
curl -I -X OPTIONS -H "Origin: test.com" -H "Access-Control-Request-Method: GET" http://localhost:8080/
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET
Access-Control-Allow-Origin: *
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Date: Tue, 11 Jun 2019 02:20:35 GMT
Content-Length: 0
The below request doesn't work without the Access-Control-Request-Method header. Our server may have different CORS settings for GET and POST (etc..), and our server can't communicate that to the client. The client must set the Access-Control-Request-Method header so the server knows how to properly respond.
curl -I -X OPTIONS -H "Origin: test.com" http://localhost:8080/
HTTP/1.1 200 OK
Date: Tue, 11 Jun 2019 02:31:12 GMT
Content-Length: 436
Content-Type: text/html; charset=utf-8

GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable

I'm trying to make RTSP server based on Gstreamer 1.0 1.4.5 plugin. Source code of the example is taken from here. WITH_TLS and WITH_AUTH flags are not enabled.
I'm compiling it using Visual Studio 2013 Community Edition. The project is building and running successfully. However when I'm trying to play the video using VLC on address rtsp://127.0.0.1:8554/test it says it can't open the MRL.
Recorded traffic (using RawCap) of the communication between compiled server and VLC player is the following:
Request:
OPTIONS rtsp://127.0.0.1:8554/test RTSP/1.0
CSeq: 2
User-Agent: LibVLC/2.2.0 (LIVE555 Streaming Media v2014.07.25)
Response:
RTSP/1.0 200 OK
CSeq: 2
Public: OPTIONS, DESCRIBE, GET_PARAMETER, PAUSE, PLAY, SETUP, SET_PARAMETER, TEARDOWN
Server: GStreamer RTSP server
Date: Thu, 09 Apr 2015 03:35:30 GMT
Request:
DESCRIBE rtsp://127.0.0.1:8554/test RTSP/1.0
CSeq: 3
User-Agent: LibVLC/2.2.0 (LIVE555 Streaming Media v2014.07.25)
Accept: application/sdp
Response:
RTSP/1.0 503 Service Unavailable
CSeq: 3
Server: GStreamer RTSP server
Date: Thu, 09 Apr 2015 03:35:30 GMT
The RTSP server have no errors or warnings in either IDE or command promt window.
Does anyone have any idea why is this happening? Any help would be very appreciated!

zip direct link download not working in IE7 and IE8

Zip file direct link download not working in IE7 and IE8
Examlple: http://beta-ffconeworld.fairfactories.org/Uploads/documents/docfiles/122_test.zip
$ curl -I http://beta-ffconeworld.fairfactories.org/Uploads/documents/docfiles/122_test.zip
HTTP/1.1 200 OK
Date: Fri, 15 Jul 2011 10:58:46 GMT
Server: Apache/2.2.16 (Amazon)
Last-Modified: Fri, 15 Jul 2011 10:09:11 GMT
ETag: "7cc4-8565-4a818d74be4db"
Accept-Ranges: bytes
Content-Length: 34149
Vary: Accept-Encoding,User-Agent
Connection: close
Content-Type: application/zip
I ran into a similar issue once and solved it by disabling gzip compression in apache for the particular file extension or directory.
In my case apache was trying to compress a file that was already compressed thus corrupting it. We added
SetEnvIfNoCase Request_URI \.(?:zip)$ no-gzip dont-vary
into httpd/conf/extra/httpd-deflate.conf and all was well.
Works fine on my machine.
Check your security settings. In IE7, this is Tools -> Internet Options -> Security -> Custom Level... in the list it's possible to disable file downloads, or enable them to download without prompt.

Resources