cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[curl:bugs] #1248 curl_multi_socket_action and HTTP redirect does not work when using epoll

From: Daniel Stenberg <bagder_at_users.sf.net>
Date: Wed, 19 Jun 2013 21:07:17 +0000

- **labels**: --> multi_socket

---
** [bugs:#1248] curl_multi_socket_action and HTTP redirect does not work when using epoll**
**Status:** open
**Labels:** multi_socket 
**Created:** Wed Jun 19, 2013 06:18 PM UTC by Erik Johansson
**Last Updated:** Wed Jun 19, 2013 09:06 PM UTC
**Owner:** Daniel Stenberg
(Also posted to mail list: http://curl.haxx.se/mail/lib-2013-03/0045.html)
While trying to use curl_multi_socket_action together with epoll I noticed that it didn't work in combination with HTTP redirect.
When a socket is first connected, CURLMOPT_SOCKETFUNCTION is called and the socket is added to the epoll set. Later on when libcurl connects to the HTTP server and sees the redirect it closes the socket (which makes the kernel remove the socket from the epoll set) and opens a new. Unfortunately this new socket gets the same number as the old, and thus the socket function callback is never called to add it to the epoll set.
Tested with libcurl from git: e305f5ec
OS: Linux 3.8.0 (Ubuntu 13.04) x86_64
How to reproduce:
* Run the attached httpserver.py. It will output:
~~~~
Connect to http://127.0.0.1:9800 to be redirected to http://127.0.0.1:5400
~~~~
* Build and run the attached curlepoll.c like this:
~~~~
# ./curlepoll http://127.0.0.1:9800
...
>>> calling epoll_wait
>>> calling epoll_wait
>>> calling epoll_wait
^C
~~~~
It hangs in epoll_wait and must be aborted with Ctrl-C.
* Now test with poll instead:
~~~~
# ./curlepoll http://127.0.0.1:9800 poll
...
>>> calling poll
Hello Port 5400!
>>> calling poll
>>> socketCallback: removing fd=4
>>> bye bye
~~~~
Works as expected.
---
Sent from sourceforge.net because you indicated interest in <https://sourceforge.net/p/curl/bugs/1248/>
To unsubscribe from further messages, please visit <https://sourceforge.net/auth/subscriptions/>
Received on 2013-06-19

These mail archives are generated by hypermail.

donate! Page updated May 06, 2013.
web site info

File upload with ASP.NET