FAQ Database Discussion Community


how can I create a URL/site to send a HTTP 204 or HTTP 403 response?

objective-c,http,servlets,post,ios7
I'm trying to create an app with a login page to POST to a url and return a status code. For now the app is to call a URL that returns a HTTP 204 or HTTP 403 response. How is this done? Do I need to create/implement a servlet?

Django doesn't parse a custom http accept header

python,django,http,django-views,django-rest-framework
Is there any way to allow Django app to accept the custom accept header like "application/vdn.name.v1+json"? I keep getting a response like this Could not satisfy the request Accept header. I am using Django Rest Framework as well...

Uploading GPX file to Strava API with GTMHTTPFetcher POST in Objective-c

ios,objective-c,http,post,xmlhttprequest
After exploring the use of the Strava API (http://strava.github.io/api/v3) with GTMHTTPFetcher for 2 days I am now completely stuck at uploading a .gpx file to my account so I made the decision to ask for an answer here. I successfully received and stored an access token with the necessary 'view_private,write'...

why is it making the request twice

c#,asp.net,http,httpwebrequest
this code is written to send request to a service and receive simple json response but the service's server log shows that it is being requested twice with a delay of 1 second. I cant figure it out why does this code make the request twice please guide me if...

Custom HTTP Header or cookies? how custom authentication/authorization helps in CSRF?

javascript,http,cors,csrf
If someone can help me understand how a custom HTTP authorization header helps protect CSRF attack. Also correct me if i'm wrong does it prevent replay attacks using fiddler also? Thanks for your help in advance...

AngularJS creates infinite loop when $http request returns error

angularjs,http
My problem is pretty simple, but I'm not able to find what out what happens. All I want to do is read all posts from my local REST API. When I'm responding HTTP 401 from the API, AngularJS keeps repeating the GET requests in an infinite loop. var request =...

Mule - Retry connection with basic flow

java,http,soap,exception-handling,mule
I have a basic mule flow: HTTP => SOAP => JAVA CLASS <mule xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans...

Which LiftResponse class is appropriate for returning an XML based file format?

xml,http,lift
I have a Lift application which generates a Gephi file on the fly. The Gehpi native format is XML based. The current plan is that the file gets downloaded and opened in Gephi on the client, without being processed/displayed in the browser. I looked through the LiftResponse subclasses and it...

How to run different Django apps on different subdomain

django,http,django-urls
Can it be possible to run Different Django apps on different Subdomains. For Example: For api.mydomain.com all request will be handled by my API app. But all other requests will be handled by my core app. I just want my API app to handle request made on api.mydomain.com. And all...

How to set username and password using Rest easy client builder?

java,http,http-headers,jax-rs,resteasy
I have a url which needs authentication (like a browser pop up appears asking username and password.) Generally, we can use the following format to achieve this: http://username:[email protected] Using Rest easy client builder Client client = ClientBuilder.newClient(); WebTarget target = client.target('http://url.com'); How to achieve it without having to construct the...

How to access properties inside an array and push them to a List Angularjs

json,angularjs,http,controller
I am working on an angularJS application, where i am accessing a service and getting a JSON data as follows. { "repositoryFileDto":[ { "aclNode":"false", "createdDate":"1433166794593", "fileSize":"16208", "folder":"false", "hidden":"false", "id":"d4850a7e-17f7-4ee6-a3c5-125c26077da8", "lastModifiedDate":"1433166794593", "locale":"en", "localePropertiesMapEntries":[ ], "locked":"false", "name":"accountInfo.prpt", "ownerType":"-1", "path":"/home/admin/accountInfo.prpt", "title":"accountInfo", "versionId":"1.0", "versioned":"true" }, { }, {...

How to retrieve HttpPost parameters in c#

c#,http,http-post,http-post-vars
So I know that this works: [HttpPost] public string functionthatiuse() { string id = "";//does nothing return relevantinfo; } Then I use this Chrome POST extension shown below and I have a break point in the function which is how I know it reaches it. It's literally an empty post...

Particular URL redirect to http if request come from particular host

apache,http,mod-rewrite,ssl,url-rewriting
Web server is apache, ssl configured, listening on 443, All http requests will be redirected to https using rewrite rule Issues is all url's are serving through https, but we want to connect to the web server through http if the request is coming for particular url from particular host,...

What headers must be processed in a specific order in an HTTP response?

http,header,httpresponse
I am trying to identify what three headers, if present in an HTTP response, always have to be processed in a specific order. I have done a good amount of reading in my text: Web Application Architecture by Shklar and Rosen, and I have done research online but my research...

AngularJS $http request using forEach inside of Controller

angularjs,http,foreach
http://codepen.io/rcidaleassumpo/pen/eNEjGY?editors=001 That's the link for the code. Below I first used the forEach to combine the nicknames with the base link, so I could get the fullLink to make the call for with the $http. But then when I tried to make the call, and post into a empty array,...

How to monitor the Internet connectivity on two PCs simultaneously?

python,http,cron,connection,monitor
I have two PCs and I want to monitor the Internet connectivity in both of them and make it available in a page as to whether they're currently online and running. How can I do that? I'm thinking of a cron job that gets executed every minute that sends a...

what does php's header function do?

php,function,http,header,content-type
I can't find any solutions to this problem. I'm having hard time with this code. Based on what I searched: HTTP/1.1 200 OK - means that the page is good or OK. I don't understand this header function parts only. It is actually part of code. My questions are: Why...

ASP.net HTTP Post when auto-incrementing row Id

sql,asp.net,asp.net-mvc,http
I am working in ASP.net with a Web API allowing HTTP Posts to update a mapped SQL database. I want the Id to be automatically increment by one every time a new row is inserted. The table definition is this: CREATE TABLE [dbo].[PoolTests] ( [Id] INT IDENTITY (1, 1), [SiteID]...

Update model with $http using a service not triggering model change

angularjs,http,model,angularjs-service
I have the following model: var MODEL = { myTable: [], anotherTable: [] }; //--- initially set as empty arrays MODEL is a global variable as it is used to bind the app model in different controllers. I have devined a service that updates the model, getting the data from...

JSON with PHP Slim and AngularJS

php,json,angularjs,http
I am trying to send some data from my AngularJS Project to a PHP Server where I am using PHP Slim but I have tried everything I know and nothing seems to work. SERVER PHP SLIM $app->get('/create',function() use ($app) { $data = $app->request()->params(); response_json(200,"DB: User Created",$data); }); It works if...

Could not load type from assembly 'App_Code'

c#,asp.net,http
I want to create a custom HTTP module in asp.net. This article shows how to do it I followed the steps and here is my class which inherits from IHttpModule public class LanguageModule : IHttpModule { public void Init(HttpApplication context) { context.AcquireRequestState += new EventHandler(OnAcquireRequestState); } public void Dispose() {...

Android Java Http Request Post

java,android,http,request
I had created a simplest app, a default one and I want to try to post and retrive something from a php page MyActivty.Java looks like: package com.dolganiuc.victor.myapplication; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.util.Log; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import...

Python exception for HTTP response codes

python,http,exception
I'd like to raise a Python-standard exception when an HTTP response code from querying an API is not 200, but what specific exception should I use? For now I raise an OSError: if response.status_code != 200: raise OSError("Response " + str(response.status_code) + ": " + response.content) I'm aware of the...

Accessing objects returned from a factory

javascript,angularjs,http,ionic-framework,ionic
So I have a factory that fetches objects from a server: .factory('Articles', function($http) { var articles = []; return { all: function(){ $http.get("http://jsonp.afeld.me/?url=http://examplesite.com/page.html?format=json").then(function(response){ articles = response.data.items; console.log(response.data.items); return articles; }); }, get: function(articleId) { for (var i = 0; i < articles.length; i++) { if (articles[i].id === parseInt(articleId)) { return...

Spring POST Request IllegalStateException

java,spring,http
i have got a JAVA REST Service in Spring. Everything's working fine, but yesterday I modified a service which worked fine before. Its still working, everything, but when i want to save a HTML Form (and send it to the server), i get an Exception. I debugged it but i...

How can I capture data send to a webserver/website?

http
What is an easy way to capture data send to a webserver? I want to get the code, which gets send when I give someone reputation on a forum......

Trouble connecting to ESP8266 NodeMCU Server

html,http,lua,arduino,wifi
I have been having trouble connecting to my ESP-01 Wifi module running NodeMCU. I have set up a simple server, but whenever I try to connect to the IP Address via my browser, my browser times out. I know I am making connection to the device because I can see...

FROM Http Header not included unless it's a valid email address

asp.net,google-chrome,http,asp.net-web-api,http-headers
I'm using the Advanced Rest Client Chrome extension to test a request to a Web API 2 endpoint. I'm trying to include a value in the "From" header but the value is null when it is not a valid email address. By reading the spec, it looks like it only...

Lantronix XPORT - TCP/IP tunnel to send HTTP POST requests

http,microcontroller,wireshark,pic,ethernet
I have a XPORT (TCP/IP serial tunnel device) connected to my microcontroller (PIC18), this way I can send serial messages which are transformed into TCP/IP packages. I've enabled TCP/IP packaging, so that all characters will be put in one TCP/IP package until nothing is received for a short period of...

Docker container http requests limit

http,elasticsearch,docker
I'm new to Docker so, most likely, I'm missing something. I'm running a container with Elasticsearch, using this image. I'm able to setup everyhing correctly. After that I was a using a script developed by a collegue in order to insert some data, basically querying a MySQL database and making...

Create OAuth Signature with HMAC-SHA1 Encryption returns HTTP 401

c#,.net,http,oauth,hmac
The Question Hello, I need to authenticate to an API wich needs OAuth encryption. I'm in the right direction but I am sure something is wrong with my signature base string. Since the HMACSHA1 Hash is based on a Key and BaseString, I get a wrong oauth_signature. OAuth Signing Process...

Headers for security

security,http,header
I've been reading articles about the protection of your website and they say to place these 3 headers: X-Frame-Options: DENY X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff In my website to protect it from Website attacks, but I dont know how to declare it in my header, can someone help me with...

Python - sending http requests as strings

python,http,get
How can I send HTTP requests as string with python? something like this: r = """GET /hello.htm HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT) Host: www.stackoverflow.com Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive""" answer = send(r) print answer # gives me the response as string ...

Mocking/Testing HTTP Get Request

java,unit-testing,http,junit,mockito
I'm trying to write unit tests for my program and use mock data. I'm a little confused on how to intercept an HTTP Get request to a URL. My program calls a URL to our API and it is returned a simple XML file. I would like the test to...

how make Sync or Async HTTP Post/Get in Android Studio

android,http,android-studio
I'm beginner in Android programming. I'm using Android studio to develop some simple app. At this moment I need Sync or Async HTTP Post/Get to get HTML data from Web-Service. I search this whole internet but I can't give good result. I tried to use this examples: Android Series get/post...

koa-static not following max-age

http,koa
I am using koa-static to serve my assets. I have set max-age to a minute for now 60000ms (as described in the docs) For testing purposes, I am using a big image as a background in my page, but it seems that the browser still re-downloads it every time the...

HTTP Post in ruby NoMethodError

ruby,http
I am trying to make a http post using require 'net/http' here is my request token_url = 'http://www.[url].com/oauth/token' uri = URI(token_url) req = Net::HTTP::Post.new(uri) req.basic_auth ENV['OAUTH_ID'], ENV['OAUTH_PASSWORD'] req.set_form_data({ 'grant_type' => 'client_credentials' }) resp = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) } JSON.parse(resp.body)['access_token'] I keep getting this error: NoMethodError - undefined method 'empty?'...

Meteor HTTP request structuring

javascript,http,meteor
I am playing around with some API in meteor and am trying to use the HTTP package to access it. The example they give formats the request as a Curl command like this : curl -X POST https://api.locu.com/v2/venue/search/ -d '{"fields":["name","menu_items","location","categories","description"],"menu_item_queries":[{"price":{"$ge":15},"name":"steak"}],"venue_queries":[{"location":{"locality":"San Francisco"}}],"api_key":"YOUR_API_KEY"}' How do I convert this into an HTTP.call()? Do...

Can I submit a form with google's recaptcha in it from my app?

http,request,authorization,captcha,recaptcha
I'm writing an app which involves letting users to share comments on a website, which has a comment form with Google's reCAPTCHA embeded. I would like to load this page via HTTP and display CAPTCHA within my app, so that user can post comments from my app. Is it easy...

Server initiated requests

http,go,http2
I know that http is a request-response protocol, the problem in short is a client makes a request to the server to start a long running process, and i want to inform the client over the progress with a simple json message containg progress info. in http1 i know that...

ActiveMQ http connection error

java,http,jms,activemq,producer
I am trying to connect my java client application to ActiveMQ over http, but keep getting an error: (complete error at the bottom) javax.jms.JMSException: Could not post command: ProducerInfo No such field org.apache.activemq.command.ProducerInfo.sentCount Also, there is connection to ActiveMQ, because the server also produces an error: (complete error at the...

GET request throws error after app implemented SSL: Mixed Content: This request has been blocked; the content must be served over HTTPS"

angularjs,http,ssl,https,flask
Mixed Content: The page at 'https://www.example.com/dashboard' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://api.example.com/inventory/10/'. This request has been blocked; the content must be served over HTTPS. We have this Angular web app that runs with Flask on the back-end. Everything was working fine until we implemented...

Ruby - How to capture and store a session cookie on login?

ruby,http,cookies
I need to accomplish what the following curl command is doing in Ruby. The curl command logs in to my website and stores all the cookies returned. Amongst which is a session cookie that I need to execute further restful stuff though my API. How do I do that in...

$http.delete returns error without information

javascript,angularjs,http
I have a weird problem with AngularJS and a REST webservice. This is my code: $http.delete(appSettings['baseUrl'] + 'pricelistitem/' + article.itemNumber + '/' + article.acc) .error(function(e) { console.log(e); }); When calling this, I'm getting an error and the .error is executed, but the e object is null. In the console, I'm...

ActiveMQ http connection refused

java,http,activemq,connect
I am trying to connect my java client application to ActiveMQ over http, but keep getting an error: Failed to perform GET on: http://localhost:8080 as response was: Connection refused: connect This connections works why I connect with: tcp://localhost:61616 activemq.xml <broker> ... <transportConnectors> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> <transportConnector name="http" uri="http://0.0.0.0:8080"/> </transportConnectors>...

Mule: Migrating to the New HTTP Connector

http,mule,cxf
I've upgraded from Mule 3.5.x to 3.6.x and since the old http transport is deprecated in 3.6.x I wanted to migrate to the new HTTP connector. Here is the original code for calling my webservice: <http:outbound-endpoint ref="OrderEndpoint" doc:name="GetApprovedOrder"> <cxf:jaxws-client serviceClass="com.acme.orders.IOrderServiceBean" port="OrderServiceBean_v2_0Port" operation="getApprovedOrderOp" /> </http:outbound-endpoint> The point I have got to...

Swift: Filter a POST http request answer

json,uitableview,swift,http,post
On swift, I am querying a server by an HTTP Post request, with: let myUrl = NSURL(string: "http://****.*****.***.***/****.php"); let request = NSMutableURLRequest(URL:myUrl!); request.HTTPMethod = "POST" let session = NSURLSession.sharedSession() var getDefaults = NSUserDefaults.standardUserDefaults(); var password = getDefaults.valueForKey("password") as! String; var id = getDefaults.valueForKey("login") as! String; var err: NSError? let postString...

Method Put not Allowed in IIS 7.5 using Type Script + Angular Js + Web API Status 405

angularjs,http,typescript,iis-7.5,typescript1.4
I have implemented a code using Type Script and Angular Js and used http.put and passing some data to my web API than get the response from my Web API and fill it into the grid. But now the problem is i am getting error of 405 Method Not Allowed...

POST Android json data

java,android,json,http
I'm trying to POST some data to my server, but I don't know why, I always get 400 messages from it. I want to send this POST structure: POST /api/v0.1/observations/3 HTTP/1.1 Host: 54.154.117.132` Content-Type: application/json Cache-Control: no-cache { "data" : { "field1" : 1111111 }, "timestamp": "2015-05-13T12:23:42.648738" } If I...

HttpTransportSE .call() method has no action

java,android,http,ksoap2
I'm trying to make an Android App that gets the weather based off a zipcode you enter, and that also displays the time in EST and GMT format. I am using webservices (WSDLs) and have the code written to access it, the code is below: public void sendMessage(View view) {...

Jquery load https url

javascript,jquery,http,https
I have this problem. In external web site I have a script like this: <div id="idtest"></div> <script src="//example.com/widget.js" type="text/javascript"></script> example.com is in https (allow both http and https). In the server in the script widget.js I have: $('#idtest').load("https://example.com/index.html") I get this error: Mixed Content: The page at 'thepage' was loaded...

Android http error

android,http
I am trying to download a file from my Dropbox but my app chrashes and the error logs speak about http errors, what did I do wrong? The error log just says "Caused by: android.os.NetworkOnMainThreadException" then lists alot of http errors private final String PATH = "/data/data/com.emiliogaines.fuelfinder/shared_prefs/"; //put the downloaded...

Is it possible to return a HTTP request to apache after php processing?

php,apache,http
What I want to do is the following: A User initates a HTTP GET request for a static file (for example an image or an mp3 file for HTML5 audio) A PHP script intercepts these requests (for example via mod_rewrite) and checks the cookie for valid authentification If successful, the...

How can i added default header for DELETE in angular js

javascript,angularjs,django,rest,http
This is working fine in angular js $http.defaults.headers.post['X-CSRFToken'] = $cookies['csrftoken']; $http.defaults.headers.put['X-CSRFToken'] = $cookies['csrftoken']; $http.defaults.headers.patch['X-CSRFToken'] = $cookies['csrftoken']; But this is not working $http.defaults.headers.delete['X-CSRFToken'] = $cookies['csrftoken']; ...

Does Ruby support nonblocking HTTP requests without a third-party library?

ruby,http,asynchronous,gem,eventmachine
I am writing an API to access resources on one of my servers. Part of this API will make HTTP requests. In the name of good software design, I don't want my API to be blocking. I am fairly new to Ruby, but in Java I would provide an Asynchronous...

Why I got so many connection events on Node's HTTP server?

javascript,node.js,http,websocket,socket.io
I have a web application using socket.io. It runs on localhost:8000 on my local machine. In order to find an annoying resource leak in my application, I tried to log out the connection events on my HTTP server: server.on('connection', function(conn) { //log out connection details }); When I open the...

Time HTTP Response in Go

http,go
In my Go program, I made some HTTP requests and I need to time the response time (and not request time). Here is my current code (timing request time): func Get() int { start := time.Now() result, err := http.Get("http://www.google.com") if err != nil { log.Fatal(err) } defer result.Body.Close() elapsed...

Purpose of Pseudo/Colon Header Fields

http,networking,http-headers,protocols,http2
As the title suggests, I'm looking for some information on the purpose of pseudo/colon header fields, i.e. I want to know why we have a second type of header field... Also - I know pseudo/colon header fields are used in http2 in place of the message and status lines (^^^the...

Simple Java Web validation Neither BindingResult nor plain target object for bean name 'number' available as request attribute

java,spring,http,web
I have a problem on validating a simple "NumberValidate" Object Here you see the JSP file: <[email protected] contentType="text/html" pageEncoding="UTF-8"%> <[email protected] uri="http://www.springframework.org/tags" prefix="spring"%> <[email protected] uri="http://www.springframework.org/tags/form" prefix="form"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h1>Vul een nummer in:</h1>...

Profile/account REST API naming convention

php,web-services,api,rest,http
I have tried to search the net, but haven't found any example of best practice url naming convention for the following requests. My API allows user to log into the system, retrieve secure token which can be used to access private data over the HTTPS. So there following features will...

AngularJS simple auth interceptor

ajax,angularjs,http,angular-http-interceptors
I want to pass in the headers my token each time i make a request. the way i do it now is using: $http.defaults.headers.common['auth_token'] = $localStorage.token; How could i do that to make that sent to every request, and when it throws an error it should do a $state.go('login') ...

Copied ssl cert to a test site, how do I remove it?

http,ssl,drupal,https,softlayer
I copied my site to a new virtual server with Softlayer but when I did the the security cert came to. now every time I try to log to my new development site it give warnings saying that the site has taken its cert from another source. I am using...

Python Multiplayer noughts and crosses [closed]

python,http,client,server,multiplayer
So I made a single player noughts and crosses in Python a little while ago in school. score=[[' ',' ',' '],[' ',' ',' '],[' ',' ',' ']] global attempts attempts = 0 from random import randint from time import sleep def grid(): #draws playing grid hideturtle() speed(0) pensize(0) penup() setpos(-200,...

ASP.net MVC HTTP Request error with payload

asp.net,json,asp.net-mvc,http
I am creating an ASP.net MVC website with a RESTful API to a SQL database. I have implemented a controller which holds the HTTP commands. One of the commands is a POSTcommand: // POST: api/PoolTests [ResponseType(typeof(PoolTest))] public IHttpActionResult PostPoolTest(PoolTest poolTest) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.PoolTests.Add(poolTest); db.SaveChanges(); return...

C++ Winsock programming, receiving no response from HTTP protocol

c++,sockets,http,tcp,ip
As the title says, I've just began studying how the TCP/IP protocol applies to C++, so I tried sending a packet to any random website (In this case www.nasa.gov), using the IP address (DNS Resolver) and a random port (I went for 80), and I am receiving no answer. I...

Converting curl command to iOS

ios,swift,http,curl
The following curl works curl -G -H "api_key: MYAPIKEY" https://api.semantics3.com/test/v1/products -d 'q={"upc":"70411576937"}' However, upon trying to convert it to iOS I get the following error: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." {NSErrorFailingURLStringKey=https://api.semantics3.com/test/v1/products,...} I have attached my code below but I believe that my problem is the "q=" right...

Basic HTTP server w/ Node JS

node.js,http,server
I'm in a bit of a predicament. I'm new to coding in general, and this is my assigned program for my JavaScript class this week. We are supposed to create a web server that serves files from a file system, that also implements Node modules. It must be able to...

Handling POST request via Socket in Java

java,sockets,http,post,request
I'm trying to handle a simple POST Request in Java using a Socket. I can receive the request header and answer the request without any problem, but I certainly can not get the body of the request. I read somewhere that I'd need to open a second InputStream to achive...

How to make a jax-rs end point accept any type of http request?

http,jax-rs,resteasy
The title says it all. Is there any request type annotation to do that? Or is it enough to annotate the method with all the required types like @POST, @GET?...

Integrating PHP Curl

php,mysql,xml,http,php-curl
I have the code below which calls up an MySQLi and presents it in XML form in my browser. The next stage is that instead of presenting it in my browser I want to send it to another IP address using PHP Curl. Please can someone help me with the...

How do I password protect an HTTP Get Request on my Apache Tomcat server?

java,apache,http,tomcat,servlets
I want to send a user some data only if they correctly supply the username and password in the header of their HTTP request. I tried doing this via the HttpServletReqest login() method, but it hasn't worked. this is my server's doGet method: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws...

RestSharp - How do I get the numerical http response code?

c#,http,restsharp
I'm using the RestSharp HTTP client library for C#. How I would retrieve the actual numerical http response code? Not only do I not see a property containing the numerical code but I don't even see it in the headers collection....

Unable to modify active record inside of net/http callback

ruby-on-rails,ruby,http,net-http
I'm unable to set an attribute in the callback of a Net::HTTP GET request. Why is this happening? def validate(params) ... net http setup ... res = Net::HTTP.get_response(URI(path)) print res.body print res.code << prints 200 if res.code == 404 puts "404" elsif res.code == 200 user.validated = Time.now user.save valid...

Adding headers to 307 redirection

node.js,http,redirect,http-status-code-307
Is it true that you cannot add/modified 307 header except Location? I'm trying to do that in Node.js and seems that newly added header 'X-Atlassian-Token': 'no-check' is not used by the client. res.writeHead(307, { 'Location': 'http://www.mytest.com?os_authType=basic', 'Content-Type': 'multipart/form-data', 'X-Atlassian-Token': 'no-check' }); res.end(); Somebody has asked the same question on Stackoverflow...

Chrome Extension : How to intercept requested urls? [closed]

google-chrome,http,google-chrome-extension
How can an extension intercept any requested URL to block it if some condition matches? Similar question for Firefox. What permission needs to be set in manifest.json?...

How to return value in Meteor.JS from HTTP.call “GET”

javascript,ajax,http,meteor,facebook-javascript-sdk
I'm writing a meteor method, which should return a Facebook response for HTTP.call on graph api, but HTTP.call has only a callback function to show error/response, so I can't take this data outside, and Method can not return any value. Here's my method code: loadUserFBEvents: function () { var accessToken...

curl ignore --data starting with @ sign: don't read from file

http,curl,slack-api
In slack you can script slackbot to post messages to a channel like this: curl --data "$msg" $'https://<yourteam>.slack.com/services/hooks/slackbot?token=<yourtoken>&channel=#random' Now i'd like to mention a username as the first part of the message like msg="@joernhees hello self". The problem with this is that if the --data argument of curl starts with...

golang mux HandleFunc always 404

http,go
I try to handle HTTP request using mux instead of standart HandleFunc from net/http, because of reasons. With http it used to work, with mux it doesnt. import ( _ "github.com/go-sql-driver/mysql" "github.com/gorilla/mux" _ "io/ioutil" "net/http" ) func init() { mx := mux.NewRouter() //create a poll mx.HandleFunc("/poll", pollCreate) mx.HandleFunc("/poll/{id}", loadPoll) mx.HandleFunc("/poll/vote",...

In simple RESTful design, does PATCH imply mapping to CRUD's (ORM's) “update” and PUT to “destroy”+“create” (to replace a resource)?

database,rest,http,orm,crud
I'm trying to create a simple REST API and map it to CRUD. I have an ORM (DataMapper) which has methods like create, update and destroy. If I get it right, given a resource {a:'foo',b:'bar',c:'baz'}, performing a PUT {b:'qux'} is supposed to replace the resource and result in the same...

headless browsing - WWW::Mechanize and HTTP::Response

perl,http
I'm playing with WWW::Mechanize, i.e. my $mech = WWW::Mechanize->new(\%opts); $mech->get($url); my $reponse = $mech->follow_link(regex_url => qr/some link/); $response is returned as an HTTP::Response object. My question is, can I use my $mech to continue to follow links in the response, submit forms, etc? What can I do with the $response...

Swift: convert JSON from URL to multiple strings

json,swift,http,parsing,url
I am on a difficult part of swing and after hours or investigations, I have found informations but not enough to perform what I look for. I'am sending a POST http request to a server, this one send me back a JSON converted as an NSDictionnary: let json = NSJSONSerialization.JSONObjectWithData(data,...

Typehead displays wrong on certain input

angularjs,twitter-bootstrap,http,angular-ui-bootstrap
I am using a uiTypehead for input selection. It works well except for a simple fact. My inputs always have the form like {name: "Las Vegas McCarran International (LAS)<span class="country">United States</span>", iata: "LAS"} So I insert <span class="country">...</span> from my backend into the string. When I then type in "veg"...

Does libcurl load complete page in single shot?

c++,http,libcurl
I'm using libcurl to fire HTTP request. Does lincurl load complete page in single shot, or for sub-links on page i.e. .css or. png file it request separately....

How are YouTube and Google accessing each others cookies?

http,cookies
A lot of researching on stackoverflow told me that getting/setting cookies from other domains isn't possible. but I can see youtube.com is doing that with google.com How are they doing that then?...

Doubts on the correctness of Microsoft Azure Multimedia Services REST API

rest,http,azure,httpverbs
The Azure API claims to be a REST API. I found it while for patterns and sample implementations and verbs in REST, when inspecting it in their (supposedly) REST API reference, they seem to have invented a new verb CancelJob and altering internal state via an HTTP GET GET https://media.windows.net/API/CancelJob?jobid='URL-encodedvalue'...

Constructing payload in AngularJs POST calls

javascript,angularjs,http
In my application, I need to make POST requests with this information: "data": [ { "type": "Search", "thing": "{"Table":"Movie","Field":"Title","Type":"String","Value": "INPUT VALUE GOES HERE"}" }, { "type": "Search", "thing": "{"Table":"Movie","Field":"Director","Type":"String","Value": "INPUT VALUE GOES HERE"}" }, { "type": "Search", "thing": "{"Table":"Movie","Field":"Year","Type":"String","Value": "INPUT VALUE GOES HERE"}" } ] I have directives that are...

Can the HTTP method “PATCH” be safely used across proxies etc.?

http,caching,filter,proxy,http-patch
Suppose my server exposes an HTTP-based API that uses the PATCH method introduced by RFC 5789. Is it possible that clients (browsers or otherwise) behind corporate firewalls, proxies, caches, parental controls filters and the like will encounter any problems using this method? If so, how likely is this? Given that...

Which Http error/status code is the appropriate?

javascript,http
I've carefully read all HTTP error/status codes, still not clear which is the appropriate to return in the following scenario: The request is an Ajax request, so the handling of the error situation depends on the client javascript code, preferably it will give a notification. At server side an unexpected...

nodejs head request isn't triggering events

node.js,http
Here's my code: var http = require('http'); var req = http.request( { host: 'example.com', method: 'HEAD', path: '/' }, function(res){ res.on('end',function(){ console.log('Ended'); }); res.on('finish',function(){ console.log('Finished'); }); res.on('close',function(){ console.log('Closed'); }); } ); req.end(); Strange thing about it is that it doesn't print anything. Takes longer than expected and exits. Is this...

$http headers is not a function - angularjs

php,angularjs,http
I am posting data to Dynamics CRM via SOAP on my PHP server with cURL. After this is done it is giving the entity GUID in the form of a HTTP Response header. When attempting to access this via my angular factory and $http. My header is exposed and is...

NSIS: Make async web request with query string

http,asynchronous,nsis,sendasynchronousrequest
How do I make an asynchronous GET request to URL like http://www.example.com/somepage?param1=val1&param2=val2 in NSIS. I don;t care about response - all I want is make a request and disregard response (so not for downloading files). Currently I use inetc plugin, however it is less than optimal for 2 reasons: It...

Idempotent PUT in a concurrent environment

api,rest,http,idempotent
Context I have a REST API where multiple clients (applications) can update the state of a resource with PUT. For the example, this resource is a lamp that you can turn ON or OFF. This resource is also automatically updated by the system when it detects that an electricity failure...

My get request for http is very slow [closed]

sockets,http,get
I need to make a request through a socket and catch the response but in while block goes slow. I think i have written enough information, but if someone can help me and need additional information i will answer him/her. Thank you. import java.io.InputStream; import java.io.PrintWriter; import java.net.InetAddress; import java.net.Socket;...

How to create the get method for the call

php,arrays,json,http,quickblox
I am studying and implementing an api and while following the examples, Here is the example 1 : curl -X POST \ -H "Content-Type: application/json" \ -H "QuickBlox-REST-API-Version: 0.1.0" \ -d '{"application_id": "2", "auth_key": "DtF9cZPqTF8Wy9Q", "timestamp": "1333630580", "nonce": "1340569516", "signature": "13293a5bd2026b957ebbb36c89d9649aae9e5503", "user": {"login": "injoit", "password": "injoit"}}' \ https://api.quickblox.com/session.json For the...

What is the correct newline to use with text/plain ContentType?

http,newline,content-type
When a webserver claims ContentType: text/plain in an HTTP response can the client assume newlines are '\n', or '\r\n', something else, or should it allow both? What standards specify? I am lost and confused among the standards. RFC 2046 appears to define the 'plain' subtype, but there refers to RFC...

Routing in Ionic

angularjs,http,ionic-framework
I have an Ionic app where I am calling $http through a factory: .factory('Articles', function ($http) { var articles = []; return { all: function () { return $http.get("http://jsonp.afeld.me/?url=http://examplesite.com/page.html?format=json").then(function (response) { articles = response.data.items; console.log(response.data.items); return articles; }); }, get: function (articleId) { for (var i = 0; i <...

How does a WebHook work?

php,http,paypal,stripe-payments,webhooks
I'm currently implementing payments platform to my website wich is very similar to Stripe, but I still can't understand the process or how should I use WebHooks since I need to specify one on my account in the payments platform. So let's say a person pays in my website for...

AngularJS / OAuth 2 transport-layer security

angularjs,http,oauth-2.0,http-post
The OAuth service I am trying to get the response from is working but something wrong in my code which does not make the request. $http.post(myURL, 'grant_type=password&username=' + userName + '&password=' + passWord, headers: { 'Content-Type: application/x-www-form-urlencoded', 'Authorization Basic ' + btoa(secretWord) }). success(function (response) { console.log(response); }). error(function (response)...

HTTP Status 500 - NoSuchElementException

java,http
I've been getting this error and I haven't found a way to come around it yet. Seems to be something regarding the scanner, but I'm not sure what to change here. My LoginServlet: package web; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; import javax.servlet.RequestDispatcher; import...

request.headers['HTTP_AUTH_TOKEN'] does not work for https server

ruby-on-rails,http
My code try to read the auth_token from headers in rails. def authenticate_through_header custom_header_value = request.headers['HTTP_AUTH_TOKEN'] end this does not work for a https server but works for http server. Any ideas?...