Questions tagged [http]

HyperText Transfer Protocol (HTTP) is an application level network protocol used for the transfer of content on the World Wide Web.

Filter by
Sorted by
Tagged with
7
votes
1answer
6k views

Elegantly handle github API requests exceptions

I have this code which creates a team using the github API and returns the team-id(success) or -1(failure). My problem is with the error handling. When the request responses with an error status code ...
7
votes
2answers
9k views

Get host ip address behind load balancer or without lb

Description Aplication type: WEB API .NET Framework: 4.5 MVC: 5 I need caller host ip in my custom action filter and then in action. On some enviroments we have configured load balancer which ...
7
votes
1answer
10k views

Python auth using requests

I am trying to implement a custom ApiClient in Python, using requests. The way it does authentication is by: login(username, password) -> get back a token if valid, http error code if not set the ...
7
votes
1answer
1k views

Go cookie authentication system

I'm working on a login system in Go (Golang). Previously, I was using Gorilla Sessions for this, but I wanted to see if I could reinvent the wheel and make it simpler. Also, I don't need to store ...
7
votes
1answer
206 views

Testing uptime of my personal server

I made some code to test my personal servers uptime. It logs in to my router page and sees if it returns status 200. A cron job runs it every 5 minutes. Please let me know if I can make the code more ...
7
votes
1answer
423 views

Improved minimal webcrawler - why is it so slow?

I recently made a webcrawler that I submitted here for a review: Minimal webcrawler - bad structure and error handling? With that help, I've made a much cleaner and better(?) webcrawler. The only ...
7
votes
1answer
4k views

HTTP Authorization header parser

I'm writing a parser for HTTP Authorization header (see RFC2616#14.8 and RFC2617#1.2). Note that I explicitly don't care about the base64-encoded syntax used by HTTP Basic authentication. I'm only ...
7
votes
1answer
106 views

First SO chat message in Haskell followup

I have wrote an application which asks for the user id, and returns a link to the first available chat message: Output Enter user id: 322395 Fetching data... http://chat.stackoverflow.com/...
7
votes
0answers
684 views

Read quantization tables from JPEG files

I'm developing an application that will hide information inside the quantization tables of JPEG files. It's called DQTsteg, if you want to know more about what I'm attempting to do. Right now I'm ...
7
votes
1answer
145 views

BingWallpapers: Fetches and applies the image of the day from Bing as the wallpaper

I have written a small desktop program nabeelomer/BingWallpapers in Haskell. This is my first time writing Haskell. I was wondering how I can make the code use more functional programming features/...
6
votes
3answers
2k views

Creating HTTP proxies for services

I have a HTTP client factory that creates a separate HTTP proxy instance for each of my services - which are in the cloud. The factory creates each instance on the basis of an interface which the ...
6
votes
3answers
2k views

WSGI static file handler

I put up a simple WSGI static file handler, but I'm skeptical about its efficiency, also because I got a handful of errors while benchmarking it with Apache Benchmark. The errors are: ...
6
votes
4answers
2k views

Minimal webserver in C++

Here's my test question for C++ programmer job: Servers only static content, no cgi Single process, multithreaded 1000 concurrent request at least Valid http status codes and headers No external ...
6
votes
2answers
2k views

Parallel “wget” in Java

Purpose: write Java program that downloads a list of URLs specified on commandline in parallel (simultaneously), reporting download completion every second. My solution follows below, please point ...
6
votes
2answers
220 views

Holding server response header data after parsing it

I'm creating a program to retrieve web content in order to learn how these things work. I would like it to be as correct as possible, ideally fully compliant. But I'm not sure this is the right ...
6
votes
2answers
4k views

Internet Speed Calculator

This program calculates up and downspeed of a given connection for as long as it is running. ...
6
votes
4answers
77 views

Two HTTP notification methods

I have two very similar methods, which make HTTP requests, the difference is that one makes PUT and another GET. Is there any proper Ruby way not to repeat the setup code and not to pass the flag ...
6
votes
2answers
10k views

Implement HTTP Server with persistent connection

I am trying to implement a HTTP Server in Java, I want the server to use a persistent connection per thread for request and response. After some research on Google, this is how my program looks like. ...
6
votes
1answer
151 views

Reading and returning the HTML content from a specified URL

I wanted to create a simple function that can read and return the HTML content from a specified URL. This is what reading here and there lead me to: ...
6
votes
2answers
4k views

Single class which holds response and error message

I am working on a library which will make HTTP call to my rest service basis on inputs passed to this library. And whatever response comes back from service whether it is successful response or ...
6
votes
1answer
1k views

Simple Rust Webserver

I started learning Rust today and for my first project created a simple webserver. I don't have a clear vision about Rust programming and I tried to write it with my previous knowledge in Python and ...
6
votes
1answer
251 views

Checking web-page repeatedly

I have a program that gets 5 random dice throws from random.org over and over. In order to avoid doing getaddrinfo() over and over with the exact same data, I moved ...
6
votes
1answer
142 views

Tokenizing texts from Gutenberg archive for analysis

I am writing a program to analyze books from the Gutenberg archive. The program takes the title and URL and finds the text and downloads it. Then it goes through the text and tokenizes it. Here is the ...
6
votes
1answer
312 views

Calling other machines from the LinkedList if one is blocked or down

This is a follow on to : Simplifying asynchronous "executeAsync" method along with "onFailure" callback. I am using AsyncRestTemplate as my <...
6
votes
1answer
3k views

HTTP downloader using Beast

I have written a small HTTP downloader using boost::asio Beast library (proposed to be included in Boost) network::uri library ...
6
votes
1answer
178 views

Geocode an address

We have a geocoding samples github repository. The snippet below came through in an email and I am not very familiar with PHP. I'd like to add this as the PHP example in the samples repository but ...
6
votes
1answer
62 views

My second requests script for a wargame

This is a addition to my previous question earlier today. I've taken the suggested changes into account and have written a solution to Natas7, a problem that requires some more 'meat' on what I'd ...
6
votes
2answers
475 views

Authenticating web request to get the xml data from it

I wrote a method early of our development last year about getting the content of a webrequest where it contains an xml data that we need to process and insert to ...
6
votes
1answer
3k views

File downloader using Java, multithreading and HTTP Range request

I'm making a file downloader using Java. The project is on GitHub; I have included the most relevant excerpts here. I separate the file into parts and download them using HTTP Range request, with ...
6
votes
2answers
948 views

Crawl site getting URL and status code

I wrote a crawler that for every page visited collects the status code. Below my solution. Is this code optimizable? ...
6
votes
1answer
18k views

Socket HTTP post request

I am working on a socket HTTP post request. Here is one method that I come up with. It looks dirty and is in C instead of C++. ...
6
votes
1answer
111 views

Method to determine redirect after login

I have a method that returns a URL to send a user should they pass a login. My problem is two of these links are hard coded one of which is attempting to pass a variable to the model of that ...
6
votes
1answer
79 views

Script to download sequentially named files, rename them, and delete smaller files

I've written a little script to download sequentially named files, rename them, and delete files smaller than an certain number of kilobytes. I came up with this but I'm not too happy. Any advice for ...
6
votes
1answer
3k views

HTTP Get with proxy

The code is implemented to perform HTTP get with HTTP proxy. Future object is adopted to avoid blocking in current thread. I'm not quite sure about the usage of HTTP connection pooling manager and ...
6
votes
1answer
4k views

Interfacing with RESTful web services

The following working function seems a bit hacky to me as it has been pieced together from a handful of (probably poorly written) online tutorials, and I want to know if there is a better (or more ...
6
votes
1answer
308 views

Concurrent download in Go

I wrote a program for downloading files in concurrent / parallel (GOMAXPROCS > 1) manner. This is my 2nd (non-toy) program written in Go. Please point out areas for improvement: ...
6
votes
0answers
1k views

Improving the Flask cache decorator

In my rumblings developing flask applications I found the caching decorator. The decorator is a short and well-written piece of code, but I feel like it misses the few points bellow: It only caches ...
5
votes
3answers
2k views

WinInet C++ Wrapper

Because I don't like complex sequences of code for simple functions, I wrote a wrapper for http/https access in A++. Are there any bad programming practices I am using? Is there any functionality I ...
5
votes
2answers
657 views

Asynchronous HTTP JSON request

For asynchronous requests, I use Alamofire. I have created one method for requesting async data. ...
5
votes
2answers
107 views

HttpClient reusable instance for simple calls on another methods

I wrote a HttpClient instantiable class that will be used as reference to simplify API calls in other methods inside other classes, so the user could call it in a ...
5
votes
2answers
1k views

Parsing httpline

I have an HTTP server class (.hpp & cpp). I am trying to improve reserve data from the socket class because I have s.getline() to get HTTP call. My ...
5
votes
1answer
950 views

Download Images as fast as possible

I have a spreed sheet and its something like 550+ columns and I need to pull URLs from it. Previously I was using LinqToExcel when the sheet was less than 255 columns a recent update has produced this ...
5
votes
2answers
4k views

Decrease Image downloading time with HttpURLConnection

This is piece of code is using to download images. Can somebody tell me how to optimize this code to decrease download time for each image? ...
5
votes
2answers
6k views

Is it ok to use HttpContext inside View?

I have a pretty common issue: I need to know the name of current user and also name of the current controller so I can highlight/disable some links. Here's some solutions I found by myself: Get all ...
5
votes
1answer
6k views

Receiving a JSON string response from a URL

I am using RestTemplate as my HttpClient to execute a URL while the server will return a JSON string as the response. The ...
5
votes
1answer
3k views

A simple little Python web crawler

The crawler is in need of a mechanism that will dispatch threads based on network latency and system load. How does one keep track of network latency in Python without using system tools like ping? <...
5
votes
1answer
3k views

Python API client

I'm creating a Python API client, after thinking and checking some open source Python clients I created this class, and I'm looking for any feedback (design, best practices...), this is an example URL ...
5
votes
2answers
192 views

Downloading list of images

This code downloads a list of images, each in a different thread. I have some questions about this code: I don't know how to get information about correcting downloading (sometimes thread just ...
5
votes
1answer
16k views

Unit testing HTTP requests

I would like to unit test my web requests, so on top of my head I came up with the solution below. Since it seems to be working fine, I'm posting it on this site. Though it doesn't feel very dynamic, ...
5
votes
2answers
239 views

Minimal webserver in C++, second revision

First revision: Minimal webserver in C++ Here's my test question for C++ programmer job: Servers only static content, no cgi Single process, multithreaded 1000 concurrent request at least Valid http ...